Closed Bug 232503 Opened 21 years ago Closed 21 years ago

Start using Empty[C]String()

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jst, Assigned: jst)

Details

Attachments

(2 files)

Now that Empty[C]String() exists, we should start using it. Patch coming up.
Attachment #140140 - Flags: superreview?(peterv)
Attachment #140140 - Flags: review?(peterv)
Comment on attachment 140140 [details] [diff] [review] Use Empty[C]String() > Index: editor/libeditor/html/Makefile.in > =================================================================== > @@ -58,19 +58,18 @@ CPPSRCS = \ > nsHTMLEditRules.cpp \ > nsHTMLEditUtils.cpp \ > nsHTMLObjectResizer.cpp \ > nsHTMLEditorMouseListener.cpp \ > nsHTMLInlineTableEditor.cpp \ > nsHTMLURIRefObject.cpp \ > nsTableEditor.cpp \ > nsWSRunObject.cpp \ > TypeInState.cpp \ > - TextEditorTest.cpp \ You should move that into DEBUG (this'll break debug builds) and remove the include of TextEditorTest.h in mozilla/editor/libeditor/html/nsHTMLDataTransfer.cpp. I don't think we can move nsEditor::DebugUnitTests and nsHTMLEditor::DebugUnitTests completely inside DEBUG, they seem to be called from front-end code (mozilla/editor/ui/composer/content/EditorCommandsDebug.js). Unless you ifdef it in the IDL and test with |if (debugUnitTests in GetCurrentEditor())| in the JS? > Index: editor/libeditor/html/nsHTMLDataTransfer.cpp > =================================================================== > @@ -1101,19 +1103,19 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTr > { > stuffToPaste.Assign(NS_LITERAL_STRING("<A href=\"")); > AppendUTF8toUTF16(urltext, stuffToPaste); > stuffToPaste.Append(NS_LITERAL_STRING("\">")); > AppendUTF8toUTF16(urltext, stuffToPaste); > stuffToPaste.Append(NS_LITERAL_STRING("</A>")); > } > nsAutoEditBatch beginBatching(this); > rv = InsertHTMLWithContext(stuffToPaste, > - nsString(), nsString(), flavor, > + EmptyString(), EmptyString(), flavor, No local variable to combine these? > @@ -1603,19 +1605,19 @@ NS_IMETHODIMP nsHTMLEditor::PasteNoForma > // Get the nsITransferable interface for getting the data from the clipboard. > // use nsPlaintextEditor::PrepareTransferable() to force unicode plaintext data. > nsCOMPtr<nsITransferable> trans; > rv = nsPlaintextEditor::PrepareTransferable(getter_AddRefs(trans)); > if (NS_SUCCEEDED(rv) && trans) > { > // Get the Data from the clipboard > if (NS_SUCCEEDED(clipboard->GetData(trans, aSelectionType)) && IsModifiable()) > { > - rv = InsertFromTransferable(trans, nsnull, nsString(), nsString(), > + rv = InsertFromTransferable(trans, nsnull, EmptyString(), EmptyString(), > nsnull, 0, PR_TRUE); and here > Index: extensions/transformiix/source/xslt/txInstructions.cpp > =================================================================== > @@ -371,21 +371,21 @@ nsresult > txCopy::execute(txExecutionState& aEs) > { > nsresult rv = NS_OK; > const txXPathNode& node = aEs.getEvalContext()->getContextNode(); > > switch (txXPathNodeUtils::getNodeType(node)) { > case txXPathNodeType::DOCUMENT_NODE: > { > // "close" current element to ensure that no attributes are added > - aEs.mResultHandler->characters(NS_LITERAL_STRING(""), PR_FALSE); > + aEs.mResultHandler->characters(EmptyString(), PR_FALSE); > > - rv = aEs.pushString(NS_LITERAL_STRING("")); > + rv = aEs.pushString(EmptyString()); and here > Index: extensions/webservices/schema/src/nsSchema.cpp > =================================================================== > nsSchema::nsSchema(nsISchemaCollection* aCollection, > nsIDOMElement* aSchemaElement) > { > mCollection = aCollection; // Weak reference > > if (aSchemaElement) { > - aSchemaElement->GetAttributeNS(NS_LITERAL_STRING(""), > + aSchemaElement->GetAttributeNS(EmptyString(), > NS_LITERAL_STRING("targetNamespace"), > mTargetNamespace); > mTargetNamespace.Trim(" \r\n\t"); > aSchemaElement->GetNamespaceURI(mSchemaNamespace); > > nsAutoString elementFormDefault; > - aSchemaElement->GetAttributeNS(NS_LITERAL_STRING(""), > + aSchemaElement->GetAttributeNS(EmptyString(), and here > Index: mailnews/base/src/nsMessenger.cpp > =================================================================== > @@ -1121,20 +1121,20 @@ nsMessenger::SaveAs(const char *aURI, PR > rv = CreateStartupUrl(urlString.get(), getter_AddRefs(url)); > NS_ASSERTION(NS_SUCCEEDED(rv), "CreateStartupUrl failed"); > if (NS_FAILED(rv)) > goto done; > > saveListener->m_channel = nsnull; > rv = NS_NewInputStreamChannel(getter_AddRefs(saveListener->m_channel), > url, > nsnull, // inputStream > - NS_LITERAL_CSTRING(""), // contentType > - NS_LITERAL_CSTRING("")); // contentCharset > + EmptyCString(), // contentType > + EmptyCString()); // contentCharset and here > Index: mailnews/base/util/nsMsgDBFolder.cpp > =================================================================== > @@ -1984,19 +1984,19 @@ nsresult nsMsgDBFolder::PromptForCachePa > rv = server->GetServerURI(getter_Copies(currServerUri)); > NS_ENSURE_SUCCESS(rv, rv); > > currServerUri.Insert('x', 0); > nsCAutoString hostFound; > nsAutoString userNameFound; > nsAutoString passwordFound; > > // Get password entry corresponding to the host URI we are passing in. > - rv = passwordMgrInt->FindPasswordEntry(currServerUri, NS_LITERAL_STRING(""), NS_LITERAL_STRING(""), > + rv = passwordMgrInt->FindPasswordEntry(currServerUri, EmptyString(), EmptyString(), and here > Index: mailnews/base/util/nsMsgIncomingServer.cpp > =================================================================== > @@ -816,19 +816,19 @@ nsMsgIncomingServer::GetPasswordWithUI(c > nsXPIDLCString currServerUri; > rv = GetServerURI(getter_Copies(currServerUri)); > NS_ENSURE_SUCCESS(rv, rv); > > nsCAutoString hostFound; > nsAutoString userNameFound; > nsAutoString passwordFound; > > // Get password entry corresponding to the host URI we are passing in. > - if (NS_SUCCEEDED(passwordMgrInt->FindPasswordEntry(currServerUri, NS_LITERAL_STRING(""), NS_LITERAL_STRING(""), > + if (NS_SUCCEEDED(passwordMgrInt->FindPasswordEntry(currServerUri, EmptyString(), EmptyString(), and here > Index: netwerk/test/TestStreamChannel.cpp > =================================================================== > @@ -210,20 +210,19 @@ RunTest(nsIFile *file) > rv = NS_NewLocalFileInputStream(getter_AddRefs(stream), file); > if (NS_FAILED(rv)) return rv; > > nsCOMPtr<nsIURI> uri = do_CreateInstance(kSimpleURICID); > if (uri) > uri->SetSpec(NS_LITERAL_CSTRING("foo://bar")); > > nsCOMPtr<nsIChannel> chan; > rv = NS_NewInputStreamChannel(getter_AddRefs(chan), uri, stream, > - NS_LITERAL_CSTRING(""), > - NS_LITERAL_CSTRING("")); > + EmptyCString(), EmptyCString()); and here > Index: rdf/chrome/src/nsChromeRegistry.cpp > =================================================================== > @@ -2842,20 +2842,20 @@ nsChromeRegistry::GetProfileRoot(nsACStr > if (NS_FAILED(rv)) > return(rv); > defaultUserContentFile->AppendNative(NS_LITERAL_CSTRING("chrome")); > defaultUserContentFile->AppendNative(NS_LITERAL_CSTRING("userContent-example.css")); > defaultUserChromeFile->AppendNative(NS_LITERAL_CSTRING("chrome")); > defaultUserChromeFile->AppendNative(NS_LITERAL_CSTRING("userChrome-example.css")); > > // copy along > // It aint an error if these files dont exist > - (void) defaultUserContentFile->CopyToNative(userChromeDir, NS_LITERAL_CSTRING("")); > - (void) defaultUserChromeFile->CopyToNative(userChromeDir, NS_LITERAL_CSTRING("")); > + defaultUserContentFile->CopyToNative(userChromeDir, EmptyCString()); > + defaultUserChromeFile->CopyToNative(userChromeDir, EmptyCString()); and here.
Attachment #140140 - Flags: superreview?(peterv)
Attachment #140140 - Flags: superreview+
Attachment #140140 - Flags: review?(peterv)
Attachment #140140 - Flags: review+
Fixed all of that and checked in.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
my debug build broke after this checkin - this patch was required to get it building again...
Duh, sorry about that. Should've checked. Thanks for fixing the bustage!
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: