From 5b55595e213243248beae1530b6269ae468136e7 Mon Sep 17 00:00:00 2001 From: "radha%netscape.com" Date: Wed, 1 Sep 1999 13:58:31 +0000 Subject: [PATCH] Fix warnings --- xpfe/AppCores/src/nsBrowserAppCore.cpp | 15 ++++++--------- xpfe/appshell/src/nsSessionHistory.cpp | 26 ++++++++------------------ 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/xpfe/AppCores/src/nsBrowserAppCore.cpp b/xpfe/AppCores/src/nsBrowserAppCore.cpp index fbc6b4fc80ba..6cab5ce1c763 100644 --- a/xpfe/AppCores/src/nsBrowserAppCore.cpp +++ b/xpfe/AppCores/src/nsBrowserAppCore.cpp @@ -493,8 +493,6 @@ NS_IMETHODIMP nsBrowserAppCore::CreateMenuItem( nsString menuitemCmd("gotoHistoryIndex("); menuitemCmd.Append(aIndex); menuitemCmd += ")"; - const char * actionhandler = menuitemCmd.ToNewCString(); - if (APP_DEBUG) printf("nsBrowserAppCore::CreateMenuItem Setting action handler to %s\n", menuitemCmd.ToNewCString()); nsString attrName("oncommand"); rv = menuItemElement->SetAttribute(attrName, menuitemCmd); @@ -782,7 +780,7 @@ nsBrowserAppCore::ClearHistoryPopup(nsIDOMNode * aParent) rv = childList->Item(i, &child); if (!NS_SUCCEEDED(rv) || !child) { printf("nsBrowserAppCore::ClearHistoryPopup, Could not get child\n"); - NS_ERROR_FAILURE; + return NS_ERROR_FAILURE; } // Get element out of the node nsCOMPtr childElement(do_QueryInterface(child)); @@ -799,16 +797,16 @@ nsBrowserAppCore::ClearHistoryPopup(nsIDOMNode * aParent) rv = menu->RemoveChild(child, &ret); if (NS_SUCCEEDED(rv)) { if (ret) { - if (APP_DEBUG) printf("nsBrowserAppCore::ClearHistoryPopup Child %x removed from the popuplist \n", child); + if (APP_DEBUG) printf("nsBrowserAppCore::ClearHistoryPopup Child %x removed from the popuplist \n", (unsigned int) child); NS_IF_RELEASE(child); } else { - printf("nsBrowserAppCore::ClearHistoryPopup Child %x was not removed from popuplist\n", child); + printf("nsBrowserAppCore::ClearHistoryPopup Child %x was not removed from popuplist\n", (unsigned int) child); } } // NS_SUCCEEDED(rv) else { - printf("nsBrowserAppCore::ClearHistoryPopup Child %x was not removed from popuplist\n", child); + printf("nsBrowserAppCore::ClearHistoryPopup Child %x was not removed from popuplist\n", (unsigned int) child); return NS_ERROR_FAILURE; } NS_IF_RELEASE(ret); @@ -1329,8 +1327,8 @@ nsBrowserAppCore::LoadInitialPage(void) if (!argsElement) { // Couldn't get the "args" element from the xul file. Load a blank page if (APP_DEBUG) printf("Couldn't find args element\n"); - nsString * url = new nsString("about:blank"); - rv = LoadUrl(nsString(urlstr)); + nsString url = nsString("about:blank"); + rv = LoadUrl(url); return rv; } @@ -1855,7 +1853,6 @@ nsBrowserAppCore::OnProgressURLLoad(nsIDocumentLoader* loader, #endif { nsresult rv = NS_OK; - PRUint32 progress = aProgressMax ? ( aProgress * 100 ) / aProgressMax : 0; #ifdef NECKO nsCOMPtr aURL; rv = channel->GetURI(getter_AddRefs(aURL)); diff --git a/xpfe/appshell/src/nsSessionHistory.cpp b/xpfe/appshell/src/nsSessionHistory.cpp index 28e3b73984f1..c134735d3e17 100644 --- a/xpfe/appshell/src/nsSessionHistory.cpp +++ b/xpfe/appshell/src/nsSessionHistory.cpp @@ -192,8 +192,6 @@ nsHistoryEntry::~nsHistoryEntry() nsresult nsHistoryEntry::DestroyChildren() { - nsHistoryEntry * hEntry=nsnull; - nsHistoryEntry * parent=nsnull; PRInt32 i, n; @@ -337,8 +335,6 @@ nsHistoryEntry::AddChild(nsHistoryEntry* aChild) nsresult nsHistoryEntry::Create(nsIWebShell * aWebShell, nsHistoryEntry * aParent, nsISessionHistory * aSHist) { - nsHistoryEntry * hEntry = nsnull; - const PRUnichar * name = nsnull; const PRUnichar * url = nsnull; @@ -351,7 +347,7 @@ nsHistoryEntry::Create(nsIWebShell * aWebShell, nsHistoryEntry * aParent, nsISes //Save the webshell id SetWebShell(aWebShell); - if (APP_DEBUG) printf("SessionHistory::Create Creating Historyentry %x for webshell %x, parent entry = %x\n", this, aWebShell, aParent); + if (APP_DEBUG) printf("SessionHistory::Create Creating Historyentry %x for webshell %x, parent entry = %x\n", (unsigned int)this, (unsigned int)aWebShell, (unsigned int) aParent); if (aParent) aParent->AddChild(this); @@ -483,7 +479,7 @@ nsHistoryEntry::Load(nsIWebShell * aPrevEntry, PRBool aIsReload) { mHistoryList->GetLoadingFlag(isLoadingDoc); if ((isInSHist && isLoadingDoc) || aIsReload) { - if (APP_DEBUG) printf("SessionHistory::Load Loading URL %s in webshell %x\n", cSURL->ToNewCString(), prev); + if (APP_DEBUG) printf("SessionHistory::Load Loading URL %s in webshell %x\n", cSURL->ToNewCString(), (unsigned int) prev); /* Get the child count of the webshell for a later use */ PRInt32 ccount=0; @@ -509,7 +505,7 @@ nsHistoryEntry::Load(nsIWebShell * aPrevEntry, PRBool aIsReload) { /* Mark the changed flag to false. This is used in the end to determine * whether we are done with the whole loading process for this history */ - if (APP_DEBUG) printf("SessionHistory::Load URLs in webshells %x & %x match \n", mWS, prev); + if (APP_DEBUG) printf("SessionHistory::Load URLs in webshells %x & %x match \n", (unsigned int) mWS, (unsigned int) prev); } /* Make sure the child windows are in par */ @@ -887,15 +883,15 @@ nsSessionHistory::add(nsIWebShell * aWebShell) if (newEntry) { if ((mHistoryLength - (mHistoryCurrentIndex+1)) > 0) { /* We are somewhere in the middle of the history and a - * new page was visited. Purge all entries from the current + * new page was visited. Purge all entries from the current * index till the end of the list and append the current * page to the list */ for(int i=mHistoryLength-1; i>mHistoryCurrentIndex; i--) { - nsHistoryEntry * hEntry = (nsHistoryEntry *)mHistoryEntries.ElementAt(i); - //NS_IF_RELEASE(hEntry); - delete hEntry; + nsHistoryEntry * hiEntry = (nsHistoryEntry *)mHistoryEntries.ElementAt(i); + //NS_IF_RELEASE(hiEntry); + delete hiEntry; mHistoryEntries.RemoveElementAt(i); mHistoryLength--; } @@ -943,14 +939,12 @@ nsSessionHistory::add(nsIWebShell * aWebShell) NS_IMETHODIMP nsSessionHistory::Goto(PRInt32 aGotoIndex, nsIWebShell * prev, PRBool aIsReload) { - nsresult rv = NS_OK; PRBool result = PR_FALSE; - int prevIndex = 0; if ((aGotoIndex < 0) || (aGotoIndex >= mHistoryLength)) return NS_ERROR_NULL_POINTER; - nsHistoryEntry * hPrevEntry=nsnull, * hCurrentEntry = nsnull; + nsHistoryEntry * hCurrentEntry = nsnull; //get a handle to the current page to be passed to nsHistoryEntry // as the previous page. @@ -1013,7 +1007,6 @@ nsSessionHistory::Reload(nsIWebShell * aPrev, nsURLReloadType aReloadType) NS_IMETHODIMP nsSessionHistory::GoBack(nsIWebShell * aPrev) { - nsresult rv = NS_OK; //nsHistoryEntry * hEntry=nsnull; if (mHistoryCurrentIndex <= 0) @@ -1027,9 +1020,6 @@ nsSessionHistory::GoBack(nsIWebShell * aPrev) NS_IMETHODIMP nsSessionHistory::GoForward(nsIWebShell * aPrev) { - nsresult rv = NS_OK; - PRInt32 prevIndex = 0; - if (mHistoryCurrentIndex == mHistoryLength-1) return NS_ERROR_FAILURE;