From f4edb65ad40be3fb31815ef3c9af224eadbcd124 Mon Sep 17 00:00:00 2001 From: "disttsc%bart.nl" Date: Tue, 27 Mar 2001 11:17:17 +0000 Subject: [PATCH] bug 73339: Remove NS_ConvertToString (just another name for NS_ConvertASCIItoUCS2) from the tree. r=jst, sr=scc --- content/base/src/nsDocumentViewer.cpp | 2 +- content/base/src/nsNameSpaceManager.cpp | 10 +-- content/build/nsContentModule.cpp | 4 +- dom/public/nsIScriptNameSpaceManager.h | 6 +- dom/src/base/nsScriptNameSpaceManager.cpp | 22 +++---- dom/src/base/nsScriptNameSpaceManager.h | 6 +- dom/src/build/nsScriptNameSpaceManager.cpp | 22 +++---- dom/src/build/nsScriptNameSpaceManager.h | 6 +- gfx/src/mac/nsUnicodeMappingUtil.cpp | 65 +++++++++---------- htmlparser/src/CNavDTD.cpp | 6 +- htmlparser/src/COtherDTD.cpp | 6 +- htmlparser/src/CRtfDTD.cpp | 2 +- htmlparser/src/nsExpatDTD.cpp | 2 +- htmlparser/src/nsHTMLContentSinkStream.cpp | 2 +- htmlparser/src/nsHTMLEntities.cpp | 2 +- htmlparser/src/nsHTMLTokens.cpp | 8 +-- htmlparser/src/nsParser.cpp | 2 +- htmlparser/src/nsViewSourceHTML.cpp | 6 +- htmlparser/src/nsWellFormedDTD.cpp | 2 +- intl/locale/src/nsLocaleService.cpp | 3 +- layout/base/nsDocumentViewer.cpp | 2 +- layout/build/nsLayoutModule.cpp | 4 +- layout/generic/nsGfxScrollFrame.cpp | 10 +-- layout/html/base/src/nsGfxScrollFrame.cpp | 10 +-- .../html/forms/src/nsGfxTextControlFrame2.cpp | 4 +- mailnews/base/util/nsMsgIncomingServer.cpp | 2 +- mailnews/compose/src/nsSmtpServer.cpp | 4 +- parser/htmlparser/src/CNavDTD.cpp | 6 +- parser/htmlparser/src/COtherDTD.cpp | 6 +- parser/htmlparser/src/CRtfDTD.cpp | 2 +- parser/htmlparser/src/nsExpatDTD.cpp | 2 +- .../src/nsHTMLContentSinkStream.cpp | 2 +- parser/htmlparser/src/nsHTMLEntities.cpp | 2 +- parser/htmlparser/src/nsHTMLTokens.cpp | 8 +-- parser/htmlparser/src/nsParser.cpp | 2 +- parser/htmlparser/src/nsViewSourceHTML.cpp | 6 +- parser/htmlparser/src/nsWellFormedDTD.cpp | 2 +- string/obsolete/nsString2.h | 23 ------- xpcom/string/obsolete/nsString2.h | 23 ------- 39 files changed, 127 insertions(+), 177 deletions(-) diff --git a/content/base/src/nsDocumentViewer.cpp b/content/base/src/nsDocumentViewer.cpp index a0414c6b2c94..5bcaca0ffdf7 100644 --- a/content/base/src/nsDocumentViewer.cpp +++ b/content/base/src/nsDocumentViewer.cpp @@ -2899,7 +2899,7 @@ NS_IMETHODIMP nsDocViwerSelectionListener::NotifySelectionChanged(nsIDOMDocument nsCOMPtr domWindow = do_QueryInterface(scriptGlobalObject); if (!domWindow) return NS_ERROR_FAILURE; - domWindow->UpdateCommands(NS_ConvertToString("select")); + domWindow->UpdateCommands(NS_LITERAL_STRING("select")); mGotSelectionState = PR_TRUE; mSelectionWasCollapsed = selectionCollapsed; } diff --git a/content/base/src/nsNameSpaceManager.cpp b/content/base/src/nsNameSpaceManager.cpp index 9f1838615324..45d1cc24e1a5 100644 --- a/content/base/src/nsNameSpaceManager.cpp +++ b/content/base/src/nsNameSpaceManager.cpp @@ -52,11 +52,11 @@ static void AddRefTable() gURIToIDTable = new nsHashtable(); gURIArray = new nsVoidArray(); - nsString* xmlns = new nsString( NS_ConvertToString(kXMLNSNameSpaceURI) ); - nsString* xml = new nsString( NS_ConvertToString(kXMLNameSpaceURI) ); - nsString* xhtml = new nsString( NS_ConvertToString(kXHTMLNameSpaceURI) ); - nsString* xlink = new nsString( NS_ConvertToString(kXLinkNameSpaceURI) ); - nsString* html = new nsString( NS_ConvertToString(kHTMLNameSpaceURI) ); + nsString* xmlns = new nsString( NS_ConvertASCIItoUCS2(kXMLNSNameSpaceURI) ); + nsString* xml = new nsString( NS_ConvertASCIItoUCS2(kXMLNameSpaceURI) ); + nsString* xhtml = new nsString( NS_ConvertASCIItoUCS2(kXHTMLNameSpaceURI) ); + nsString* xlink = new nsString( NS_ConvertASCIItoUCS2(kXLinkNameSpaceURI) ); + nsString* html = new nsString( NS_ConvertASCIItoUCS2(kHTMLNameSpaceURI) ); gURIArray->AppendElement(xmlns); // ordering here needs to match IDs gURIArray->AppendElement(xml); gURIArray->AppendElement(xhtml); diff --git a/content/build/nsContentModule.cpp b/content/build/nsContentModule.cpp index 206d1b3cb5b4..231878a64699 100644 --- a/content/build/nsContentModule.cpp +++ b/content/build/nsContentModule.cpp @@ -135,7 +135,7 @@ ContentScriptNameSet::AddNameSet(nsIScriptContext* aScriptContext) result = aScriptContext->GetNameSpaceManager(&manager); if (NS_OK == result) { - result = manager->RegisterGlobalName(NS_ConvertToString("HTMLImageElement"), + result = manager->RegisterGlobalName(NS_LITERAL_STRING("HTMLImageElement"), NS_GET_IID(nsIScriptObjectOwner), kHTMLImageElementCID, PR_TRUE); @@ -144,7 +144,7 @@ ContentScriptNameSet::AddNameSet(nsIScriptContext* aScriptContext) return result; } - result = manager->RegisterGlobalName(NS_ConvertToString("HTMLOptionElement"), + result = manager->RegisterGlobalName(NS_LITERAL_STRING("HTMLOptionElement"), NS_GET_IID(nsIScriptObjectOwner), kHTMLOptionElementCID, PR_TRUE); diff --git a/dom/public/nsIScriptNameSpaceManager.h b/dom/public/nsIScriptNameSpaceManager.h index 1c1a82e5e2ef..fcdc03a42fd4 100644 --- a/dom/public/nsIScriptNameSpaceManager.h +++ b/dom/public/nsIScriptNameSpaceManager.h @@ -54,7 +54,7 @@ public: * a constructor. PR_FALSE if it is a global object. * @result NS_OK if successful */ - NS_IMETHOD RegisterGlobalName(const nsString& aName, + NS_IMETHOD RegisterGlobalName(const nsAReadableString& aName, const nsIID& aIID, const nsIID& aCID, PRBool aIsConstructor) = 0; @@ -65,7 +65,7 @@ public: * @param aName the name to remove * @result NS_OK if successful */ - NS_IMETHOD UnregisterGlobalName(const nsString& aName) = 0; + NS_IMETHOD UnregisterGlobalName(const nsAReadableString& aName) = 0; /** * Used to look up the manager using a name as a key. The @@ -83,7 +83,7 @@ public: * @result NS_OK if the lookup succeeded. NS_ERROR_INVALID_ARG * if the lookup failed. */ - NS_IMETHOD LookupName(const nsString& aName, + NS_IMETHOD LookupName(const nsAReadableString& aName, PRBool& aIsConstructor, nsIID& aIID, nsIID& aCID) = 0; diff --git a/dom/src/base/nsScriptNameSpaceManager.cpp b/dom/src/base/nsScriptNameSpaceManager.cpp index 0fe5031080b9..9f70b0fa3888 100644 --- a/dom/src/base/nsScriptNameSpaceManager.cpp +++ b/dom/src/base/nsScriptNameSpaceManager.cpp @@ -22,6 +22,7 @@ #include "nsScriptNameSpaceManager.h" #include "prmem.h" +#include "nsReadableUtils.h" typedef struct { nsIID mIID; @@ -56,12 +57,10 @@ nsScriptNameSpaceManager::~nsScriptNameSpaceManager() } } -static NS_DEFINE_IID(kIScriptNameSpaceManagerIID, NS_ISCRIPTNAMESPACEMANAGER_IID); - -NS_IMPL_ISUPPORTS(nsScriptNameSpaceManager, kIScriptNameSpaceManagerIID); +NS_IMPL_ISUPPORTS1(nsScriptNameSpaceManager, nsIScriptNameSpaceManager); NS_IMETHODIMP -nsScriptNameSpaceManager::RegisterGlobalName(const nsString& aName, +nsScriptNameSpaceManager::RegisterGlobalName(const nsAReadableString& aName, const nsIID& aIID, const nsIID& aCID, PRBool aIsConstructor) @@ -71,7 +70,6 @@ nsScriptNameSpaceManager::RegisterGlobalName(const nsString& aName, PL_CompareValues, nsnull, nsnull); } - char* name = aName.ToNewCString(); nsGlobalNameStruct* gn = (nsGlobalNameStruct*)PR_NEW(nsGlobalNameStruct); if (nsnull == gn) { return NS_ERROR_OUT_OF_MEMORY; @@ -80,16 +78,17 @@ nsScriptNameSpaceManager::RegisterGlobalName(const nsString& aName, gn->mCID = aCID; gn->mIsConstructor = aIsConstructor; + char* name = ToNewCString(aName); PL_HashTableAdd(mGlobalNames, name, (void *)gn); return NS_OK; } NS_IMETHODIMP -nsScriptNameSpaceManager::UnregisterGlobalName(const nsString& aName) +nsScriptNameSpaceManager::UnregisterGlobalName(const nsAReadableString& aName) { if (nsnull != mGlobalNames) { - char* name = aName.ToNewCString(); + char* name = ToNewCString(aName); PLHashNumber hn = PL_HashString(name); PLHashEntry** hep = PL_HashTableRawLookup(mGlobalNames, hn, @@ -98,7 +97,7 @@ nsScriptNameSpaceManager::UnregisterGlobalName(const nsString& aName) if (nsnull != entry) { nsGlobalNameStruct* gn = (nsGlobalNameStruct*)entry->value; - char* hname = (char*)entry->key;; + char* hname = (char*)entry->key; delete gn; PL_HashTableRemove(mGlobalNames, name); @@ -112,13 +111,13 @@ nsScriptNameSpaceManager::UnregisterGlobalName(const nsString& aName) } NS_IMETHODIMP -nsScriptNameSpaceManager::LookupName(const nsString& aName, +nsScriptNameSpaceManager::LookupName(const nsAReadableString& aName, PRBool& aIsConstructor, nsIID& aIID, nsIID& aCID) { if (nsnull != mGlobalNames) { - char* name = aName.ToNewCString(); + char* name = ToNewCString(aName); nsGlobalNameStruct* gn = (nsGlobalNameStruct*)PL_HashTableLookup(mGlobalNames, name); nsCRT::free(name); @@ -148,7 +147,6 @@ NS_NewScriptNameSpaceManager(nsIScriptNameSpaceManager** aInstancePtr) return NS_ERROR_OUT_OF_MEMORY; } - return manager->QueryInterface(kIScriptNameSpaceManagerIID, (void **)aInstancePtr); - + return manager->QueryInterface(NS_GET_IID(nsIScriptNameSpaceManager), (void **)aInstancePtr); } diff --git a/dom/src/base/nsScriptNameSpaceManager.h b/dom/src/base/nsScriptNameSpaceManager.h index f789c32c3dc2..c184deb0ae8b 100644 --- a/dom/src/base/nsScriptNameSpaceManager.h +++ b/dom/src/base/nsScriptNameSpaceManager.h @@ -46,12 +46,12 @@ class nsScriptNameSpaceManager : public nsIScriptNameSpaceManager { NS_DECL_ISUPPORTS - NS_IMETHOD RegisterGlobalName(const nsString& aName, + NS_IMETHOD RegisterGlobalName(const nsAReadableString& aName, const nsIID& aIID, const nsIID& aCID, PRBool aIsConstructor); - NS_IMETHOD UnregisterGlobalName(const nsString& aName); - NS_IMETHOD LookupName(const nsString& aName, + NS_IMETHOD UnregisterGlobalName(const nsAReadableString& aName); + NS_IMETHOD LookupName(const nsAReadableString& aName, PRBool& aIsConstructor, nsIID& aIID, nsIID& aCID); diff --git a/dom/src/build/nsScriptNameSpaceManager.cpp b/dom/src/build/nsScriptNameSpaceManager.cpp index 0fe5031080b9..9f70b0fa3888 100644 --- a/dom/src/build/nsScriptNameSpaceManager.cpp +++ b/dom/src/build/nsScriptNameSpaceManager.cpp @@ -22,6 +22,7 @@ #include "nsScriptNameSpaceManager.h" #include "prmem.h" +#include "nsReadableUtils.h" typedef struct { nsIID mIID; @@ -56,12 +57,10 @@ nsScriptNameSpaceManager::~nsScriptNameSpaceManager() } } -static NS_DEFINE_IID(kIScriptNameSpaceManagerIID, NS_ISCRIPTNAMESPACEMANAGER_IID); - -NS_IMPL_ISUPPORTS(nsScriptNameSpaceManager, kIScriptNameSpaceManagerIID); +NS_IMPL_ISUPPORTS1(nsScriptNameSpaceManager, nsIScriptNameSpaceManager); NS_IMETHODIMP -nsScriptNameSpaceManager::RegisterGlobalName(const nsString& aName, +nsScriptNameSpaceManager::RegisterGlobalName(const nsAReadableString& aName, const nsIID& aIID, const nsIID& aCID, PRBool aIsConstructor) @@ -71,7 +70,6 @@ nsScriptNameSpaceManager::RegisterGlobalName(const nsString& aName, PL_CompareValues, nsnull, nsnull); } - char* name = aName.ToNewCString(); nsGlobalNameStruct* gn = (nsGlobalNameStruct*)PR_NEW(nsGlobalNameStruct); if (nsnull == gn) { return NS_ERROR_OUT_OF_MEMORY; @@ -80,16 +78,17 @@ nsScriptNameSpaceManager::RegisterGlobalName(const nsString& aName, gn->mCID = aCID; gn->mIsConstructor = aIsConstructor; + char* name = ToNewCString(aName); PL_HashTableAdd(mGlobalNames, name, (void *)gn); return NS_OK; } NS_IMETHODIMP -nsScriptNameSpaceManager::UnregisterGlobalName(const nsString& aName) +nsScriptNameSpaceManager::UnregisterGlobalName(const nsAReadableString& aName) { if (nsnull != mGlobalNames) { - char* name = aName.ToNewCString(); + char* name = ToNewCString(aName); PLHashNumber hn = PL_HashString(name); PLHashEntry** hep = PL_HashTableRawLookup(mGlobalNames, hn, @@ -98,7 +97,7 @@ nsScriptNameSpaceManager::UnregisterGlobalName(const nsString& aName) if (nsnull != entry) { nsGlobalNameStruct* gn = (nsGlobalNameStruct*)entry->value; - char* hname = (char*)entry->key;; + char* hname = (char*)entry->key; delete gn; PL_HashTableRemove(mGlobalNames, name); @@ -112,13 +111,13 @@ nsScriptNameSpaceManager::UnregisterGlobalName(const nsString& aName) } NS_IMETHODIMP -nsScriptNameSpaceManager::LookupName(const nsString& aName, +nsScriptNameSpaceManager::LookupName(const nsAReadableString& aName, PRBool& aIsConstructor, nsIID& aIID, nsIID& aCID) { if (nsnull != mGlobalNames) { - char* name = aName.ToNewCString(); + char* name = ToNewCString(aName); nsGlobalNameStruct* gn = (nsGlobalNameStruct*)PL_HashTableLookup(mGlobalNames, name); nsCRT::free(name); @@ -148,7 +147,6 @@ NS_NewScriptNameSpaceManager(nsIScriptNameSpaceManager** aInstancePtr) return NS_ERROR_OUT_OF_MEMORY; } - return manager->QueryInterface(kIScriptNameSpaceManagerIID, (void **)aInstancePtr); - + return manager->QueryInterface(NS_GET_IID(nsIScriptNameSpaceManager), (void **)aInstancePtr); } diff --git a/dom/src/build/nsScriptNameSpaceManager.h b/dom/src/build/nsScriptNameSpaceManager.h index f789c32c3dc2..c184deb0ae8b 100644 --- a/dom/src/build/nsScriptNameSpaceManager.h +++ b/dom/src/build/nsScriptNameSpaceManager.h @@ -46,12 +46,12 @@ class nsScriptNameSpaceManager : public nsIScriptNameSpaceManager { NS_DECL_ISUPPORTS - NS_IMETHOD RegisterGlobalName(const nsString& aName, + NS_IMETHOD RegisterGlobalName(const nsAReadableString& aName, const nsIID& aIID, const nsIID& aCID, PRBool aIsConstructor); - NS_IMETHOD UnregisterGlobalName(const nsString& aName); - NS_IMETHOD LookupName(const nsString& aName, + NS_IMETHOD UnregisterGlobalName(const nsAReadableString& aName); + NS_IMETHOD LookupName(const nsAReadableString& aName, PRBool& aIsConstructor, nsIID& aIID, nsIID& aCID); diff --git a/gfx/src/mac/nsUnicodeMappingUtil.cpp b/gfx/src/mac/nsUnicodeMappingUtil.cpp index 139671f6c9ae..865a11205d70 100644 --- a/gfx/src/mac/nsUnicodeMappingUtil.cpp +++ b/gfx/src/mac/nsUnicodeMappingUtil.cpp @@ -115,11 +115,11 @@ void nsUnicodeMappingUtil::InitGenericFontMapping() // We probabaly should put the following info into resource .... // smRoman - mGenericFontMapping[smRoman][kSerif] = new nsAutoString( NS_ConvertToString("Times") ); - mGenericFontMapping[smRoman][kSansSerif] = new nsAutoString( NS_ConvertToString("Helvetica") ); // note: MRJ use Geneva for Sans-Serif - mGenericFontMapping[smRoman][kMonospace] = new nsAutoString( NS_ConvertToString("Courier") ); - mGenericFontMapping[smRoman][kCursive] = new nsAutoString( NS_ConvertToString("Zapf Chancery") ); - mGenericFontMapping[smRoman][kFantasy] = new nsAutoString( NS_ConvertToString("New Century Schlbk") ); + mGenericFontMapping[smRoman][kSerif] = new nsAutoString( NS_LITERAL_STRING("Times") ); + mGenericFontMapping[smRoman][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Helvetica") ); // note: MRJ use Geneva for Sans-Serif + mGenericFontMapping[smRoman][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Courier") ); + mGenericFontMapping[smRoman][kCursive] = new nsAutoString( NS_LITERAL_STRING("Zapf Chancery") ); + mGenericFontMapping[smRoman][kFantasy] = new nsAutoString( NS_LITERAL_STRING("New Century Schlbk") ); // smJapanese static PRUnichar jfontname1[] = { @@ -137,14 +137,14 @@ void nsUnicodeMappingUtil::InitGenericFontMapping() mGenericFontMapping[smJapanese][kMonospace] = new nsAutoString(jfontname3); // smTradChinese - mGenericFontMapping[smTradChinese][kSerif] = new nsAutoString( NS_ConvertToString("Apple LiSung Light") ); - mGenericFontMapping[smTradChinese][kSansSerif] = new nsAutoString( NS_ConvertToString("Apple LiGothic Medium") ); - mGenericFontMapping[smTradChinese][kMonospace] = new nsAutoString( NS_ConvertToString("Apple LiGothic Medium") ); + mGenericFontMapping[smTradChinese][kSerif] = new nsAutoString( NS_LITERAL_STRING("Apple LiSung Light") ); + mGenericFontMapping[smTradChinese][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Apple LiGothic Medium") ); + mGenericFontMapping[smTradChinese][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Apple LiGothic Medium") ); // smKorean - mGenericFontMapping[smKorean][kSerif] = new nsAutoString( NS_ConvertToString("AppleMyungjo") ); - mGenericFontMapping[smKorean][kSansSerif] = new nsAutoString( NS_ConvertToString("AppleGothic") ); - mGenericFontMapping[smKorean][kMonospace] = new nsAutoString( NS_ConvertToString("AppleGothic") ); + mGenericFontMapping[smKorean][kSerif] = new nsAutoString( NS_LITERAL_STRING("AppleMyungjo") ); + mGenericFontMapping[smKorean][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("AppleGothic") ); + mGenericFontMapping[smKorean][kMonospace] = new nsAutoString( NS_LITERAL_STRING("AppleGothic") ); // smArabic static PRUnichar afontname1[] = { @@ -173,40 +173,39 @@ void nsUnicodeMappingUtil::InitGenericFontMapping() mGenericFontMapping[smHebrew][kMonospace] = new nsAutoString(hfontname2); // smCyrillic - mGenericFontMapping[smCyrillic][kSerif] = new nsAutoString( NS_ConvertToString("Latinski") ); - mGenericFontMapping[smCyrillic][kSansSerif] = new nsAutoString( NS_ConvertToString("Pryamoy Prop") ); - mGenericFontMapping[smCyrillic][kMonospace] = new nsAutoString( NS_ConvertToString("APC Courier") ); + mGenericFontMapping[smCyrillic][kSerif] = new nsAutoString( NS_LITERAL_STRING("Latinski") ); + mGenericFontMapping[smCyrillic][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Pryamoy Prop") ); + mGenericFontMapping[smCyrillic][kMonospace] = new nsAutoString( NS_LITERAL_STRING("APC Courier") ); // smDevanagari - mGenericFontMapping[smDevanagari][kSerif] = new nsAutoString( NS_ConvertToString("Devanagari MT") ); - mGenericFontMapping[smDevanagari][kSansSerif] = new nsAutoString( NS_ConvertToString("Devanagari MT") ); - mGenericFontMapping[smDevanagari][kMonospace] = new nsAutoString( NS_ConvertToString("Devanagari MT") ); + mGenericFontMapping[smDevanagari][kSerif] = new nsAutoString( NS_LITERAL_STRING("Devanagari MT") ); + mGenericFontMapping[smDevanagari][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Devanagari MT") ); + mGenericFontMapping[smDevanagari][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Devanagari MT") ); // smGurmukhi - static nsAutoString gurukhiMT_str( NS_ConvertToString("Gurmukhi MT") ); - mGenericFontMapping[smGurmukhi][kSerif] = new nsAutoString( NS_ConvertToString("Gurmukhi MT") ); - mGenericFontMapping[smGurmukhi][kSansSerif] = new nsAutoString( NS_ConvertToString("Gurmukhi MT") ); - mGenericFontMapping[smGurmukhi][kMonospace] = new nsAutoString( NS_ConvertToString("Gurmukhi MT") ); + mGenericFontMapping[smGurmukhi][kSerif] = new nsAutoString( NS_LITERAL_STRING("Gurmukhi MT") ); + mGenericFontMapping[smGurmukhi][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Gurmukhi MT") ); + mGenericFontMapping[smGurmukhi][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Gurmukhi MT") ); // smGujarati - mGenericFontMapping[smGujarati][kSerif] = new nsAutoString( NS_ConvertToString("Gujarati MT") ); - mGenericFontMapping[smGujarati][kSansSerif] = new nsAutoString( NS_ConvertToString("Gujarati MT") ); - mGenericFontMapping[smGujarati][kMonospace] = new nsAutoString( NS_ConvertToString("Gujarati MT") ); + mGenericFontMapping[smGujarati][kSerif] = new nsAutoString( NS_LITERAL_STRING("Gujarati MT") ); + mGenericFontMapping[smGujarati][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Gujarati MT") ); + mGenericFontMapping[smGujarati][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Gujarati MT") ); // smThai - mGenericFontMapping[smThai][kSerif] = new nsAutoString( NS_ConvertToString("Thonburi") ); - mGenericFontMapping[smThai][kSansSerif] = new nsAutoString( NS_ConvertToString("Krungthep") ); - mGenericFontMapping[smThai][kMonospace] = new nsAutoString( NS_ConvertToString("Ayuthaya") ); + mGenericFontMapping[smThai][kSerif] = new nsAutoString( NS_LITERAL_STRING("Thonburi") ); + mGenericFontMapping[smThai][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Krungthep") ); + mGenericFontMapping[smThai][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Ayuthaya") ); // smSimpChinese - mGenericFontMapping[smSimpChinese][kSerif] = new nsAutoString( NS_ConvertToString("Song") ); - mGenericFontMapping[smSimpChinese][kSansSerif] = new nsAutoString( NS_ConvertToString("Hei") ); - mGenericFontMapping[smSimpChinese][kMonospace] = new nsAutoString( NS_ConvertToString("Hei") ); + mGenericFontMapping[smSimpChinese][kSerif] = new nsAutoString( NS_LITERAL_STRING("Song") ); + mGenericFontMapping[smSimpChinese][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Hei") ); + mGenericFontMapping[smSimpChinese][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Hei") ); // smCentralEuroRoman - mGenericFontMapping[smCentralEuroRoman][kSerif] = new nsAutoString( NS_ConvertToString("Times CE") ); - mGenericFontMapping[smCentralEuroRoman][kSansSerif] = new nsAutoString( NS_ConvertToString("Helvetica CE") ); - mGenericFontMapping[smCentralEuroRoman][kMonospace] = new nsAutoString( NS_ConvertToString("Courier CE") ); + mGenericFontMapping[smCentralEuroRoman][kSerif] = new nsAutoString( NS_LITERAL_STRING("Times CE") ); + mGenericFontMapping[smCentralEuroRoman][kSansSerif] = new nsAutoString( NS_LITERAL_STRING("Helvetica CE") ); + mGenericFontMapping[smCentralEuroRoman][kMonospace] = new nsAutoString( NS_LITERAL_STRING("Courier CE") ); } //-------------------------------------------------------------------------- diff --git a/htmlparser/src/CNavDTD.cpp b/htmlparser/src/CNavDTD.cpp index 0ef7f919f7dc..d2714b1b74c1 100644 --- a/htmlparser/src/CNavDTD.cpp +++ b/htmlparser/src/CNavDTD.cpp @@ -494,7 +494,7 @@ nsresult CNavDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsIToke } } //if the content model is empty, then begin by opening ... - theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_ConvertToString("html"))); + theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_LITERAL_STRING("html"))); if(theToken) { mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack. } @@ -547,7 +547,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse mSkipTarget=eHTMLTag_unknown; //clear this in case we were searching earlier. - CStartToken *theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"))); + CStartToken *theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_LITERAL_STRING("body"))); mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack, don't recycle it result=BuildModel(aParser,mTokenizer,0,aSink); } @@ -788,7 +788,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){ //However, in quirks mode, a few tags request, ambiguosly, for a BODY. - Bugs 18928, 24204.- mMisplacedContent.Push(aToken); if(mDTDMode==eDTDMode_quirks && (gHTMLElements[theTag].HasSpecialProperty(kRequiresBody))) { - CToken* theBodyToken=NS_STATIC_CAST(CToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"))); + CToken* theBodyToken=NS_STATIC_CAST(CToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_LITERAL_STRING("body"))); result=HandleToken(theBodyToken,aParser); } return result; diff --git a/htmlparser/src/COtherDTD.cpp b/htmlparser/src/COtherDTD.cpp index fde2d7d4b3df..3127f6f9b1e8 100644 --- a/htmlparser/src/COtherDTD.cpp +++ b/htmlparser/src/COtherDTD.cpp @@ -317,7 +317,7 @@ eAutoDetectResult COtherDTD::CanParse(CParserContext& aParserContext,nsString& a if(BufferContainsHTML(aBuffer,theBufHasXML)){ result = eValidDetect ; if(0==aParserContext.mMimeType.Length()) { - aParserContext.SetMimeType(NS_ConvertToString(kHTMLTextContentType)); + aParserContext.SetMimeType(NS_ConvertASCIItoUCS2(kHTMLTextContentType)); if(!theBufHasXML) { switch(aParserContext.mDTDMode) { case eDTDMode_strict: @@ -417,7 +417,7 @@ nsresult COtherDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITo if(!mBodyContext->GetCount()) { //if the content model is empty, then begin by opening ... - CStartToken *theToken=(CStartToken*)mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_ConvertToString("html")); + CStartToken *theToken=(CStartToken*)mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_LITERAL_STRING("html")); HandleStartToken(theToken); //this token should get pushed on the context stack, don't recycle it. } @@ -668,7 +668,7 @@ nsresult COtherDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsIParserNo CObserverService* theService=mParser->GetObserverService(); if(theService) { const nsISupportsParserBundle* bundle=mParser->GetParserBundle(); - result=theService->Notify(aTag,aNode,(void*)bundle, NS_ConvertToString(kHTMLTextContentType), mParser); + result=theService->Notify(aTag,aNode,(void*)bundle, NS_ConvertASCIItoUCS2(kHTMLTextContentType), mParser); } } diff --git a/htmlparser/src/CRtfDTD.cpp b/htmlparser/src/CRtfDTD.cpp index b51624008242..0b12cf5cc7b3 100644 --- a/htmlparser/src/CRtfDTD.cpp +++ b/htmlparser/src/CRtfDTD.cpp @@ -757,7 +757,7 @@ nsresult CRtfDTD::HandleControlWord(CToken* aToken){ break; case eRTFCtrl_tab: { - CTextToken theToken2( NS_ConvertToString(" ") ); + CTextToken theToken2( NS_LITERAL_STRING(" ") ); result=HandleContent(&theToken2); } break; diff --git a/htmlparser/src/nsExpatDTD.cpp b/htmlparser/src/nsExpatDTD.cpp index 41cacd4c02d7..c52be44278ed 100644 --- a/htmlparser/src/nsExpatDTD.cpp +++ b/htmlparser/src/nsExpatDTD.cpp @@ -180,7 +180,7 @@ eAutoDetectResult nsExpatDTD::CanParse(CParserContext& aParserContext,nsString& else { if(-1 origin, start, end; @@ -897,7 +897,7 @@ PRInt32 CMarkupDeclToken::GetTokenType(void) { * @return error result */ nsresult CMarkupDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) { - static nsString theTerminals = NS_ConvertToString("\n\r'\">",5); + static nsString theTerminals = NS_LITERAL_STRING("\n\r'\">"); nsresult result=NS_OK; PRBool done=PR_FALSE; PRUnichar quote=0; @@ -1521,7 +1521,7 @@ nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScann */ static nsresult ConsumeAttributeValueText(PRUnichar,nsString& aString,nsScanner& aScanner){ - static nsString theTerminals = NS_ConvertToString("\b\t\n\r >",6); + static nsString theTerminals = NS_LITERAL_STRING("\b\t\n\r >"); nsresult result=aScanner.ReadUntil(aString,theTerminals,PR_FALSE); //Let's force quotes if either the first or last char is quoted. @@ -1570,7 +1570,7 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 a } else { //If you're here, handle an unquoted key. - static nsAutoString theTerminals = NS_ConvertToString("\b\t\n\r \"=>",8); + static nsAutoString theTerminals = NS_LITERAL_STRING("\b\t\n\r \"=>"); result=aScanner.ReadUntil(start,end,theTerminals,PR_FALSE); } if (!aRetainWhitespace) { diff --git a/htmlparser/src/nsParser.cpp b/htmlparser/src/nsParser.cpp index dc5c5e27ab35..e26ab23fa429 100644 --- a/htmlparser/src/nsParser.cpp +++ b/htmlparser/src/nsParser.cpp @@ -2121,7 +2121,7 @@ nsresult nsParser::OnStartRequest(nsIRequest *request, nsISupports* aContext) { rv = channel->GetContentType(&contentType); if (NS_SUCCEEDED(rv)) { - mParserContext->SetMimeType( NS_ConvertToString(contentType) ); + mParserContext->SetMimeType( NS_ConvertASCIItoUCS2(contentType) ); nsCRT::free(contentType); } else diff --git a/htmlparser/src/nsViewSourceHTML.cpp b/htmlparser/src/nsViewSourceHTML.cpp index 20e66cf94608..df232dfc8c40 100644 --- a/htmlparser/src/nsViewSourceHTML.cpp +++ b/htmlparser/src/nsViewSourceHTML.cpp @@ -516,10 +516,10 @@ NS_IMETHODIMP CViewSourceHTML::BuildModel(nsIParser* aParser,nsITokenizer* aToke nsTokenAllocator* theAllocator=mTokenizer->GetTokenAllocator(); if(theAllocator) { #ifdef VIEW_SOURCE_HTML - theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertToString(kPreStyle)); + theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertASCIItoUCS2(kPreStyle)); theAttr->SetKey(NS_LITERAL_STRING("style")); #else - theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertToString("http://www.mozilla.org/viewsource")); + theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_LITERAL_STRING("http://www.mozilla.org/viewsource")); theAttr->SetKey(NS_LITERAL_STRING("xmlns")); #endif // VIEW_SOURCE_HTML } @@ -904,7 +904,7 @@ nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,const nsAReadableStri #ifdef VIEW_SOURCE_HTML nsTokenAllocator* theAllocator=mTokenizer->GetTokenAllocator(); if(theAllocator) { - CAttributeToken* theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertToString(kElementStyles[aTagType])); + CAttributeToken* theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertASCIItoUCS2(kElementStyles[aTagType])); theAttr->SetKey(NS_LITERAL_STRING("style")); theContext.mStartNode.AddAttribute(theAttr); } diff --git a/htmlparser/src/nsWellFormedDTD.cpp b/htmlparser/src/nsWellFormedDTD.cpp index dc2722ffd2dc..d7819ec7d781 100644 --- a/htmlparser/src/nsWellFormedDTD.cpp +++ b/htmlparser/src/nsWellFormedDTD.cpp @@ -187,7 +187,7 @@ eAutoDetectResult CWellFormedDTD::CanParse(CParserContext& aParserContext,nsStri else { if(-1 @@ -502,7 +503,7 @@ nsLocaleService::GetLocaleFromAcceptLanguage(const char *acceptLanguage, nsILoca // result = NS_ERROR_FAILURE; if (countLang>0) { - PRUnichar* localeName = NS_ConvertToString(acceptLanguageList[0]).ToNewUnicode(); + PRUnichar* localeName = ToNewUnicode(nsLiteralCString(acceptLanguageList[0])); result = NewLocale(localeName,_retval); delete localeName; } diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index a0414c6b2c94..5bcaca0ffdf7 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -2899,7 +2899,7 @@ NS_IMETHODIMP nsDocViwerSelectionListener::NotifySelectionChanged(nsIDOMDocument nsCOMPtr domWindow = do_QueryInterface(scriptGlobalObject); if (!domWindow) return NS_ERROR_FAILURE; - domWindow->UpdateCommands(NS_ConvertToString("select")); + domWindow->UpdateCommands(NS_LITERAL_STRING("select")); mGotSelectionState = PR_TRUE; mSelectionWasCollapsed = selectionCollapsed; } diff --git a/layout/build/nsLayoutModule.cpp b/layout/build/nsLayoutModule.cpp index 861d1fd9cf1c..8f5a3143cbb5 100644 --- a/layout/build/nsLayoutModule.cpp +++ b/layout/build/nsLayoutModule.cpp @@ -145,7 +145,7 @@ LayoutScriptNameSet::AddNameSet(nsIScriptContext* aScriptContext) result = aScriptContext->GetNameSpaceManager(&manager); if (NS_OK == result) { - result = manager->RegisterGlobalName(NS_ConvertToString("HTMLImageElement"), + result = manager->RegisterGlobalName(NS_LITERAL_STRING("HTMLImageElement"), NS_GET_IID(nsIScriptObjectOwner), kHTMLImageElementCID, PR_TRUE); @@ -154,7 +154,7 @@ LayoutScriptNameSet::AddNameSet(nsIScriptContext* aScriptContext) return result; } - result = manager->RegisterGlobalName(NS_ConvertToString("HTMLOptionElement"), + result = manager->RegisterGlobalName(NS_LITERAL_STRING("HTMLOptionElement"), NS_GET_IID(nsIScriptObjectOwner), kHTMLOptionElementCID, PR_TRUE); diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index a9d8fcc13858..571b51190a71 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -414,10 +414,10 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, nsCOMPtr content; elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content)); content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, - NS_ConvertToString("horizontal"), PR_FALSE); + NS_LITERAL_STRING("horizontal"), PR_FALSE); content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, - NS_ConvertToString("true"), PR_FALSE); + NS_LITERAL_STRING("true"), PR_FALSE); aAnonymousChildren.AppendElement(content); @@ -425,10 +425,10 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, content = nsnull; elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content)); content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, - NS_ConvertToString("vertical"), PR_FALSE); + NS_LITERAL_STRING("vertical"), PR_FALSE); content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, - NS_ConvertToString("true"), PR_FALSE); + NS_LITERAL_STRING("true"), PR_FALSE); aAnonymousChildren.AppendElement(content); @@ -1400,7 +1400,7 @@ nsGfxScrollFrameInner::SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisibl return; if (!aVisible) - content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, NS_ConvertToString("true"), PR_TRUE); + content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, NS_LITERAL_STRING("true"), PR_TRUE); else content->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, PR_TRUE); diff --git a/layout/html/base/src/nsGfxScrollFrame.cpp b/layout/html/base/src/nsGfxScrollFrame.cpp index a9d8fcc13858..571b51190a71 100644 --- a/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/layout/html/base/src/nsGfxScrollFrame.cpp @@ -414,10 +414,10 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, nsCOMPtr content; elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content)); content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, - NS_ConvertToString("horizontal"), PR_FALSE); + NS_LITERAL_STRING("horizontal"), PR_FALSE); content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, - NS_ConvertToString("true"), PR_FALSE); + NS_LITERAL_STRING("true"), PR_FALSE); aAnonymousChildren.AppendElement(content); @@ -425,10 +425,10 @@ nsGfxScrollFrame::CreateAnonymousContent(nsIPresContext* aPresContext, content = nsnull; elementFactory->CreateInstanceByTag(nodeInfo, getter_AddRefs(content)); content->SetAttribute(kNameSpaceID_None, nsHTMLAtoms::align, - NS_ConvertToString("vertical"), PR_FALSE); + NS_LITERAL_STRING("vertical"), PR_FALSE); content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, - NS_ConvertToString("true"), PR_FALSE); + NS_LITERAL_STRING("true"), PR_FALSE); aAnonymousChildren.AppendElement(content); @@ -1400,7 +1400,7 @@ nsGfxScrollFrameInner::SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisibl return; if (!aVisible) - content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, NS_ConvertToString("true"), PR_TRUE); + content->SetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, NS_LITERAL_STRING("true"), PR_TRUE); else content->UnsetAttribute(kNameSpaceID_None, nsXULAtoms::collapsed, PR_TRUE); diff --git a/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/layout/html/forms/src/nsGfxTextControlFrame2.cpp index 3901c4aa045a..434ce4251058 100644 --- a/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -1778,7 +1778,7 @@ nsGfxTextControlFrame2::CreateAnonymousContent(nsIPresContext* aPresContext, // Set the neccessary style attributes on the text control. if (IsSingleLineTextControl()) - rv = divContent->SetAttribute(kNameSpaceID_None,nsHTMLAtoms::style, NS_ConvertToString(DIV_STRING_SINGLELINE), PR_FALSE); + rv = divContent->SetAttribute(kNameSpaceID_None,nsHTMLAtoms::style, NS_ConvertASCIItoUCS2(DIV_STRING_SINGLELINE), PR_FALSE); else { nsAutoString divStr; divStr.AssignWithConversion(DIV_STRING); const nsStyleDisplay* disp = (const nsStyleDisplay*) @@ -1794,7 +1794,7 @@ nsGfxTextControlFrame2::CreateAnonymousContent(nsIPresContext* aPresContext, if (NS_FAILED(rv)) return rv; - // rv = divContent->SetAttribute(kNameSpaceID_None,nsXULAtoms::debug, NS_ConvertToString("true"), PR_FALSE); + // rv = divContent->SetAttribute(kNameSpaceID_None,nsXULAtoms::debug, NS_LITERAL_STRING("true"), PR_FALSE); rv = aChildList.AppendElement(divContent); if (NS_FAILED(rv)) diff --git a/mailnews/base/util/nsMsgIncomingServer.cpp b/mailnews/base/util/nsMsgIncomingServer.cpp index ca25f4e29ad3..57a5a1fc3d2e 100644 --- a/mailnews/base/util/nsMsgIncomingServer.cpp +++ b/mailnews/base/util/nsMsgIncomingServer.cpp @@ -714,7 +714,7 @@ nsMsgIncomingServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const rv = GetServerURI(getter_Copies(serverUri)); if (NS_FAILED(rv)) return rv; rv = dialog->PromptPassword(aPromptTitle, aPromptMessage, - NS_ConvertToString(serverUri).GetUnicode(), nsIPrompt::SAVE_PASSWORD_PERMANENTLY, + NS_ConvertASCIItoUCS2(serverUri).get(), nsIPrompt::SAVE_PASSWORD_PERMANENTLY, getter_Copies(uniPassword), okayValue); if (NS_FAILED(rv)) return rv; diff --git a/mailnews/compose/src/nsSmtpServer.cpp b/mailnews/compose/src/nsSmtpServer.cpp index ff17f319a847..43797ce4e5d3 100644 --- a/mailnews/compose/src/nsSmtpServer.cpp +++ b/mailnews/compose/src/nsSmtpServer.cpp @@ -206,7 +206,7 @@ nsSmtpServer::GetPasswordWithUI(const PRUnichar * aPromptMessage, const rv = GetServerURI(getter_Copies(serverUri)); if (NS_FAILED(rv)) return rv; rv = aDialog->PromptPassword(aPromptTitle, aPromptMessage, - NS_ConvertToString(serverUri).GetUnicode(), nsIPrompt::SAVE_PASSWORD_PERMANENTLY, + NS_ConvertASCIItoUCS2(serverUri).get(), nsIPrompt::SAVE_PASSWORD_PERMANENTLY, getter_Copies(uniPassword), &okayValue); if (NS_FAILED(rv)) return rv; @@ -253,7 +253,7 @@ nsSmtpServer::GetUsernamePasswordWithUI(const PRUnichar * aPromptMessage, const rv = GetServerURI(getter_Copies(serverUri)); if (NS_FAILED(rv)) return rv; rv = aDialog->PromptUsernameAndPassword(aPromptTitle, aPromptMessage, - NS_ConvertToString(serverUri).GetUnicode(), nsIPrompt::SAVE_PASSWORD_PERMANENTLY, + NS_ConvertASCIItoUCS2(serverUri).get(), nsIPrompt::SAVE_PASSWORD_PERMANENTLY, getter_Copies(uniUsername), getter_Copies(uniPassword), &okayValue); if (NS_FAILED(rv)) return rv; diff --git a/parser/htmlparser/src/CNavDTD.cpp b/parser/htmlparser/src/CNavDTD.cpp index 0ef7f919f7dc..d2714b1b74c1 100644 --- a/parser/htmlparser/src/CNavDTD.cpp +++ b/parser/htmlparser/src/CNavDTD.cpp @@ -494,7 +494,7 @@ nsresult CNavDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsIToke } } //if the content model is empty, then begin by opening ... - theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_ConvertToString("html"))); + theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_LITERAL_STRING("html"))); if(theToken) { mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack. } @@ -547,7 +547,7 @@ nsresult CNavDTD::DidBuildModel(nsresult anErrorCode,PRBool aNotifySink,nsIParse mSkipTarget=eHTMLTag_unknown; //clear this in case we were searching earlier. - CStartToken *theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"))); + CStartToken *theToken=NS_STATIC_CAST(CStartToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_LITERAL_STRING("body"))); mTokenizer->PushTokenFront(theToken); //this token should get pushed on the context stack, don't recycle it result=BuildModel(aParser,mTokenizer,0,aSink); } @@ -788,7 +788,7 @@ nsresult CNavDTD::HandleToken(CToken* aToken,nsIParser* aParser){ //However, in quirks mode, a few tags request, ambiguosly, for a BODY. - Bugs 18928, 24204.- mMisplacedContent.Push(aToken); if(mDTDMode==eDTDMode_quirks && (gHTMLElements[theTag].HasSpecialProperty(kRequiresBody))) { - CToken* theBodyToken=NS_STATIC_CAST(CToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_ConvertToString("body"))); + CToken* theBodyToken=NS_STATIC_CAST(CToken*,mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_body,NS_LITERAL_STRING("body"))); result=HandleToken(theBodyToken,aParser); } return result; diff --git a/parser/htmlparser/src/COtherDTD.cpp b/parser/htmlparser/src/COtherDTD.cpp index fde2d7d4b3df..3127f6f9b1e8 100644 --- a/parser/htmlparser/src/COtherDTD.cpp +++ b/parser/htmlparser/src/COtherDTD.cpp @@ -317,7 +317,7 @@ eAutoDetectResult COtherDTD::CanParse(CParserContext& aParserContext,nsString& a if(BufferContainsHTML(aBuffer,theBufHasXML)){ result = eValidDetect ; if(0==aParserContext.mMimeType.Length()) { - aParserContext.SetMimeType(NS_ConvertToString(kHTMLTextContentType)); + aParserContext.SetMimeType(NS_ConvertASCIItoUCS2(kHTMLTextContentType)); if(!theBufHasXML) { switch(aParserContext.mDTDMode) { case eDTDMode_strict: @@ -417,7 +417,7 @@ nsresult COtherDTD::BuildModel(nsIParser* aParser,nsITokenizer* aTokenizer,nsITo if(!mBodyContext->GetCount()) { //if the content model is empty, then begin by opening ... - CStartToken *theToken=(CStartToken*)mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_ConvertToString("html")); + CStartToken *theToken=(CStartToken*)mTokenAllocator->CreateTokenOfType(eToken_start,eHTMLTag_html,NS_LITERAL_STRING("html")); HandleStartToken(theToken); //this token should get pushed on the context stack, don't recycle it. } @@ -668,7 +668,7 @@ nsresult COtherDTD::WillHandleStartTag(CToken* aToken,eHTMLTags aTag,nsIParserNo CObserverService* theService=mParser->GetObserverService(); if(theService) { const nsISupportsParserBundle* bundle=mParser->GetParserBundle(); - result=theService->Notify(aTag,aNode,(void*)bundle, NS_ConvertToString(kHTMLTextContentType), mParser); + result=theService->Notify(aTag,aNode,(void*)bundle, NS_ConvertASCIItoUCS2(kHTMLTextContentType), mParser); } } diff --git a/parser/htmlparser/src/CRtfDTD.cpp b/parser/htmlparser/src/CRtfDTD.cpp index b51624008242..0b12cf5cc7b3 100644 --- a/parser/htmlparser/src/CRtfDTD.cpp +++ b/parser/htmlparser/src/CRtfDTD.cpp @@ -757,7 +757,7 @@ nsresult CRtfDTD::HandleControlWord(CToken* aToken){ break; case eRTFCtrl_tab: { - CTextToken theToken2( NS_ConvertToString(" ") ); + CTextToken theToken2( NS_LITERAL_STRING(" ") ); result=HandleContent(&theToken2); } break; diff --git a/parser/htmlparser/src/nsExpatDTD.cpp b/parser/htmlparser/src/nsExpatDTD.cpp index 41cacd4c02d7..c52be44278ed 100644 --- a/parser/htmlparser/src/nsExpatDTD.cpp +++ b/parser/htmlparser/src/nsExpatDTD.cpp @@ -180,7 +180,7 @@ eAutoDetectResult nsExpatDTD::CanParse(CParserContext& aParserContext,nsString& else { if(-1 origin, start, end; @@ -897,7 +897,7 @@ PRInt32 CMarkupDeclToken::GetTokenType(void) { * @return error result */ nsresult CMarkupDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) { - static nsString theTerminals = NS_ConvertToString("\n\r'\">",5); + static nsString theTerminals = NS_LITERAL_STRING("\n\r'\">"); nsresult result=NS_OK; PRBool done=PR_FALSE; PRUnichar quote=0; @@ -1521,7 +1521,7 @@ nsresult ConsumeQuotedString(PRUnichar aChar,nsString& aString,nsScanner& aScann */ static nsresult ConsumeAttributeValueText(PRUnichar,nsString& aString,nsScanner& aScanner){ - static nsString theTerminals = NS_ConvertToString("\b\t\n\r >",6); + static nsString theTerminals = NS_LITERAL_STRING("\b\t\n\r >"); nsresult result=aScanner.ReadUntil(aString,theTerminals,PR_FALSE); //Let's force quotes if either the first or last char is quoted. @@ -1570,7 +1570,7 @@ nsresult CAttributeToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 a } else { //If you're here, handle an unquoted key. - static nsAutoString theTerminals = NS_ConvertToString("\b\t\n\r \"=>",8); + static nsAutoString theTerminals = NS_LITERAL_STRING("\b\t\n\r \"=>"); result=aScanner.ReadUntil(start,end,theTerminals,PR_FALSE); } if (!aRetainWhitespace) { diff --git a/parser/htmlparser/src/nsParser.cpp b/parser/htmlparser/src/nsParser.cpp index dc5c5e27ab35..e26ab23fa429 100644 --- a/parser/htmlparser/src/nsParser.cpp +++ b/parser/htmlparser/src/nsParser.cpp @@ -2121,7 +2121,7 @@ nsresult nsParser::OnStartRequest(nsIRequest *request, nsISupports* aContext) { rv = channel->GetContentType(&contentType); if (NS_SUCCEEDED(rv)) { - mParserContext->SetMimeType( NS_ConvertToString(contentType) ); + mParserContext->SetMimeType( NS_ConvertASCIItoUCS2(contentType) ); nsCRT::free(contentType); } else diff --git a/parser/htmlparser/src/nsViewSourceHTML.cpp b/parser/htmlparser/src/nsViewSourceHTML.cpp index 20e66cf94608..df232dfc8c40 100644 --- a/parser/htmlparser/src/nsViewSourceHTML.cpp +++ b/parser/htmlparser/src/nsViewSourceHTML.cpp @@ -516,10 +516,10 @@ NS_IMETHODIMP CViewSourceHTML::BuildModel(nsIParser* aParser,nsITokenizer* aToke nsTokenAllocator* theAllocator=mTokenizer->GetTokenAllocator(); if(theAllocator) { #ifdef VIEW_SOURCE_HTML - theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertToString(kPreStyle)); + theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertASCIItoUCS2(kPreStyle)); theAttr->SetKey(NS_LITERAL_STRING("style")); #else - theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertToString("http://www.mozilla.org/viewsource")); + theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_LITERAL_STRING("http://www.mozilla.org/viewsource")); theAttr->SetKey(NS_LITERAL_STRING("xmlns")); #endif // VIEW_SOURCE_HTML } @@ -904,7 +904,7 @@ nsresult CViewSourceHTML::WriteTag(nsString &theXMLTagName,const nsAReadableStri #ifdef VIEW_SOURCE_HTML nsTokenAllocator* theAllocator=mTokenizer->GetTokenAllocator(); if(theAllocator) { - CAttributeToken* theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertToString(kElementStyles[aTagType])); + CAttributeToken* theAttr=(CAttributeToken*)theAllocator->CreateTokenOfType(eToken_attribute,eHTMLTag_unknown,NS_ConvertASCIItoUCS2(kElementStyles[aTagType])); theAttr->SetKey(NS_LITERAL_STRING("style")); theContext.mStartNode.AddAttribute(theAttr); } diff --git a/parser/htmlparser/src/nsWellFormedDTD.cpp b/parser/htmlparser/src/nsWellFormedDTD.cpp index dc2722ffd2dc..d7819ec7d781 100644 --- a/parser/htmlparser/src/nsWellFormedDTD.cpp +++ b/parser/htmlparser/src/nsWellFormedDTD.cpp @@ -187,7 +187,7 @@ eAutoDetectResult CWellFormedDTD::CanParse(CParserContext& aParserContext,nsStri else { if(-1