Make people that want empty strings use EmptyC?String(). Bug 232691, patch by

Daniel Kraft <d@daniel-kraft.net>, r=jst, sr=bzbarsky
This commit is contained in:
bzbarsky%mit.edu 2005-01-04 19:31:31 +00:00
parent 3e3cf2b0c3
commit 99df5c71c0
26 changed files with 46 additions and 46 deletions

View File

@ -662,7 +662,7 @@ NS_IMETHODIMP nsXULTreeitemAccessible::GetBounds(PRInt32 *x, PRInt32 *y, PRInt32
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
// This Bounds are based on Tree's coord
mTree->GetCoordsForCellItem(mRow, mColumn, NS_LITERAL_CSTRING(""), x, y, width, height);
mTree->GetCoordsForCellItem(mRow, mColumn, EmptyCString(), x, y, width, height);
// Get treechildren's BoxObject to adjust the Bounds' upper left corner
// XXXvarga consider using mTree->GetTreeBody()

View File

@ -126,7 +126,7 @@ nsNetscapeProfileMigratorBase::GetProfileDataFromRegistry(nsILocalFile* aRegistr
nsCOMPtr<nsILocalFile> dir;
#ifdef XP_MACOSX
rv = NS_NewNativeLocalFile(nsCString(), PR_TRUE, getter_AddRefs(dir));
rv = NS_NewNativeLocalFile(EmptyCString(), PR_TRUE, getter_AddRefs(dir));
if (NS_FAILED(rv)) return rv;
dir->SetPersistentDescriptor(NS_LossyConvertUCS2toASCII(directory));
#else

View File

@ -539,7 +539,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
// (since we could be writing a new image on top of an existing
// Firefox_wallpaper.png and nautilus doesn't monitor the file for changes)
gconf->SetString(NS_LITERAL_CSTRING(kDesktopImageKey),
NS_LITERAL_CSTRING(""));
EmptyCString());
gconf->SetString(NS_LITERAL_CSTRING(kDesktopImageKey), filePath);
gconf->SetBool(NS_LITERAL_CSTRING(kDesktopDrawBGKey), PR_TRUE);

View File

@ -1109,7 +1109,7 @@ SendJSWarning(nsIHTMLContent* aContent,
aWarningName,
aWarningArgs, aWarningArgsLen,
documentURI,
NS_LITERAL_STRING(""), 0, 0,
EmptyString(), 0, 0,
nsIScriptError::warningFlag,
"HTML");
}

View File

