From f065fa4f1ff3719bc718b97a6a259276f35683a1 Mon Sep 17 00:00:00 2001 From: "scc%mozilla.org" Date: Sun, 20 Aug 2000 00:45:05 +0000 Subject: [PATCH] fixing code that relied on implicit string construction --- webshell/tests/viewer/nsBrowserWindow.cpp | 4 ++-- webshell/tests/viewer/nsWebBrowserChrome.cpp | 6 +++--- webshell/tests/viewer/nsXPBaseWindow.cpp | 2 +- xpfe/components/find/src/nsFindComponent.cpp | 2 +- xpfe/components/xfer/src/nsStreamTransfer.cpp | 6 +++--- xpfe/components/xfer/src/nsStreamXferOp.cpp | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/webshell/tests/viewer/nsBrowserWindow.cpp b/webshell/tests/viewer/nsBrowserWindow.cpp index df5384e7675..7de20436137 100644 --- a/webshell/tests/viewer/nsBrowserWindow.cpp +++ b/webshell/tests/viewer/nsBrowserWindow.cpp @@ -430,7 +430,7 @@ NS_IMETHODIMP nsBrowserWindow::SetTitle(const PRUnichar* aTitle) mTitle = aTitle; - NS_ENSURE_SUCCESS(mWindow->SetTitle(aTitle), NS_ERROR_FAILURE); + NS_ENSURE_SUCCESS(mWindow->SetTitle(nsAutoString(aTitle)), NS_ERROR_FAILURE); return NS_OK; } @@ -2187,7 +2187,7 @@ nsBrowserWindow::OnStatus(nsIChannel* channel, nsISupports *ctxt, rv = sbs->FormatStatusMessage(aStatus, aStatusArg, getter_Copies(msg)); if (NS_FAILED(rv)) return rv; PRUint32 size; - nsAutoString msg2 = (const PRUnichar*)msg; + nsAutoString msg2( NS_STATIC_CAST(const PRUnichar*, msg)); mStatus->SetText(msg2, size); } return NS_OK; diff --git a/webshell/tests/viewer/nsWebBrowserChrome.cpp b/webshell/tests/viewer/nsWebBrowserChrome.cpp index 2f81faa9fd3..e24144d132c 100644 --- a/webshell/tests/viewer/nsWebBrowserChrome.cpp +++ b/webshell/tests/viewer/nsWebBrowserChrome.cpp @@ -86,7 +86,7 @@ NS_IMETHODIMP nsWebBrowserChrome::SetJSStatus(const PRUnichar* aStatus) NS_ENSURE_STATE(mBrowserWindow->mStatus); PRUint32 size; - mBrowserWindow->mStatus->SetText(aStatus, size); + mBrowserWindow->mStatus->SetText(nsAutoString(aStatus), size); return NS_OK; } @@ -102,7 +102,7 @@ NS_IMETHODIMP nsWebBrowserChrome::SetOverLink(const PRUnichar* aLink) return NS_OK; PRUint32 size; - mBrowserWindow->mStatus->SetText(aLink, size); + mBrowserWindow->mStatus->SetText(nsAutoString(aLink), size); return NS_OK; } @@ -475,7 +475,7 @@ nsWebBrowserChrome::OnStatusChange(nsIWebProgress* aWebProgress, { if (mBrowserWindow->mStatus) { PRUint32 size; - mBrowserWindow->mStatus->SetText(aMessage, size); + mBrowserWindow->mStatus->SetText(nsAutoString(aMessage), size); } return NS_OK; } diff --git a/webshell/tests/viewer/nsXPBaseWindow.cpp b/webshell/tests/viewer/nsXPBaseWindow.cpp index b837887a3f0..8380e5a6613 100644 --- a/webshell/tests/viewer/nsXPBaseWindow.cpp +++ b/webshell/tests/viewer/nsXPBaseWindow.cpp @@ -361,7 +361,7 @@ NS_IMETHODIMP nsXPBaseWindow::SetTitle(const PRUnichar* aTitle) NS_PRECONDITION(nsnull != mWindow, "null window"); mTitle = aTitle; nsAutoString newTitle(aTitle); - mWindow->SetTitle(newTitle.GetUnicode()); + mWindow->SetTitle(newTitle); return NS_OK; } diff --git a/xpfe/components/find/src/nsFindComponent.cpp b/xpfe/components/find/src/nsFindComponent.cpp index d2043aaf304..c11e696aff4 100644 --- a/xpfe/components/find/src/nsFindComponent.cpp +++ b/xpfe/components/find/src/nsFindComponent.cpp @@ -421,7 +421,7 @@ nsFindComponent::Context::DoFind(PRBool *aDidFind) *aDidFind = PR_FALSE; - nsAutoString matchString = mSearchString; + nsAutoString matchString(mSearchString); if (!mCaseSensitive) matchString.ToLowerCase(); diff --git a/xpfe/components/xfer/src/nsStreamTransfer.cpp b/xpfe/components/xfer/src/nsStreamTransfer.cpp index 8021a3d92e3..24bc5e27351 100644 --- a/xpfe/components/xfer/src/nsStreamTransfer.cpp +++ b/xpfe/components/xfer/src/nsStreamTransfer.cpp @@ -96,7 +96,7 @@ nsStreamTransfer::SelectFileAndTransferLocation( nsIChannel *aChannel, nsIDOMWin nsresult rv = httpChannel->GetResponseHeader( atom, getter_Copies( disp ) ); if ( NS_SUCCEEDED( rv ) && disp ) { // Parse out file name. - nsCAutoString contentDisp = (const char*)disp; + nsCAutoString contentDisp(NS_STATIC_CAST(const char*, disp)); // Remove whitespace. contentDisp.StripWhitespace(); // Look for ";filename=". @@ -122,7 +122,7 @@ nsStreamTransfer::SelectFileAndTransferLocation( nsIChannel *aChannel, PRBool isValid = PR_FALSE; nsresult rv = SelectFile( parent, getter_AddRefs( outputFile ), - SuggestNameFor( aChannel, suggestedName ).GetBuffer() ); + SuggestNameFor( aChannel, suggestedName ) ); if ( NS_SUCCEEDED( rv ) && @@ -304,7 +304,7 @@ nsStreamTransfer::SelectFile( nsIDOMWindow *parent, nsIFileSpec **aResult, const // Guess a save-as file name from channel (URL) and/or "suggested name" (which likely // came from content-disposition response header). nsCString nsStreamTransfer::SuggestNameFor( nsIChannel *aChannel, char const *suggestedName ) { - nsCString result = suggestedName; + nsCString result(suggestedName); if ( !result.IsEmpty() ) { // Exclude any path information from this! This is mandatory as // this suggested name comes from a http response header and could diff --git a/xpfe/components/xfer/src/nsStreamXferOp.cpp b/xpfe/components/xfer/src/nsStreamXferOp.cpp index e52d173d595..45b48d6e332 100644 --- a/xpfe/components/xfer/src/nsStreamXferOp.cpp +++ b/xpfe/components/xfer/src/nsStreamXferOp.cpp @@ -409,7 +409,7 @@ nsStreamXferOp::OnStatus( nsIChannel *channel, nsXPIDLString str; rv = sbs->FormatStatusMessage(aStatus, aStatusArg, getter_Copies(str)); if (NS_FAILED(rv)) return rv; - nsAutoString msg = (const PRUnichar*)str; + nsAutoString msg(NS_STATIC_CAST(const PRUnichar*, str)); rv = mObserver->Observe( (nsIStreamTransferOperation*)this, NS_ConvertASCIItoUCS2( NS_ISTREAMTRANSFER_PROGID ";onStatus" ).GetUnicode(), msg.GetUnicode() ); @@ -451,7 +451,7 @@ nsStreamXferOp::OnStopRequest( nsIChannel *channel, // Notify observer that the download is complete. if ( mObserver ) { - nsString msg = aMsg; + nsString msg(aMsg); rv = mObserver->Observe( (nsIStreamTransferOperation*)this, NS_ConvertASCIItoUCS2( NS_ISTREAMTRANSFER_PROGID ";onCompletion" ).GetUnicode(), msg.GetUnicode() );