Use nsAutoString instead of nsString for temps

This commit is contained in:
kipp%netscape.com 1999-09-02 18:13:07 +00:00
Родитель 2fcbf91285
Коммит 78bace2449
12 изменённых файлов: 41 добавлений и 35 удалений

Просмотреть файл

@ -2230,7 +2230,7 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
{
nsresult rv;
nsString2 urlStr = aURLSpec;
nsAutoString urlStr(aURLSpec);
#ifdef NECKO
CancelRefreshURITimers();
@ -4235,7 +4235,7 @@ nsWebShell::SetDefaultCharacterSet (const PRUnichar* aDefaultCharacterSet)
NS_IMETHODIMP
nsWebShell::GetForceCharacterSet (const PRUnichar** aForceCharacterSet)
{
nsString emptyStr = "";
nsAutoString emptyStr;
if (mForceCharacterSet.Equals(emptyStr)) {
*aForceCharacterSet = nsnull;
}
@ -4244,6 +4244,7 @@ nsWebShell::GetForceCharacterSet (const PRUnichar** aForceCharacterSet)
}
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::SetForceCharacterSet (const PRUnichar* aForceCharacterSet)
{

Просмотреть файл

@ -2659,12 +2659,12 @@ GlobalWindowImpl::SetProperty(JSContext *aContext, jsval aID, jsval *aVp)
{
PRBool result = PR_TRUE;
if (JS_TypeOfValue(aContext, *aVp) == JSTYPE_FUNCTION && JSVAL_IS_STRING(aID)) {
nsString mPropName;
nsAutoString mPrefix;
mPropName.SetString(JS_GetStringChars(JS_ValueToString(aContext, aID)));
mPrefix.SetString(mPropName.GetUnicode(), 2);
if (mPrefix == "on") {
result = CheckForEventListener(aContext, mPropName);
nsAutoString propName;
nsAutoString prefix;
propName.SetString(JS_GetStringChars(JS_ValueToString(aContext, aID)));
prefix.SetString(propName.GetUnicode(), 2);
if (prefix.EqualsIgnoreCase("on")) {
result = CheckForEventListener(aContext, propName);
}
}
else if (JSVAL_IS_STRING(aID)) {

Просмотреть файл

@ -441,7 +441,7 @@ eParseMode DetermineParseMode(nsParser& aParser) {
nsScanner* theScanner=aParser.GetScanner();
if(theScanner){
nsString theBufCopy;
nsAutoString theBufCopy;
nsString& theBuffer=theScanner->GetBuffer();
theBuffer.Left(theBufCopy,125);
theBufCopy.ToUpperCase();

Просмотреть файл

@ -586,7 +586,7 @@ nsStdURL::ReconstructSpec()
portBuffer[0] = '\0';
}
nsString finalSpec;
nsAutoString finalSpec;
if (mScheme)
{
finalSpec = mScheme;
@ -689,7 +689,7 @@ nsStdURL::SetDirectory(char* i_Directory)
if (mDirectory)
nsCRT::free(mDirectory);
nsString dir;
nsAutoString dir;
if ('/' != *i_Directory)
dir += "/";
@ -788,7 +788,7 @@ nsStdURL::ReconstructPath(void)
{
//Take all the elements of the path and construct it
if (mPath) nsCRT::free(mPath);
nsString path;
nsAutoString path;
if (mDirectory)
{
path = mDirectory;
@ -982,7 +982,7 @@ nsStdURL::DirFile(char **o_DirFile)
if (!o_DirFile)
return NS_ERROR_NULL_POINTER;
nsString temp;
nsAutoString temp;
if (mDirectory)
{
temp = mDirectory;

Просмотреть файл

@ -37,7 +37,7 @@ nsMIMEInfoImpl::~nsMIMEInfoImpl() {
PRBool
nsMIMEInfoImpl::InExtensions(nsIAtom* anIAtom) {
nsString2 extension;
nsAutoString extension;
anIAtom->ToString(extension);
// XXX this is broken. need to use gessner's tokenizer stuff to delimit the commas
@ -67,7 +67,7 @@ NS_IMETHODIMP
nsMIMEInfoImpl::GetMIMEType(char * *aMIMEType) {
if (!aMIMEType) return NS_ERROR_NULL_POINTER;
nsString2 strMIMEType;
nsAutoString strMIMEType;
mMIMEType->ToString(strMIMEType);
*aMIMEType = strMIMEType.ToNewCString();
if (!*aMIMEType) return NS_ERROR_OUT_OF_MEMORY;

Просмотреть файл

@ -221,7 +221,7 @@ NS_IMETHODIMP
nsMIMEService::GetTypeFromURI(nsIURI *aURI, char **aContentType) {
nsresult rv = NS_ERROR_FAILURE;
char *cStrSpec= nsnull;
nsString2 specStr;
nsAutoString specStr;
// first try to get a url out of the uri so we can skip post
// filename stuff (i.e. query string)
@ -240,7 +240,7 @@ nsMIMEService::GetTypeFromURI(nsIURI *aURI, char **aContentType) {
// find the file extension (if any)
specStr.SetString(cStrSpec);
nsAllocator::Free(cStrSpec);
nsString2 extStr;
nsAutoString extStr;
PRInt32 extLoc = specStr.RFindChar('.');
if (-1 != extLoc) {
specStr.Right(extStr, specStr.Length() - extLoc - 1);

Просмотреть файл

@ -441,7 +441,7 @@ eParseMode DetermineParseMode(nsParser& aParser) {
nsScanner* theScanner=aParser.GetScanner();
if(theScanner){
nsString theBufCopy;
nsAutoString theBufCopy;
nsString& theBuffer=theScanner->GetBuffer();
theBuffer.Left(theBufCopy,125);
theBufCopy.ToUpperCase();

Просмотреть файл

@ -37,7 +37,7 @@ nsMIMEInfoImpl::~nsMIMEInfoImpl() {
PRBool
nsMIMEInfoImpl::InExtensions(nsIAtom* anIAtom) {
nsString2 extension;
nsAutoString extension;
anIAtom->ToString(extension);
// XXX this is broken. need to use gessner's tokenizer stuff to delimit the commas
@ -67,7 +67,7 @@ NS_IMETHODIMP
nsMIMEInfoImpl::GetMIMEType(char * *aMIMEType) {
if (!aMIMEType) return NS_ERROR_NULL_POINTER;
nsString2 strMIMEType;
nsAutoString strMIMEType;
mMIMEType->ToString(strMIMEType);
*aMIMEType = strMIMEType.ToNewCString();
if (!*aMIMEType) return NS_ERROR_OUT_OF_MEMORY;

Просмотреть файл

@ -2230,7 +2230,7 @@ nsWebShell::LoadURL(const PRUnichar *aURLSpec,
{
nsresult rv;
nsString2 urlStr = aURLSpec;
nsAutoString urlStr(aURLSpec);
#ifdef NECKO
CancelRefreshURITimers();
@ -4235,7 +4235,7 @@ nsWebShell::SetDefaultCharacterSet (const PRUnichar* aDefaultCharacterSet)
NS_IMETHODIMP
nsWebShell::GetForceCharacterSet (const PRUnichar** aForceCharacterSet)
{
nsString emptyStr = "";
nsAutoString emptyStr;
if (mForceCharacterSet.Equals(emptyStr)) {
*aForceCharacterSet = nsnull;
}
@ -4244,6 +4244,7 @@ nsWebShell::GetForceCharacterSet (const PRUnichar** aForceCharacterSet)
}
return NS_OK;
}
NS_IMETHODIMP
nsWebShell::SetForceCharacterSet (const PRUnichar* aForceCharacterSet)
{

Просмотреть файл

@ -1325,7 +1325,8 @@ nsBrowserWindow::CreateToolBar(PRInt32 aWidth)
NS_CreateButton(mWindow,mBack,r,HandleBackEvent,&font);
if (NS_OK == mBack->QueryInterface(kIWidgetIID,(void**)&widget))
{
mBack->SetLabel("Back");
nsAutoString back("Back");
mBack->SetLabel(back);
NS_RELEASE(widget);
}
@ -1342,7 +1343,8 @@ nsBrowserWindow::CreateToolBar(PRInt32 aWidth)
widget->Create(mWindow, r, HandleForwardEvent, NULL);
widget->SetFont(font);
widget->Show(PR_TRUE);
mForward->SetLabel("Forward");
nsAutoString forward("Forward");
mForward->SetLabel(forward);
NS_RELEASE(widget);
}
@ -1363,7 +1365,8 @@ nsBrowserWindow::CreateToolBar(PRInt32 aWidth)
widget->SetForegroundColor(NS_RGB(0, 0, 0));
widget->SetBackgroundColor(NS_RGB(255, 255, 255));
PRUint32 size;
mLocation->SetText("",size);
nsAutoString empty;
mLocation->SetText(empty, size);
NS_RELEASE(widget);
}
@ -1697,7 +1700,7 @@ nsBrowserWindow::SetTitle(const PRUnichar* aTitle)
nsAutoString newTitle(aTitle);
//newTitle.Append(" - Raptor");
newTitle.Append(*gTitleSuffix);
mWindow->SetTitle(newTitle.GetUnicode());
mWindow->SetTitle(newTitle);
return NS_OK;
}
@ -1771,7 +1774,8 @@ nsBrowserWindow::BeginLoadURL(nsIWebShell* aShell, const PRUnichar* aURL)
if (mThrobber) {
mThrobber->Start();
PRUint32 size;
mLocation->SetText(aURL,size);
nsAutoString tmp(aURL);
mLocation->SetText(tmp,size);
}
}
return NS_OK;

Просмотреть файл

@ -284,9 +284,9 @@ NS_SetupRegistry()
NS_ASSERTION(rv == NS_OK,"Cannot obtain unix toolkit service.");
nsString unixToolkitName = "error";
nsString unixWidgetDllName = "error";
nsString unixGfxDllName = "error";
nsAutoString unixToolkitName("error");
nsAutoString unixWidgetDllName("error");
nsAutoString unixGfxDllName("error");
if (NS_OK == rv && nsnull != unixToolkitService)
{

Просмотреть файл

@ -118,8 +118,8 @@ nsUnixToolkitService::GetWidgetDllName(nsString & aWidgetDllNameOut)
// Set sWidgetDllName only once
if (nsnull == sWidgetDllName)
{
nsString name("");
nsString toolkit("");
nsAutoString name;
nsAutoString toolkit;
nsresult rv2 = GlobalGetToolkitName(toolkit);
@ -165,8 +165,8 @@ nsUnixToolkitService::GetGfxDllName(nsString & aGfxDllNameOut)
// Set sGfxDllName only once
if (nsnull == sGfxDllName)
{
nsString name("");
nsString toolkit("");
nsAutoString name;
nsAutoString toolkit;
nsresult rv2 = GlobalGetToolkitName(toolkit);
@ -223,7 +223,7 @@ nsUnixToolkitService::GetTimerCID(nsCID ** aTimerCIDOut)
if (nsnull == sTimerCID)
{
nsString unixToolkitName;
nsAutoString unixToolkitName;
GlobalGetToolkitName(unixToolkitName);