@ -223,7 +223,7 @@ nsresult TypeInState::ClearProp(nsIAtom *aProp, const nsString &aAttr)
if (IsPropCleared(aProp,aAttr)) return NS_OK;
// make a new propitem
PropItem *item = new PropItem(aProp,aAttr,nsAutoString());
PropItem *item = new PropItem(aProp,aAttr,EmptyString());
if (!item) return NS_ERROR_OUT_OF_MEMORY;
// remove it from the list of set properties, if we have a match
@ -413,7 +413,7 @@ PRBool TypeInState::IsPropCleared(nsIAtom *aProp,
{
if (FindPropInList(aProp, aAttr, nsnull, mClearedArray, outIndex))
return PR_TRUE;
if (FindPropInList(0, nsAutoString(), nsnull, mClearedArray, outIndex))
if (FindPropInList(0, EmptyString(), nsnull, mClearedArray, outIndex))
{
// special case for all props cleared
outIndex = -1;

View File

@ -619,7 +619,7 @@ Boolean CBrowserShell::ObeyCommand(PP_PowerPlant::CommandT inCommand, void* ioPa
rv = GetCurrentURL(currentURL);
ThrowIfError_(rv);
currentURL.Insert("view-source:", 0);
PostOpenURLEvent(currentURL, nsCString());
PostOpenURLEvent(currentURL, EmptyCString());
}
break;
@ -661,7 +661,7 @@ Boolean CBrowserShell::ObeyCommand(PP_PowerPlant::CommandT inCommand, void* ioPa
rv = imgURI->GetSpec(temp);
ThrowIfError_(rv);
if (inCommand == cmd_ViewImage)
PostOpenURLEvent(temp, nsCString());
PostOpenURLEvent(temp, EmptyCString());
else
UScrap::SetData(kScrapFlavorTypeText, temp.get(), temp.Length());
}
@ -676,7 +676,7 @@ Boolean CBrowserShell::ObeyCommand(PP_PowerPlant::CommandT inCommand, void* ioPa
nsCAutoString temp;
rv = uri->GetSpec(temp);
ThrowIfError_(rv);
PostOpenURLEvent(temp, nsCString());
PostOpenURLEvent(temp, EmptyCString());
}
break;

View File

@ -92,7 +92,7 @@ mozSqlResult::Init()
rv = gRDFService->GetLiteral(NS_LITERAL_STRING("null").get(), &kNullLiteral);
if (NS_FAILED(rv)) return rv;
rv = gRDFService->GetLiteral(NS_LITERAL_STRING("").get(), &kEmptyLiteral);
rv = gRDFService->GetLiteral(EmptyString().get(), &kEmptyLiteral);
if (NS_FAILED(rv)) return rv;
rv = gRDFService->GetLiteral(NS_LITERAL_STRING("true").get(), &kTrueLiteral);
if (NS_FAILED(rv)) return rv;

View File

@ -255,7 +255,7 @@ nsresult Stream::DownUpLoad(PRBool download)
ioParamBlock->SetString(2, NS_ConvertUTF8toUTF16(mRemoteBaseUrl).get());
ioParamBlock->SetString(3, mSavePassword
? mPassword.get()
: NS_LITERAL_STRING("").get());
: EmptyString().get());
// filenames
for (PRInt32 i = files->Count() - 1; i >= 0; i--)

View File

@ -81,7 +81,7 @@ nsXFormsSetValueElement::HandleAction(nsIDOMEvent* aEvent,
// XXXfixme when xpath extensions are implemented (instance())
nsCOMPtr<nsIDOMDocument> instanceDoc;
model->GetInstanceDocument(NS_LITERAL_STRING(""),
model->GetInstanceDocument(EmptyString(),
getter_AddRefs(instanceDoc));
if (!instanceDoc)
return NS_OK;

View File

@ -351,7 +351,7 @@ nsXFormsUtils::FindBindContext(nsIDOMElement *aElement,
if (parentNode == modelNode) {
// This is the outermost bind.
nsCOMPtr<nsIDOMDocument> instanceDoc;
aModel->GetInstanceDocument(NS_LITERAL_STRING(""),
aModel->GetInstanceDocument(EmptyString(),
getter_AddRefs(instanceDoc));
if (!instanceDoc)
return nsnull;
@ -471,7 +471,7 @@ nsXFormsUtils::EvaluateNodeBinding(nsIDOMElement *aElement,
return nsnull;
}
model->GetInstanceDocument(NS_LITERAL_STRING(""),
model->GetInstanceDocument(EmptyString(),
getter_AddRefs(instanceDoc));
if (!instanceDoc)

View File

@ -2738,7 +2738,7 @@ nsFontMetricsWin::FindSubstituteFont(HDC aDC, PRUint32 c)
// We are running out of resources if we reach here... Try a stock font
NS_ASSERTION(::GetMapMode(aDC) == MM_TEXT, "mapping mode needs to be MM_TEXT");
nsFontWin* font = LoadSubstituteFont(aDC, nsString());
nsFontWin* font = LoadSubstituteFont(aDC, EmptyString());
if (font) {
((nsFontWinSubstitute*)font)->SetRepresentable(c);
mSubstituteFont = font;

View File

@ -420,7 +420,7 @@ GetTreeCellCoords(nsITreeBoxObject* aTreeBox, nsIContent* aSourceNode,
PRInt32 aRow, nsITreeColumn* aCol, PRInt32* aX, PRInt32* aY)
{
PRInt32 junk;
aTreeBox->GetCoordsForCellItem(aRow, aCol, NS_LITERAL_CSTRING(""), aX, aY, &junk, &junk);
aTreeBox->GetCoordsForCellItem(aRow, aCol, EmptyCString(), aX, aY, &junk, &junk);
nsCOMPtr<nsIDOMXULElement> xulEl(do_QueryInterface(aSourceNode));
nsCOMPtr<nsIBoxObject> bx;
xulEl->GetBoxObject(getter_AddRefs(bx));

View File

@ -125,7 +125,7 @@ nsNetscapeProfileMigratorBase::GetProfileDataFromRegistry(nsILocalFile* aRegistr
nsCOMPtr<nsILocalFile> dir;
#ifdef XP_MACOSX
rv = NS_NewNativeLocalFile(nsCString(), PR_TRUE, getter_AddRefs(dir));
rv = NS_NewNativeLocalFile(EmptyCString(), PR_TRUE, getter_AddRefs(dir));
if (NS_FAILED(rv)) return rv;
dir->SetPersistentDescriptor(NS_LossyConvertUCS2toASCII(directory));
#else

View File

@ -119,7 +119,7 @@ void nsSeamonkeyProfileMigrator::CopyNextFolder()
fileTransactionEntry* fileTransaction = (fileTransactionEntry*) mFileCopyTransactions->SafeElementAt(mFileCopyTransactionIndex++);
if (fileTransaction) // copy the file
{
fileTransaction->srcFile->CopyTo(fileTransaction->destFile, nsString());
fileTransaction->srcFile->CopyTo(fileTransaction->destFile, EmptyString());
// add to our current progress
PRInt64 fileSize;

View File

@ -203,7 +203,7 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetServer(nsIMsgIncomingServer ** aIncomingServe
// other users folder urls will work. We could override this method
// for imap urls, or we could make caching of servers work and
// just set the server in the imap code for this case.
url->SetUserPass(NS_LITERAL_CSTRING(""));
url->SetUserPass(EmptyCString());
rv = accountManager->FindServerByURI(url, PR_FALSE,
aIncomingServer);
}

View File

@ -2675,7 +2675,7 @@ nsresult nsImapService::GetServerFromUrl(nsIImapUrl *aImapUrl, nsIMsgIncomingSer
rv = url->SetSpec(turl);
if (NS_FAILED(rv)) return rv;
url->SetUserPass(NS_LITERAL_CSTRING(""));
url->SetUserPass(EmptyCString());
rv = accountManager->FindServerByURI(url, PR_FALSE, aServer);
if (*aServer)
aImapUrl->SetExternalLinkUrl(PR_TRUE);

View File

@ -181,7 +181,7 @@ net_GetFileFromURLSpec(const nsACString &aURL, nsIFile **result)
nsresult rv;
nsCOMPtr<nsILocalFile> localFile;
rv = NS_NewNativeLocalFile(nsCString(), PR_TRUE, getter_AddRefs(localFile));
rv = NS_NewNativeLocalFile(EmptyCString(), PR_TRUE, getter_AddRefs(localFile));
if (NS_FAILED(rv))
return rv;

View File

@ -1471,7 +1471,7 @@ nsresult ProfileStruct::InternalizeMigratedFromLocation(nsIRegistry *aRegistry,
if (NS_SUCCEEDED(rv))
{
#if defined(XP_MAC) || defined(XP_MACOSX)
rv = NS_NewLocalFile(nsString(), PR_TRUE, getter_AddRefs(tempLocal));
rv = NS_NewLocalFile(EmptyString(), PR_TRUE, getter_AddRefs(tempLocal));
if (NS_SUCCEEDED(rv))
{
// The persistent desc on Mac is base64 encoded so plain ASCII

View File

@ -732,7 +732,7 @@ nsFormFillController::MouseClick(nsIDOMEvent* aMouseEvent)
input->GetTextValue(value);
if (value.Length() > 0) {
// Show the popup with a filtered result set
mController->SetSearchString(NS_LITERAL_STRING(""));
mController->SetSearchString(EmptyString());
mController->HandleText(PR_TRUE);
} else {
// Show the popup with the complete result set. Can't use HandleText()

View File

@ -531,7 +531,7 @@ nsAppStartup::LaunchTask(const char *aParam, PRInt32 height, PRInt32 width, PRBo
#endif
}
else {
rv = OpenWindow(chromeUrlForTask, nsString(), width, height);
rv = OpenWindow(chromeUrlForTask, EmptyString(), width, height);
}
// If we get here without an error, then a window was opened OK.

View File

@ -431,7 +431,7 @@ nsFilePicker::GetLocalFiles(const nsString& inTitle, PRBool inAllowMultiple, nsC
if (anErr == noErr)
{
nsCOMPtr<nsILocalFile> localFile;
NS_NewLocalFile(nsString(), PR_TRUE, getter_AddRefs(localFile));
NS_NewLocalFile(EmptyString(), PR_TRUE, getter_AddRefs(localFile));
nsCOMPtr<nsILocalFileMac> macLocalFile = do_QueryInterface(localFile);
if (macLocalFile && NS_SUCCEEDED(macLocalFile->InitWithFSRef(&theFSRef)))
outFiles.AppendObject(localFile);
@ -525,7 +525,7 @@ nsFilePicker::GetLocalFolder(const nsString& inTitle, nsILocalFile** outFile)
if (anErr == noErr)
{
nsCOMPtr<nsILocalFile> localFile;
NS_NewLocalFile(nsString(), PR_TRUE, getter_AddRefs(localFile));
NS_NewLocalFile(EmptyString(), PR_TRUE, getter_AddRefs(localFile));
nsCOMPtr<nsILocalFileMac> macLocalFile = do_QueryInterface(localFile);
if (macLocalFile && NS_SUCCEEDED(macLocalFile->InitWithFSRef(&theFSRef)))
{
@ -634,7 +634,7 @@ nsFilePicker::PutLocalFile(const nsString& inTitle, const nsString& inDefaultNam
if (fileURL)
{
nsCOMPtr<nsILocalFile> localFile;
NS_NewLocalFile(nsString(), PR_TRUE, getter_AddRefs(localFile));
NS_NewLocalFile(EmptyString(), PR_TRUE, getter_AddRefs(localFile));
nsCOMPtr<nsILocalFileMac> macLocalFile = do_QueryInterface(localFile);
if (macLocalFile && NS_SUCCEEDED(macLocalFile->InitWithCFURL(fileURL)))
{

View File

@ -147,8 +147,8 @@ void XXXNeverCalled()
nsPrintfCString bar("");
nsLinebreakConverter::ConvertStringLineBreaks(foo,
nsLinebreakConverter::eLinebreakAny, nsLinebreakConverter::eLinebreakContent);
NS_NewLocalFile(nsString(), PR_FALSE, nsnull);
NS_NewNativeLocalFile(nsCString(), PR_FALSE, nsnull);
NS_NewLocalFile(EmptyString(), PR_FALSE, nsnull);
NS_NewNativeLocalFile(EmptyCString(), PR_FALSE, nsnull);
new nsProcess();
nsStaticCaseInsensitiveNameTable();
nsAutoString str1;

View File

@ -1705,7 +1705,7 @@ NS_IMETHODIMP
nsLocalFile::CopyTo(nsIFile *newParentDir, const nsAString &newName)
{
if (newName.IsEmpty())
return CopyToNative(newParentDir, nsCString());
return CopyToNative(newParentDir, EmptyCString());
nsresult rv;
nsCAutoString fsStr;
@ -1724,7 +1724,7 @@ NS_IMETHODIMP
nsLocalFile::CopyToFollowingLinks(nsIFile *newParentDir, const nsAString &newName)
{
if (newName.IsEmpty())
return CopyToFollowingLinksNative(newParentDir, nsCString());
return CopyToFollowingLinksNative(newParentDir, EmptyCString());
nsresult rv;
nsCAutoString fsStr;
@ -1743,7 +1743,7 @@ NS_IMETHODIMP
nsLocalFile::MoveTo(nsIFile *newParentDir, const nsAString &newName)
{
if (newName.IsEmpty())
return MoveToNative(newParentDir, nsCString());
return MoveToNative(newParentDir, EmptyCString());
nsresult rv;
nsCAutoString fsStr;

View File

@ -732,11 +732,11 @@ nsLocalFile::CopyMove(nsIFile *aParentDir, const nsACString &newName, PRBool mov
if (move)
{
rv = file->MoveToNative(target, nsCString());
rv = file->MoveToNative(target, EmptyCString());
}
else
{
rv = file->CopyToNative(target, nsCString());
rv = file->CopyToNative(target, EmptyCString());
}
iterator->HasMoreElements(&more);
@ -1582,7 +1582,7 @@ NS_IMETHODIMP
nsLocalFile::InitWithPath(const nsAString &filePath)
{
if (filePath.IsEmpty())
return InitWithNativePath(nsCString());
return InitWithNativePath(EmptyCString());
nsCAutoString tmp;
nsresult rv = NS_CopyUnicodeToNative(filePath, tmp);
@ -1639,7 +1639,7 @@ NS_IMETHODIMP
nsLocalFile::SetLeafName(const nsAString &aLeafName)
{
if (aLeafName.IsEmpty())
return SetNativeLeafName(nsCString());
return SetNativeLeafName(EmptyCString());
nsCAutoString tmp;
nsresult rv = NS_CopyUnicodeToNative(aLeafName, tmp);
@ -1660,7 +1660,7 @@ NS_IMETHODIMP
nsLocalFile::CopyTo(nsIFile *newParentDir, const nsAString &newName)
{
if (newName.IsEmpty())
return CopyToNative(newParentDir, nsCString());
return CopyToNative(newParentDir, EmptyCString());
nsCAutoString tmp;
nsresult rv = NS_CopyUnicodeToNative(newName, tmp);
@ -1675,7 +1675,7 @@ NS_IMETHODIMP
nsLocalFile::CopyToFollowingLinks(nsIFile *newParentDir, const nsAString &newName)
{
if (newName.IsEmpty())
return CopyToFollowingLinksNative(newParentDir, nsCString());
return CopyToFollowingLinksNative(newParentDir, EmptyCString());
nsCAutoString tmp;
nsresult rv = NS_CopyUnicodeToNative(newName, tmp);
@ -1690,7 +1690,7 @@ NS_IMETHODIMP
nsLocalFile::MoveTo(nsIFile *newParentDir, const nsAString &newName)
{
if (newName.IsEmpty())
return MoveToNative(newParentDir, nsCString());
return MoveToNative(newParentDir, EmptyCString());
nsCAutoString tmp;
nsresult rv = NS_CopyUnicodeToNative(newName, tmp);

View File

@ -1250,15 +1250,15 @@ nsLocalFile::CopyMove(nsIFile *aParentDir, const nsACString &newName, PRBool fol
if (followSymlinks)
return NS_ERROR_FAILURE;
rv = file->MoveToNative(target, nsCString());
rv = file->MoveToNative(target, EmptyCString());
NS_ENSURE_SUCCESS(rv,rv);
}
else
{
if (followSymlinks)
rv = file->CopyToFollowingLinksNative(target, nsCString());
rv = file->CopyToFollowingLinksNative(target, EmptyCString());
else
rv = file->CopyToNative(target, nsCString());
rv = file->CopyToNative(target, EmptyCString());
NS_ENSURE_SUCCESS(rv,rv);
}
}
@ -2310,7 +2310,7 @@ nsresult
nsLocalFile::CopyTo(nsIFile *newParentDir, const nsAString &newName)
{
if (newName.IsEmpty())
return CopyToNative(newParentDir, nsCString());
return CopyToNative(newParentDir, EmptyCString());
nsCAutoString tmp;
nsresult rv = NS_CopyUnicodeToNative(newName, tmp);
@ -2324,7 +2324,7 @@ nsresult
nsLocalFile::CopyToFollowingLinks(nsIFile *newParentDir, const nsAString &newName)
{
if (newName.IsEmpty())
return CopyToFollowingLinksNative(newParentDir, nsCString());
return CopyToFollowingLinksNative(newParentDir, EmptyCString());
nsCAutoString tmp;
nsresult rv = NS_CopyUnicodeToNative(newName, tmp);
@ -2338,7 +2338,7 @@ nsresult
nsLocalFile::MoveTo(nsIFile *newParentDir, const nsAString &newName)
{
if (newName.IsEmpty())
return MoveToNative(newParentDir, nsCString());
return MoveToNative(newParentDir, EmptyCString());
nsCAutoString tmp;
nsresult rv = NS_CopyUnicodeToNative(newName, tmp);

View File

@ -2845,7 +2845,7 @@ InternetSearchDataSource::FindInternetSearchResults(const char *url, PRBool *sea
nsAutoString userVar, inputUnused, engineNameStr;
GetData(dataUni, "search", 0, "name", engineNameStr);
if (NS_FAILED(rv = GetInputs(dataUni, engineNameStr, userVar, nsAutoString(), inputUnused, 0, 0, 0))) return(rv);
if (NS_FAILED(rv = GetInputs(dataUni, engineNameStr, userVar, EmptyString(), inputUnused, 0, 0, 0))) return(rv);
if (userVar.IsEmpty()) return(NS_RDF_NO_VALUE);
nsAutoString queryStr;