fixing code that relied on implicit string construction

This commit is contained in:
scc%mozilla.org 2000-08-19 20:52:04 +00:00
parent a38c2362f3
commit a6fe0ab74d
9 changed files with 24 additions and 23 deletions

View File

@ -76,7 +76,7 @@ WalletEditorImpl::SetValue(const PRUnichar* aValue, nsIDOMWindow* win)
nsresult res;
NS_WITH_SERVICE(nsIWalletService, walletservice, kWalletServiceCID, &res);
if (NS_FAILED(res)) return res;
nsAutoString walletList = aValue;
nsAutoString walletList( aValue );
res = walletservice->WALLET_PostEdit(walletList);
return res;
}

View File

@ -130,7 +130,7 @@ SignonViewerImpl::SetValue(const PRUnichar* aValue, nsIDOMWindow* win)
nsresult res;
NS_WITH_SERVICE(nsIWalletService, walletservice, kWalletServiceCID, &res);
if (NS_FAILED(res)) return res;
nsAutoString walletList = aValue;
nsAutoString walletList( aValue );
res = walletservice->SI_SignonViewerReturn(walletList);
return res;
}

View File

@ -403,7 +403,7 @@ nsWalletlibService::HaveData(nsIPrompt* dialog, const char *key, const PRUnichar
NS_IMETHODIMP
nsWalletlibService::WALLET_Encrypt (const PRUnichar *text, char **crypt) {
nsAutoString textAutoString = text;
nsAutoString textAutoString( text );
nsAutoString cryptAutoString;
PRBool rv = ::Wallet_Encrypt(textAutoString, cryptAutoString);
*crypt = cryptAutoString.ToNewCString();

View File

@ -2389,7 +2389,7 @@ SINGSIGN_Prompt
PUBLIC PRBool
SI_InSequence(const nsString& sequence, PRInt32 number)
{
nsAutoString tail = sequence;
nsAutoString tail( sequence );
nsAutoString head, temp;
PRInt32 separator;

View File

@ -362,7 +362,7 @@ InputConsumer::Init(nsFileSpec dirSpec, const char *out)
mFileName = nsCRT::strdup(out);
mFileSpec = dirSpec + mFileName;
// Create a temp download filename
nsCAutoString downloadFilename = mFileName;
nsCAutoString downloadFilename( mFileName );
downloadFilename.Append(",d");
mDownloadFileSpec = dirSpec + downloadFilename;
return NS_OK;
@ -702,7 +702,7 @@ Wallet_Confirm(PRUnichar * szMessage, nsIDOMWindow* window)
return retval;
}
const nsAutoString message = szMessage;
const nsAutoString message( szMessage );
retval = PR_FALSE; /* in case user exits dialog by clicking X */
res = dialog->Confirm(nsnull, message.GetUnicode(), &retval);
return retval;
@ -803,7 +803,7 @@ wallet_Alert(PRUnichar * szMessage, nsIDOMWindow* window)
return; // XXX should return the error
}
const nsAutoString message = szMessage;
const nsAutoString message( szMessage );
PRUnichar * title = Wallet_Localize("CaveatTitle");
res = dialog->Alert(title, message.GetUnicode());
Recycle(title);
@ -814,7 +814,7 @@ PRIVATE void
wallet_Alert(PRUnichar * szMessage, nsIPrompt* dialog)
{
nsresult res;
const nsAutoString message = szMessage;
const nsAutoString message( szMessage );
PRUnichar * title = Wallet_Localize("CaveatTitle");
res = dialog->Alert(title, message.GetUnicode());
Recycle(title);
@ -2084,7 +2084,7 @@ wallet_GetSelectIndex(
nsAutoString optionText;
optionElement->GetValue(optionValue);
optionElement->GetText(optionText);
nsAutoString valueLC = value;
nsAutoString valueLC( value );
valueLC.ToLowerCase();
optionValue.ToLowerCase();
optionText.ToLowerCase();
@ -2832,7 +2832,7 @@ WLLT_PostEdit(const nsString& walletList)
return;
}
nsAutoString tail = walletList;
nsAutoString tail( walletList );
nsAutoString head, temp;
PRInt32 separator;

View File

@ -117,7 +117,7 @@ WalletPreviewImpl::SetValue(const PRUnichar* aValue, nsIDOMWindow* win)
nsresult res;
NS_WITH_SERVICE(nsIWalletService, walletservice, kWalletServiceCID, &res);
if (NS_FAILED(res)) return res;
nsAutoString walletList = aValue;
nsAutoString walletList( aValue );
res = walletservice->WALLET_PrefillReturn(walletList);
return res;
}

View File

@ -2186,7 +2186,7 @@ nsPrefConverter::ConvertPrefsToUTF8IfNecessary()
if (NS_FAILED(rv)) return rv;
for (PRUint32 i = 0; prefsToConvert[i]; i++) {
nsCString prefnameStr = prefsToConvert[i];
nsCString prefnameStr( prefsToConvert[i] );
prefsToMigrate.AppendCString(prefnameStr);
}

View File

@ -800,7 +800,7 @@ NS_IMETHODIMP nsProfile::GetProfileDir(const PRUnichar *profileName, nsFileSpec*
tmpFileSpec.CreateDirectory();
// append profile name
tmpFileSpec += profileName;
tmpFileSpec += NS_ConvertUCS2toUTF8(profileName);
// Create New Directory. PersistentDescriptor needs an existing object.
if (!tmpFileSpec.Exists())
@ -1021,7 +1021,7 @@ nsProfile::CreateNewProfile(const PRUnichar* profileName,
dirSpec.CreateDirectory();
// append profile name
dirSpec += profileName;
dirSpec += NS_ConvertUCS2toUTF8(profileName);
// Make profile directory unique only when the user
// decides to not use an already existing profile directory
@ -1029,12 +1029,12 @@ nsProfile::CreateNewProfile(const PRUnichar* profileName,
dirSpec.MakeUnique();
}
else {
dirSpec = nativeProfileDir;
dirSpec = NS_ConvertUCS2toUTF8(nativeProfileDir);
// this prevents people from choosing there profile directory
// or another directory, and remove it when they delete the profile.
// append profile name
dirSpec += profileName;
dirSpec += NS_ConvertUCS2toUTF8(profileName);
// Make profile directory unique only when the user
// decides to not use an already existing profile directory
@ -1079,7 +1079,7 @@ nsProfile::CreateNewProfile(const PRUnichar* profileName,
// caller prefers locale subdir
nsFileSpec tmpdir;
tmpdir = defaultsDirSpec;
tmpdir += langcode;
tmpdir += NS_ConvertUCS2toUTF8(langcode);
if (tmpdir.Exists())
defaultsDirSpec = tmpdir;
@ -1458,7 +1458,7 @@ nsProfile::MigrateProfile(const PRUnichar* profileName, PRBool showProgressAsMod
return NS_ERROR_FAILURE;
newSpec->GetFileSpec(&newProfDir);
newProfDir += profileName;
newProfDir += NS_ConvertUCS2toUTF8(profileName);
newProfDir.MakeUnique();
if (newProfDir.Exists()) {
#ifdef DEBUG_profile
@ -1687,9 +1687,8 @@ nsProfile::ShowProfileWizard(void)
kAppShellServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCString profURLStr = PROFILE_WIZARD_URL;
nsCOMPtr<nsIURI> profURI;
rv = NS_NewURI(getter_AddRefs(profURI), (const char *)profURLStr);
rv = NS_NewURI(getter_AddRefs(profURI), NS_LITERAL_CSTRING(PROFILE_WIZARD_URL));
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIXULWindow> newWindow;
@ -1768,7 +1767,7 @@ nsresult nsProfile::RenameProfileDir(const PRUnichar* newProfileName)
if (NS_FAILED(rv)) return rv;
nsFileSpec renamedDirSpec = dirSpec;
renamedDirSpec.SetLeafName(newProfileName);
renamedDirSpec.SetLeafName(NS_ConvertUCS2toUTF8(newProfileName));
renamedDirSpec.MakeUnique();
// rename the directory
@ -1816,7 +1815,7 @@ NS_IMETHODIMP nsProfile::CloneProfile(const PRUnichar* newProfile)
// hash profileName (will MakeUnique do that for us?)
// don't allow special characters (like ..)
// make acceptable length (will MakeUnique do that for us?)
newProfileDir += newProfile;
newProfileDir += NS_ConvertUCS2toUTF8(newProfile);
newProfileDir.MakeUnique();
if (newProfileDir.Exists()) {

View File

@ -788,7 +788,9 @@ nsProfileAccess::FixRegEntry(PRUnichar** dirName)
PRBool haveHexBytes = PR_TRUE;
// Decode the directory name to return the ordinary string
nsInputStringStream stream(*dirName);
nsCAutoString dirNameCString; dirNameCString.AssignWithConversion(*dirName);
nsInputStringStream stream(dirNameCString);
// nsInputStringStream stream(NS_ConvertUCS2toUTF8(*dirName));
nsPersistentFileDescriptor descriptor;
char bigBuffer[MAX_PERSISTENT_DATA_SIZE + 1];