Fix some incorrect string usage and improve performance in a few places that show up in an LXR search for the previous pattern. b=232339 r=jshin sr=darin

This commit is contained in:
dbaron%dbaron.org 2004-02-03 18:23:41 +00:00
Родитель 5eae4fdb0e
Коммит 71a7773d75
9 изменённых файлов: 15 добавлений и 18 удалений

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

@ -397,7 +397,6 @@ void CNsIHistory::GetTitleHistTest(nsIHistoryEntry* theHistoryEntry,
PRInt16 displayMode)
{
nsXPIDLString theTitle;
const char * titleCString;
rv = theHistoryEntry->GetTitle(getter_Copies(theTitle));
RvTestResult(rv, "GetTitle() (title attribute) test", 1);
@ -407,9 +406,8 @@ void CNsIHistory::GetTitleHistTest(nsIHistoryEntry* theHistoryEntry,
return;
}
titleCString = NS_ConvertUCS2toUTF8(theTitle).get();
FormatAndPrintOutput("The title = ", (char *)titleCString, displayMode);
FormatAndPrintOutput("The title = ",
NS_ConvertUCS2toUTF8(theTitle).get(), displayMode);
}
void CNsIHistory::GetIsSubFrameTest(nsIHistoryEntry* theHistoryEntry,

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

@ -85,12 +85,12 @@ NS_IMETHODIMP nsDeviceContextSpecPh :: Init(nsIWidget* aWidget,
if( printer ) {
int res = 111;
const char *pname = NS_ConvertUCS2toUTF8(printer).get();
if( !strcmp( pname, "<Preview>" ) ) {
NS_ConvertUCS2toUTF8 pname(printer);
if( !strcmp( pname.get(), "<Preview>" ) ) {
char preview = 1;
PpSetPC( mPC, Pp_PC_DO_PREVIEW, &preview, 0 );
}
else res = PpLoadPrinter( mPC, pname );
else res = PpLoadPrinter( mPC, pname.get() );
}
else PpLoadDefaultPrinter( mPC );

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

@ -5030,11 +5030,11 @@ FFRESubstituteEncoding(nsACString &aFFREName,
nsFontXlib*
nsFontMetricsXlib::TryNodes(nsACString &aFFREName, PRUnichar aChar)
{
FIND_FONT_PRINTF((" TryNodes aFFREName = %s",
PromiseFlatCString(aFFREName).get()));
const char *FFREName = PromiseFlatCString(aFFREName).get();
const nsPromiseFlatCString& FFREName = PromiseFlatCString(aFFREName);
FIND_FONT_PRINTF((" TryNodes aFFREName = %s", FFREName.get()));
nsCStringKey key(FFREName);
PRBool anyFoundry = (FFREName[0] == '*');
PRBool anyFoundry = (FFREName.First() == '*');
nsFontNodeArrayXlib* nodes = (nsFontNodeArrayXlib*) mFontMetricsContext->mCachedFFRESearches.Get(&key);
if (!nodes) {
nsCAutoString pattern;

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

@ -349,8 +349,7 @@ nsresult nsAbLDAPProcessChangeLogData::ParseRootDSEEntry(nsILDAPMessage *aMessag
if (!PL_strcasecmp(attrs[i], "lastChangeNumber"))
mRootDSEEntry.lastChangeNumber = atol(NS_LossyConvertUCS2toASCII(vals[0]).get());
if (!PL_strcasecmp(attrs[i], "dataVersion"))
// XXX This needs CopyUCS2toUTF8
mRootDSEEntry.dataVersion = NS_ConvertUCS2toUTF8(vals[0]).get();
CopyUTF16toUTF8(vals[0], mRootDSEEntry.dataVersion);
}
}

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

@ -525,7 +525,7 @@ nsresult nsMsgDBFolder::ReadDBFolderInfo(PRBool force)
nsXPIDLCString utf8Name;
folderInfo->GetFolderName(getter_Copies(utf8Name));
if (!utf8Name.IsEmpty())
mName = NS_ConvertUTF8toUCS2(utf8Name.get());
CopyUTF8toUTF16(utf8Name, mName);
//These should be put in IMAP folder only.
//folderInfo->GetImapTotalPendingMessages(&mNumPendingTotalMessages);

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

@ -1015,7 +1015,7 @@ const char *nsImapIncomingServer::GetPFCName()
nsXPIDLString pfcName;
nsresult res = m_stringBundle->GetStringFromID(IMAP_PERSONAL_FILING_CABINET, getter_Copies(pfcName));
if (NS_SUCCEEDED(res))
m_pfcName = NS_ConvertUCS2toUTF8(pfcName).get();
CopyUTF16toUTF8(pfcName, m_pfcName);
}
m_readPFCName = PR_TRUE;
}

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

@ -1462,7 +1462,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::ReadFromFolderCacheElem(nsIMsgFolderCacheEle
nsXPIDLCString utf8Name;
rv = element->GetStringProperty("folderName", getter_Copies(utf8Name));
NS_ENSURE_SUCCESS(rv, rv);
mName = NS_ConvertUTF8toUCS2(utf8Name.get());
CopyUTF8toUTF16(utf8Name, mName);
return rv;
}

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

@ -1197,7 +1197,7 @@ nsProfileAccess::Get4xProfileInfo(nsIFile *registryFile, PRBool fromImport)
profileItem->updateProfileEntry = PR_TRUE;
profileItem->profileName = NS_ConvertASCIItoUCS2(unixProfileName).get();
CopyASCIItoUTF16(unixProfileName, profileItem->profileName);
nsCOMPtr<nsILocalFile> localFile;
rv = NS_NewNativeLocalFile(profileLocation, PR_TRUE, getter_AddRefs(localFile));

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

@ -192,7 +192,7 @@ GetDefaultOIDFormat(SECItem *oid,
val = 0;
}
outString = NS_ConvertASCIItoUCS2(buf).get();
CopyASCIItoUTF16(buf, outString);
return NS_OK;
}