diff --git a/mozilla/xpfe/appshell/src/nsAppShellNameSet.cpp b/mozilla/xpfe/appshell/src/nsAppShellNameSet.cpp index 51c37bea9a3..b74c9a05cc4 100644 --- a/mozilla/xpfe/appshell/src/nsAppShellNameSet.cpp +++ b/mozilla/xpfe/appshell/src/nsAppShellNameSet.cpp @@ -65,7 +65,7 @@ nsAppShellNameSet::AddNameSet(nsIScriptContext* aScriptContext) rv = aScriptContext->GetNameSpaceManager(&manager); if (NS_SUCCEEDED(rv)) { - rv = manager->RegisterGlobalName("XPComFactory", + rv = manager->RegisterGlobalName(NS_ConvertASCIItoUCS2("XPComFactory"), kXPConnectFactoryCID, PR_FALSE); NS_RELEASE(manager); diff --git a/mozilla/xpfe/appshell/src/nsAppShellService.cpp b/mozilla/xpfe/appshell/src/nsAppShellService.cpp index 5cb290320d0..e7b14999184 100644 --- a/mozilla/xpfe/appshell/src/nsAppShellService.cpp +++ b/mozilla/xpfe/appshell/src/nsAppShellService.cpp @@ -739,11 +739,11 @@ NS_IMETHODIMP nsAppShellService::Observe(nsISupports *aSubject, nsAutoString topic(aTopic); NS_ASSERTION(mAppShell, "appshell service notified before appshell built"); - if (topic.Equals(gEQActivatedNotification)) { + if (topic.EqualsWithConversion(gEQActivatedNotification)) { nsCOMPtr eq(do_QueryInterface(aSubject)); if (eq) mAppShell->ListenToEventQueue(eq, PR_TRUE); - } else if (topic.Equals(gEQDestroyedNotification)) { + } else if (topic.EqualsWithConversion(gEQDestroyedNotification)) { nsCOMPtr eq(do_QueryInterface(aSubject)); if (eq) mAppShell->ListenToEventQueue(eq, PR_FALSE); @@ -757,8 +757,8 @@ void nsAppShellService::RegisterObserver(PRBool aRegister) nsresult rv; nsISupports *glop; - nsAutoString topicA(gEQActivatedNotification); - nsAutoString topicB(gEQDestroyedNotification); + nsAutoString topicA; topicA.AssignWithConversion(gEQActivatedNotification); + nsAutoString topicB; topicB.AssignWithConversion(gEQDestroyedNotification); // here's a silly dance. seems better to do it than not, though... nsCOMPtr weObserve(do_QueryInterface(NS_STATIC_CAST(nsIObserver *, this))); diff --git a/mozilla/xpfe/appshell/src/nsCommonDialogs.cpp b/mozilla/xpfe/appshell/src/nsCommonDialogs.cpp index 775b4f91d02..aec15b923bb 100644 --- a/mozilla/xpfe/appshell/src/nsCommonDialogs.cpp +++ b/mozilla/xpfe/appshell/src/nsCommonDialogs.cpp @@ -64,7 +64,7 @@ NS_IMETHODIMP nsCommonDialogs::Alert(nsIDOMWindow *inParent, const PRUnichar *i block->SetString( eDialogTitle,inWindowTitle ); - nsString url( kAlertIconURL ); + nsString url; url.AssignWithConversion( kAlertIconURL ); block->SetString( eIconURL, url.GetUnicode()); rv = DoDialog( inParent, block, kPromptURL ); @@ -92,7 +92,7 @@ NS_IMETHODIMP nsCommonDialogs::AlertCheck(nsIDOMWindow *inParent, const PRUnich block->SetString( eDialogTitle, inWindowTitle ); - nsString url( kAlertIconURL ); + nsString url; url.AssignWithConversion( kAlertIconURL ); block->SetString( eIconURL, url.GetUnicode()); block->SetString( eCheckboxMsg, inCheckMsg ); @@ -123,7 +123,7 @@ NS_IMETHODIMP nsCommonDialogs::Confirm(nsIDOMWindow *inParent, const PRUnichar * block->SetString( eDialogTitle, inWindowTitle ); - nsString url( kQuestionIconURL ); + nsString url; url.AssignWithConversion( kQuestionIconURL ); block->SetString( eIconURL, url.GetUnicode()); rv = DoDialog( inParent, block, kPromptURL ); @@ -152,7 +152,7 @@ NS_IMETHODIMP nsCommonDialogs::ConfirmCheck(nsIDOMWindow *inParent, const PRUni block->SetString( eDialogTitle, inWindowTitle ); - nsString url( kQuestionIconURL ); + nsString url; url.AssignWithConversion( kQuestionIconURL ); block->SetString( eIconURL, url.GetUnicode()); block->SetString( eCheckboxMsg, inCheckMsg ); block->SetInt(eCheckboxState, *outCheckValue ); @@ -244,8 +244,7 @@ NS_IMETHODIMP nsCommonDialogs::UniversalDialog if (inIConURL) { block->SetString(eIconURL, inIConURL); } else { - nsString url(kQuestionIconURL); - block->SetString(eIconURL, url.GetUnicode()); + block->SetString(eIconURL, NS_ConvertASCIItoUCS2(kQuestionIconURL).GetUnicode()); } if (inCheckboxMsg) { block->SetInt(eCheckboxState, *inoutCheckboxState); @@ -295,7 +294,7 @@ NS_IMETHODIMP nsCommonDialogs::Prompt(nsIDOMWindow *inParent, const PRUnichar *i block->SetString( eDialogTitle, inWindowTitle ); - nsString url( kQuestionIconURL ); + nsString url; url.AssignWithConversion( kQuestionIconURL ); block->SetString( eIconURL, url.GetUnicode()); block->SetInt( eNumberEditfields, 1 ); block->SetString( eEditfield1Value, inDefaultText ); @@ -329,7 +328,7 @@ NS_IMETHODIMP nsCommonDialogs::PromptUsernameAndPassword(nsIDOMWindow *inParent, block->SetString( eDialogTitle, inWindowTitle ); - nsString url( kQuestionIconURL ); + nsString url; url.AssignWithConversion( kQuestionIconURL ); block->SetString( eIconURL, url.GetUnicode()); block->SetInt( eNumberEditfields, 2 ); block->SetString( eEditfield1Value, *outUser ); @@ -364,7 +363,7 @@ NS_IMETHODIMP nsCommonDialogs::PromptPassword(nsIDOMWindow *inParent, const PRU block->SetString( eDialogTitle, inWindowTitle ); - nsString url( kQuestionIconURL ); + nsString url; url.AssignWithConversion( kQuestionIconURL ); block->SetString( eIconURL, url.GetUnicode()); block->SetInt( eNumberEditfields, 1 ); block->SetInt( eEditField1Password, 1 ); diff --git a/mozilla/xpfe/appshell/src/nsContentTreeOwner.cpp b/mozilla/xpfe/appshell/src/nsContentTreeOwner.cpp index 9b04202301a..090059c0272 100644 --- a/mozilla/xpfe/appshell/src/nsContentTreeOwner.cpp +++ b/mozilla/xpfe/appshell/src/nsContentTreeOwner.cpp @@ -202,7 +202,7 @@ NS_IMETHODIMP nsContentTreeOwner::SetJSStatus(const PRUnichar* aStatus) return NS_OK; nsCOMPtr xpConnectObj; - nsAutoString xulBrowserWinId("XULBrowserWindow"); + nsAutoString xulBrowserWinId; xulBrowserWinId.AssignWithConversion("XULBrowserWindow"); piDOMWindow->GetObjectProperty(xulBrowserWinId.GetUnicode(), getter_AddRefs(xpConnectObj)); nsCOMPtr xulBrowserWindow(do_QueryInterface(xpConnectObj)); @@ -220,7 +220,7 @@ NS_IMETHODIMP nsContentTreeOwner::SetJSDefaultStatus(const PRUnichar* aStatus) return NS_OK; nsCOMPtr xpConnectObj; - nsAutoString xulBrowserWinId("XULBrowserWindow"); + nsAutoString xulBrowserWinId; xulBrowserWinId.AssignWithConversion("XULBrowserWindow"); piDOMWindow->GetObjectProperty(xulBrowserWinId.GetUnicode(), getter_AddRefs(xpConnectObj)); nsCOMPtr xulBrowserWindow(do_QueryInterface(xpConnectObj)); @@ -238,7 +238,7 @@ NS_IMETHODIMP nsContentTreeOwner::SetOverLink(const PRUnichar* aLink) return NS_OK; nsCOMPtr xpConnectObj; - nsAutoString xulBrowserWinId("XULBrowserWindow"); + nsAutoString xulBrowserWinId; xulBrowserWinId.AssignWithConversion("XULBrowserWindow"); piDOMWindow->GetObjectProperty(xulBrowserWinId.GetUnicode(), getter_AddRefs(xpConnectObj)); nsCOMPtr xulBrowserWindow(do_QueryInterface(xpConnectObj)); @@ -437,7 +437,7 @@ NS_IMETHODIMP nsContentTreeOwner::SetTitle(const PRUnichar* aTitle) if(mTitlePreface.Length() > 0) { // Title will be: "Preface: Doc Title - Mozilla" - title = mTitlePreface; + title.Assign(mTitlePreface); title.Append(docTitle); } else @@ -450,7 +450,7 @@ NS_IMETHODIMP nsContentTreeOwner::SetTitle(const PRUnichar* aTitle) else { // Title will just be plain: Mozilla - title = mWindowTitleModifier; + title.Assign(mWindowTitleModifier); } // XXX Don't need to fully qualify this once I remove nsWebShellWindow::SetTitle @@ -482,31 +482,31 @@ NS_IMETHODIMP nsContentTreeOwner::ApplyChromeMask() nsAutoString newvalue; if (! (mChromeMask & nsIWebBrowserChrome::menuBarOn)) { - newvalue += "menubar "; + newvalue.AppendWithConversion("menubar "); } if (! (mChromeMask & nsIWebBrowserChrome::toolBarOn)) { - newvalue += "toolbar "; + newvalue.AppendWithConversion("toolbar "); } if (! (mChromeMask & nsIWebBrowserChrome::locationBarOn)) { - newvalue += "location "; + newvalue.AppendWithConversion("location "); } if (! (mChromeMask & nsIWebBrowserChrome::personalToolBarOn)) { - newvalue += "directories "; + newvalue.AppendWithConversion("directories "); } if (! (mChromeMask & nsIWebBrowserChrome::statusBarOn)) { - newvalue += "status "; + newvalue.AppendWithConversion("status "); } if (! (mChromeMask & nsIWebBrowserChrome::extraChromeOn)) { - newvalue += "extrachrome"; + newvalue.AppendWithConversion("extrachrome"); } // Get the old value, to avoid useless style reflows if we're just // setting stuff to the exact same thing. nsAutoString oldvalue; - window->GetAttribute("chromehidden", oldvalue); + window->GetAttribute(NS_ConvertASCIItoUCS2("chromehidden"), oldvalue); if (oldvalue != newvalue) { - window->SetAttribute("chromehidden", newvalue); + window->SetAttribute(NS_ConvertASCIItoUCS2("chromehidden"), newvalue); } return NS_OK; @@ -529,13 +529,13 @@ void nsContentTreeOwner::XULWindow(nsXULWindow* aXULWindow) if(docShellElement) { - docShellElement->GetAttribute("contenttitlesettting", contentTitleSetting); - if(contentTitleSetting.Equals("true")) + docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("contenttitlesettting"), contentTitleSetting); + if(contentTitleSetting.EqualsWithConversion("true")) { mContentTitleSetting = PR_TRUE; - docShellElement->GetAttribute("titlemodifier", mWindowTitleModifier); - docShellElement->GetAttribute("titlemenuseparator", mTitleSeparator); - docShellElement->GetAttribute("titlepreface", mTitlePreface); + docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("titlemodifier"), mWindowTitleModifier); + docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("titlemenuseparator"), mTitleSeparator); + docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("titlepreface"), mTitlePreface); } } else diff --git a/mozilla/xpfe/appshell/src/nsFileLocations.cpp b/mozilla/xpfe/appshell/src/nsFileLocations.cpp index adcd6c48523..7a8d5d8e436 100644 --- a/mozilla/xpfe/appshell/src/nsFileLocations.cpp +++ b/mozilla/xpfe/appshell/src/nsFileLocations.cpp @@ -139,7 +139,8 @@ static PRBool GetProfileDirectory(nsFileSpec& outSpec) } #if defined(NS_DEBUG) if (currProfileName) { - printf("ProfileName : %s\n", nsCAutoString(currProfileName).GetBuffer()); + nsCAutoString currProfileNameCStr; currProfileNameCStr.AssignWithConversion(currProfileName); + printf("ProfileName : %s\n", currProfileNameCStr.GetBuffer()); printf("ProfileDir : %s\n", currProfileDirSpec.GetNativePathCString()); } #endif /* NS_DEBUG */ diff --git a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp index a4438163863..d4748d1cf31 100644 --- a/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsWebShellWindow.cpp @@ -345,7 +345,7 @@ nsresult nsWebShellWindow::Initialize(nsIXULWindow* aParent, rv = aUrl->GetSpec(&tmpStr); if (NS_FAILED(rv)) return rv; - urlString = tmpStr; + urlString.AssignWithConversion(tmpStr); nsCRT::free(tmpStr); nsCOMPtr webNav(do_QueryInterface(mDocShell)); NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE); @@ -585,7 +585,7 @@ NS_IMETHODIMP nsWebShellWindow::CreateMenu(nsIMenuBar * aMenuBar, // Open the node so that the contents are visible. nsCOMPtr menuElement = do_QueryInterface(aMenuNode); if (menuElement) - menuElement->SetAttribute("open", "true"); + menuElement->SetAttribute(NS_ConvertASCIItoUCS2("open"), NS_ConvertASCIItoUCS2("true")); // Begin menuitem inner loop @@ -597,7 +597,7 @@ NS_IMETHODIMP nsWebShellWindow::CreateMenu(nsIMenuBar * aMenuBar, if (menuPopupElement) { nsString menuPopupNodeType; menuPopupElement->GetNodeName(menuPopupNodeType); - if (menuPopupNodeType.Equals("menupopup")) + if (menuPopupNodeType.EqualsWithConversion("menupopup")) break; } nsCOMPtr oldMenuPopupNode(menuPopupNode); @@ -616,12 +616,12 @@ NS_IMETHODIMP nsWebShellWindow::CreateMenu(nsIMenuBar * aMenuBar, nsString menuitemNodeType; nsString menuitemName; menuitemElement->GetNodeName(menuitemNodeType); - if (menuitemNodeType.Equals("menuitem")) { + if (menuitemNodeType.EqualsWithConversion("menuitem")) { // LoadMenuItem LoadMenuItem(pnsMenu, menuitemElement, menuitemNode); - } else if (menuitemNodeType.Equals("menuseparator")) { + } else if (menuitemNodeType.EqualsWithConversion("menuseparator")) { pnsMenu->AddSeparator(); - } else if (menuitemNodeType.Equals("menu")) { + } else if (menuitemNodeType.EqualsWithConversion("menu")) { // Load a submenu LoadSubMenu(pnsMenu, menuitemElement, menuitemNode); } @@ -645,8 +645,8 @@ NS_IMETHODIMP nsWebShellWindow::LoadMenuItem( nsString menuitemName; nsString menuitemCmd; - menuitemElement->GetAttribute(nsAutoString("value"), menuitemName); - menuitemElement->GetAttribute(nsAutoString("cmd"), menuitemCmd); + menuitemElement->GetAttribute(NS_ConvertASCIItoUCS2("value"), menuitemName); + menuitemElement->GetAttribute(NS_ConvertASCIItoUCS2("cmd"), menuitemCmd); // Create nsMenuItem nsIMenuItem * pnsMenuItem = nsnull; nsresult rv = nsComponentManager::CreateInstance(kMenuItemCID, nsnull, NS_GET_IID(nsIMenuItem), (void**)&pnsMenuItem); @@ -665,7 +665,7 @@ NS_IMETHODIMP nsWebShellWindow::LoadMenuItem( //pnsMenuItem->SetLabel(menuitemName); // Set key shortcut and modifiers - nsAutoString keyAtom("key"); + nsAutoString keyAtom; keyAtom.AssignWithConversion("key"); nsString keyValue; domElement->GetAttribute(keyAtom, keyValue); @@ -689,29 +689,29 @@ NS_IMETHODIMP nsWebShellWindow::LoadMenuItem( if(keyElement){ PRUint8 modifiers = knsMenuItemNoModifier; - nsAutoString shiftAtom("shift"); - nsAutoString altAtom("alt"); - nsAutoString commandAtom("command"); + nsAutoString shiftAtom; shiftAtom.AssignWithConversion("shift"); + nsAutoString altAtom; altAtom.AssignWithConversion("alt"); + nsAutoString commandAtom; commandAtom.AssignWithConversion("command"); nsString shiftValue; nsString altValue; nsString commandValue; - nsString keyChar = " "; + nsString keyChar; keyChar.AssignWithConversion(" "); keyElement->GetAttribute(keyAtom, keyChar); keyElement->GetAttribute(shiftAtom, shiftValue); keyElement->GetAttribute(altAtom, altValue); keyElement->GetAttribute(commandAtom, commandValue); - if(!keyChar.Equals(" ")) + if(!keyChar.EqualsWithConversion(" ")) pnsMenuItem->SetShortcutChar(keyChar); - if(shiftValue.Equals("true")) + if(shiftValue.EqualsWithConversion("true")) modifiers |= knsMenuItemShiftModifier; - if(altValue.Equals("true")) + if(altValue.EqualsWithConversion("true")) modifiers |= knsMenuItemAltModifier; - if(commandValue.Equals("false")) + if(commandValue.EqualsWithConversion("false")) modifiers |= knsMenuItemCommandModifier; pnsMenuItem->SetModifiers(modifiers); @@ -725,7 +725,7 @@ NS_IMETHODIMP nsWebShellWindow::LoadMenuItem( - nsAutoString cmdAtom("onaction"); + nsAutoString cmdAtom; cmdAtom.AssignWithConversion("onaction"); nsString cmdName; domElement->GetAttribute(cmdAtom, cmdName); @@ -775,7 +775,7 @@ void nsWebShellWindow::LoadSubMenu( nsIDOMNode * menuNode) { nsString menuName; - menuElement->GetAttribute(nsAutoString("value"), menuName); + menuElement->GetAttribute(NS_ConvertASCIItoUCS2("value"), menuName); //printf("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks // Create nsMenu @@ -789,7 +789,7 @@ void nsWebShellWindow::LoadSubMenu( NS_RELEASE(supports); // Balance QI // Open the node so that the contents are visible. - menuElement->SetAttribute("open", "true"); + menuElement->SetAttribute(NS_ConvertASCIItoUCS2("open"), NS_ConvertASCIItoUCS2("true")); // Set nsMenu Name pnsMenu->SetLabel(menuName); @@ -810,7 +810,7 @@ void nsWebShellWindow::LoadSubMenu( if (menuPopupElement) { nsString menuPopupNodeType; menuPopupElement->GetNodeName(menuPopupNodeType); - if (menuPopupNodeType.Equals("menupopup")) + if (menuPopupNodeType.EqualsWithConversion("menupopup")) break; } nsCOMPtr oldMenuPopupNode(menuPopupNode); @@ -833,12 +833,12 @@ void nsWebShellWindow::LoadSubMenu( printf("Type [%s] %d\n", menuitemNodeType.ToNewCString(), menuitemNodeType.Equals("menuseparator")); #endif - if (menuitemNodeType.Equals("menuitem")) { + if (menuitemNodeType.EqualsWithConversion("menuitem")) { // Load a menuitem LoadMenuItem(pnsMenu, menuitemElement, menuitemNode); - } else if (menuitemNodeType.Equals("menuseparator")) { + } else if (menuitemNodeType.EqualsWithConversion("menuseparator")) { pnsMenu->AddSeparator(); - } else if (menuitemNodeType.Equals("menu")) { + } else if (menuitemNodeType.EqualsWithConversion("menu")) { // Add a submenu LoadSubMenu(pnsMenu, menuitemElement, menuitemNode); } @@ -868,7 +868,7 @@ void nsWebShellWindow::DynamicLoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aP nsresult rv; int endCount = 0; - nsCOMPtr menubarNode(FindNamedDOMNode(nsAutoString("menubar"), window, endCount, 1)); + nsCOMPtr menubarNode(FindNamedDOMNode(NS_ConvertASCIItoUCS2("menubar"), window, endCount, 1)); if (menubarNode) { nsIMenuBar * pnsMenuBar = nsnull; rv = nsComponentManager::CreateInstance(kMenuBarCID, nsnull, NS_GET_IID(nsIMenuBar), (void**)&pnsMenuBar); @@ -950,7 +950,7 @@ void nsWebShellWindow::LoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aParentWi nsresult rv; int endCount = 0; - nsCOMPtr menubarNode(FindNamedDOMNode(nsAutoString("menubar"), window, endCount, 1)); + nsCOMPtr menubarNode(FindNamedDOMNode(NS_ConvertASCIItoUCS2("menubar"), window, endCount, 1)); if (menubarNode) { nsIMenuBar * pnsMenuBar = nsnull; rv = nsComponentManager::CreateInstance(kMenuBarCID, nsnull, NS_GET_IID(nsIMenuBar), (void**)&pnsMenuBar); @@ -971,8 +971,8 @@ void nsWebShellWindow::LoadMenus(nsIDOMDocument * aDOMDoc, nsIWidget * aParentWi nsString menuNodeType; nsString menuName; menuElement->GetNodeName(menuNodeType); - if (menuNodeType.Equals("menu")) { - menuElement->GetAttribute(nsAutoString("value"), menuName); + if (menuNodeType.EqualsWithConversion("menu")) { + menuElement->GetAttribute(NS_ConvertASCIItoUCS2("value"), menuName); #ifdef DEBUG_rods printf("Creating Menu [%s] \n", menuName.ToNewCString()); // this leaks @@ -1255,7 +1255,7 @@ nsWebShellWindow::OnEndDocumentLoad(nsIDocumentLoader* loader, /////////////////////////////// // Find the Menubar DOM and Load the menus, hooking them up to the loaded commands /////////////////////////////// - nsCOMPtr menubarDOMDoc(GetNamedDOMDoc(nsAutoString("this"))); // XXX "this" is a small kludge for code reused + nsCOMPtr menubarDOMDoc(GetNamedDOMDoc(NS_ConvertASCIItoUCS2("this"))); // XXX "this" is a small kludge for code reused if (menubarDOMDoc) { #ifdef SOME_PLATFORM // Anyone using native non-dynamic menus should add themselves here. @@ -1349,7 +1349,7 @@ nsCOMPtr nsWebShellWindow::GetNamedDOMDoc(const nsString & aWebS // first get the toolbar child docShell nsCOMPtr childDocShell; - if (aWebShellName.Equals("this")) { // XXX small kludge for code reused + if (aWebShellName.EqualsWithConversion("this")) { // XXX small kludge for code reused childDocShell = mDocShell; } else { nsCOMPtr docShellAsItem; @@ -1415,7 +1415,7 @@ void nsWebShellWindow::LoadContentAreas() { nsCOMPtr url = do_QueryInterface(mainURL); if (url) url->GetQuery(&search); - searchSpec = search; + searchSpec.AssignWithConversion(search); nsCRT::free(search); } } @@ -1452,7 +1452,7 @@ void nsWebShellWindow::LoadContentAreas() { urlChar = contentURL.ToNewCString(); if (urlChar) { nsUnescape(urlChar); - contentURL = urlChar; + contentURL.AssignWithConversion(urlChar); nsCOMPtr webNav(do_QueryInterface(contentShell)); webNav->LoadURI(contentURL.GetUnicode()); delete [] urlChar; @@ -1695,8 +1695,8 @@ nsWebShellWindow::NotifyObservers( const nsString &aTopic, const nsString &someD (nsISupports**)&svc ); if ( NS_SUCCEEDED( rv ) && svc ) { // Notify observers as instructed; the subject is "this" web shell window. - nsAutoString topic(prefix); - topic += ";"; + nsAutoString topic; topic.AssignWithConversion(prefix); + topic.AppendWithConversion(";"); topic += aTopic; rv = svc->Notify( (nsIWebShellWindow*)this, topic.GetUnicode(), someData.GetUnicode() ); // Release the service. @@ -1744,7 +1744,7 @@ NS_IMETHODIMP nsWebShellWindow::Alert(const PRUnichar *text) NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); // todo, put that in a string bundle - nsString defaultTitle("Alert"); + nsString defaultTitle; defaultTitle.AssignWithConversion("Alert"); if ( NS_SUCCEEDED( rv ) ) rv = dialog->Alert( domWindow, defaultTitle.GetUnicode(),text ); return rv; @@ -1763,7 +1763,7 @@ NS_IMETHODIMP nsWebShellWindow::Confirm(const PRUnichar *text, PRBool *_retval) return rv; } - nsString defaultTitle("Confirm"); + nsString defaultTitle; defaultTitle.AssignWithConversion("Confirm"); NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); if ( NS_SUCCEEDED( rv ) ) rv = dialog->Confirm( domWindow, defaultTitle.GetUnicode(), text, _retval ); @@ -1784,7 +1784,7 @@ NS_IMETHODIMP nsWebShellWindow::ConfirmCheck(const PRUnichar *text, const PRUnic } // todo, put that in a string bundle - nsString defaultTitle("Confirm"); + nsString defaultTitle; defaultTitle.AssignWithConversion("Confirm"); NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); if ( NS_SUCCEEDED( rv ) ) rv =dialog->ConfirmCheck( domWindow,defaultTitle.GetUnicode(), text, checkMsg, checkValue, _retval ); @@ -1852,7 +1852,7 @@ NS_IMETHODIMP nsWebShellWindow::Prompt(const PRUnichar *text, const PRUnichar *d return rv; } // todo, put that in a string bundle - nsString defaultTitle("Prompt"); + nsString defaultTitle; defaultTitle.AssignWithConversion("Prompt"); NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); if ( NS_SUCCEEDED( rv ) ) @@ -1874,7 +1874,7 @@ NS_IMETHODIMP nsWebShellWindow::PromptUsernameAndPassword(const PRUnichar *text, } // todo, put that in a string bundle -nsString defaultTitle("Prompt Username and Password"); +nsString defaultTitle; defaultTitle.AssignWithConversion("Prompt Username and Password"); NS_WITH_SERVICE(nsICommonDialogs, dialog, kCommonDialogsCID, &rv); if ( NS_SUCCEEDED( rv ) ) diff --git a/mozilla/xpfe/appshell/src/nsWindowMediator.cpp b/mozilla/xpfe/appshell/src/nsWindowMediator.cpp index a33e32ddae8..18018823163 100644 --- a/mozilla/xpfe/appshell/src/nsWindowMediator.cpp +++ b/mozilla/xpfe/appshell/src/nsWindowMediator.cpp @@ -146,8 +146,7 @@ void GetAttribute( nsIXULWindow* inWindow, const nsAutoString& inAttribute, nsAu void GetWindowType( nsIXULWindow* inWindow, nsAutoString& outType ) { - nsAutoString typeAttrib("windowtype"); - GetAttribute( inWindow, typeAttrib, outType ); + GetAttribute( inWindow, NS_ConvertASCIItoUCS2("windowtype"), outType ); } /* return an integer corresponding to the relative z order of the window. @@ -623,12 +622,12 @@ NS_IMETHODIMP nsWindowMediator::UpdateWindowTitle( nsIXULWindow* inWindow, cons // Should this title be displayed PRBool display = PR_TRUE; - nsAutoString typeAttrib("intaskslist"); + nsAutoString typeAttrib; typeAttrib.AssignWithConversion("intaskslist"); nsAutoString displayString; GetAttribute( inWindow, typeAttrib, displayString ); displayString.ToLowerCase(); - if ( displayString.Equals("false") ) + if ( displayString.EqualsWithConversion("false") ) display=PR_FALSE; rv = Assert( window , kNC_Name, newTitle, display ); @@ -1035,9 +1034,9 @@ nsresult nsWindowMediator::AddWindowToRDF( nsWindowInfo* ioWindowInfo ) nsAutoString windowTitle; // Make up a unique ID and create the RDF NODE - nsAutoString uniqueID = "window-"; + nsAutoString uniqueID; uniqueID.AssignWithConversion("window-"); uniqueID.Append(windowTitle ); - uniqueID.Append( mTimeStamp, 10 ); + uniqueID.AppendInt( mTimeStamp, 10 ); char cID[ 256]; uniqueID.ToCString( cID, 256); if (NS_FAILED(rv = gRDFService->GetResource(cID, getter_AddRefs(window) ))) diff --git a/mozilla/xpfe/appshell/src/nsXULCommand.cpp b/mozilla/xpfe/appshell/src/nsXULCommand.cpp index b854c7f816b..59242b1f987 100644 --- a/mozilla/xpfe/appshell/src/nsXULCommand.cpp +++ b/mozilla/xpfe/appshell/src/nsXULCommand.cpp @@ -87,8 +87,8 @@ NS_IMETHODIMP nsXULCommand::AttributeHasBeenSet(const nsString & aAttr) nsAutoString value; mDOMElement->GetAttribute(aAttr, value); if (DEBUG_MENUSDEL) printf("New value is [%s]=[%s]\n", aAttr.ToNewCString(), value.ToNewCString()); - if (aAttr.Equals("disabled")) { - mMenuItem->SetEnabled((PRBool)(!value.Equals("true"))); + if (aAttr.EqualsWithConversion("disabled")) { + mMenuItem->SetEnabled((PRBool)(!value.EqualsWithConversion("true"))); } return NS_OK; } diff --git a/mozilla/xpfe/appshell/src/nsXULWindow.cpp b/mozilla/xpfe/appshell/src/nsXULWindow.cpp index cd6f957db95..867ce803620 100644 --- a/mozilla/xpfe/appshell/src/nsXULWindow.cpp +++ b/mozilla/xpfe/appshell/src/nsXULWindow.cpp @@ -199,7 +199,7 @@ NS_IMETHODIMP nsXULWindow::SetPersistence(PRBool aPersistX, PRBool aPersistY, return NS_ERROR_FAILURE; nsAutoString persistString; - docShellElement->GetAttribute("persist", persistString); + docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("persist"), persistString); PRBool saveString = PR_FALSE; PRInt32 index; @@ -213,7 +213,7 @@ NS_IMETHODIMP nsXULWindow::SetPersistence(PRBool aPersistX, PRBool aPersistY, } else if(aPersistX && (index < 0 )) { - persistString.Append(" screenX"); + persistString.AppendWithConversion(" screenX"); saveString = PR_TRUE; } // Set Y @@ -225,7 +225,7 @@ NS_IMETHODIMP nsXULWindow::SetPersistence(PRBool aPersistX, PRBool aPersistY, } else if(aPersistY && (index < 0 )) { - persistString.Append(" screenY"); + persistString.AppendWithConversion(" screenY"); saveString = PR_TRUE; } // Set CX @@ -237,7 +237,7 @@ NS_IMETHODIMP nsXULWindow::SetPersistence(PRBool aPersistX, PRBool aPersistY, } else if(aPersistCX && (index < 0 )) { - persistString.Append(" width"); + persistString.AppendWithConversion(" width"); saveString = PR_TRUE; } // Set CY @@ -249,13 +249,13 @@ NS_IMETHODIMP nsXULWindow::SetPersistence(PRBool aPersistX, PRBool aPersistY, } else if(aPersistCY && (index < 0 )) { - persistString.Append(" height"); + persistString.AppendWithConversion(" height"); saveString = PR_TRUE; } index = persistString.Find("sizemode"); if (!aPersistSizeMode && index >= 0) { - persistString.Append(" sizemode"); + persistString.AppendWithConversion(" sizemode"); saveString = PR_TRUE; } else if (aPersistSizeMode && index < 0) { persistString.Cut(index, 8); @@ -263,7 +263,7 @@ NS_IMETHODIMP nsXULWindow::SetPersistence(PRBool aPersistX, PRBool aPersistY, } if(saveString) - docShellElement->SetAttribute("persist", persistString); + docShellElement->SetAttribute(NS_ConvertASCIItoUCS2("persist"), persistString); return NS_OK; } @@ -278,7 +278,7 @@ NS_IMETHODIMP nsXULWindow::GetPersistence(PRBool* aPersistX, PRBool* aPersistY, return NS_ERROR_FAILURE; nsAutoString persistString; - docShellElement->GetAttribute("persist", persistString); + docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("persist"), persistString); if(aPersistX) *aPersistX = persistString.Find("screenX") >= 0 ? PR_TRUE : PR_FALSE; @@ -779,13 +779,13 @@ NS_IMETHODIMP nsXULWindow::LoadPositionAndSizeFromXUL(PRBool aPosition, PRInt32 specY = curY; nsAutoString sizeString; - if(NS_SUCCEEDED(docShellElement->GetAttribute("screenX", sizeString))) + if(NS_SUCCEEDED(docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("screenX"), sizeString))) { temp = sizeString.ToInteger(&errorCode); if(NS_SUCCEEDED(errorCode) && temp > 0) specX = temp; } - if(NS_SUCCEEDED(docShellElement->GetAttribute("screenY", sizeString))) + if(NS_SUCCEEDED(docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("screenY"), sizeString))) { temp = sizeString.ToInteger(&errorCode); if(NS_SUCCEEDED(errorCode) && temp > 0) @@ -802,7 +802,7 @@ NS_IMETHODIMP nsXULWindow::LoadPositionAndSizeFromXUL(PRBool aPosition, PRInt32 specCY = curCY; nsAutoString sizeString; - if(NS_SUCCEEDED(docShellElement->GetAttribute("width", sizeString))) + if(NS_SUCCEEDED(docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("width"), sizeString))) { temp = sizeString.ToInteger(&errorCode); if(NS_SUCCEEDED(errorCode) && temp > 0) @@ -811,7 +811,7 @@ NS_IMETHODIMP nsXULWindow::LoadPositionAndSizeFromXUL(PRBool aPosition, mIntrinsicallySized = PR_FALSE; } } - if(NS_SUCCEEDED(docShellElement->GetAttribute("height", sizeString))) + if(NS_SUCCEEDED(docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("height"), sizeString))) { temp = sizeString.ToInteger(&errorCode); if(NS_SUCCEEDED(errorCode) && temp > 0) @@ -835,7 +835,7 @@ NS_IMETHODIMP nsXULWindow::LoadTitleFromXUL() NS_ENSURE_TRUE(docShellElement, NS_ERROR_FAILURE); nsAutoString windowTitle; - docShellElement->GetAttribute("title", windowTitle); + docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("title"), windowTitle); if(windowTitle.IsEmpty()) return NS_OK; @@ -871,7 +871,7 @@ NS_IMETHODIMP nsXULWindow::PersistPositionAndSize(PRBool aPosition, PRBool aSize difficult to distinguish between windows intrinsically sized and not. */ nsAutoString persistString; - docShellElement->GetAttribute("persist", persistString); + docShellElement->GetAttribute(NS_ConvertASCIItoUCS2("persist"), persistString); char sizeBuf[10]; nsAutoString sizeString; @@ -880,14 +880,14 @@ NS_IMETHODIMP nsXULWindow::PersistPositionAndSize(PRBool aPosition, PRBool aSize if(persistString.Find("screenX") >= 0) { PR_snprintf(sizeBuf, sizeof(sizeBuf), "%ld", (long)x); - sizeString = sizeBuf; - docShellElement->SetAttribute("screenX", sizeString); + sizeString.AssignWithConversion(sizeBuf); + docShellElement->SetAttribute(NS_ConvertASCIItoUCS2("screenX"), sizeString); } if(persistString.Find("screenY") >= 0) { PR_snprintf(sizeBuf, sizeof(sizeBuf), "%ld", (long)y); - sizeString = sizeBuf; - docShellElement->SetAttribute("screenY", sizeString); + sizeString.AssignWithConversion(sizeBuf); + docShellElement->SetAttribute(NS_ConvertASCIItoUCS2("screenY"), sizeString); } } @@ -896,14 +896,14 @@ NS_IMETHODIMP nsXULWindow::PersistPositionAndSize(PRBool aPosition, PRBool aSize if(persistString.Find("width") >= 0) { PR_snprintf(sizeBuf, sizeof(sizeBuf), "%ld", (long)cx); - sizeString = sizeBuf; - docShellElement->SetAttribute("width", sizeString); + sizeString.AssignWithConversion(sizeBuf); + docShellElement->SetAttribute(NS_ConvertASCIItoUCS2("width"), sizeString); } if(persistString.Find("height") >= 0) { PR_snprintf(sizeBuf, sizeof(sizeBuf), "%ld", (long)cy); - sizeString = sizeBuf; - docShellElement->SetAttribute("height", sizeString); + sizeString.AssignWithConversion(sizeBuf); + docShellElement->SetAttribute(NS_ConvertASCIItoUCS2("height"), sizeString); } } @@ -911,12 +911,12 @@ NS_IMETHODIMP nsXULWindow::PersistPositionAndSize(PRBool aPosition, PRBool aSize PRInt32 sizemode; if (NS_FAILED(mWindow->GetSizeMode(&sizemode))) sizemode = nsSizeMode_Normal; - sizeString = "n"; + sizeString.AssignWithConversion("n"); if (sizemode == nsSizeMode_Minimized) - sizeString = "m"; + sizeString.AssignWithConversion("m"); else if (sizemode == nsSizeMode_Maximized) - sizeString = "M"; - docShellElement->SetAttribute("sizemode", sizeString); + sizeString.AssignWithConversion("M"); + docShellElement->SetAttribute(NS_ConvertASCIItoUCS2("sizemode"), sizeString); } return NS_OK; @@ -988,7 +988,7 @@ NS_IMETHODIMP nsXULWindow::GetDOMElementById(char* aID, nsIDOMElement** aDOMElem if(!domdoc) return NS_ERROR_FAILURE; - NS_ENSURE_SUCCESS(domdoc->GetElementById(aID, aDOMElement), NS_ERROR_FAILURE); + NS_ENSURE_SUCCESS(domdoc->GetElementById(NS_ConvertASCIItoUCS2(aID), aDOMElement), NS_ERROR_FAILURE); return NS_OK; } @@ -1202,8 +1202,8 @@ NS_IMETHODIMP nsXULWindow::NotifyObservers(const PRUnichar* aTopic, nsCOMPtr removeme(do_QueryInterface(NS_STATIC_CAST(nsIXULWindow*, this))); - nsAutoString topic(prefix); - topic += ";"; + nsAutoString topic; topic.AssignWithConversion(prefix); + topic.AppendWithConversion(";"); topic += aTopic; NS_ENSURE_SUCCESS(service->Notify(removeme, topic.GetUnicode(), aData),