bug 348669. Remove inappropriate nsCRT::free usage. r=timeless, sr=dbaron

This commit is contained in:
sayrer%gmail.com 2006-09-08 04:35:17 +00:00
Родитель b14d9525d2
Коммит c249dc7837
27 изменённых файлов: 51 добавлений и 52 удалений

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

@ -1783,7 +1783,7 @@ nsBookmarksService::getLocaleString(const char *key, nsString &str)
&& (keyUni))
{
str = keyUni;
nsCRT::free(keyUni);
NS_Free(keyUni);
}
else
{
@ -5099,7 +5099,7 @@ nsBookmarksService::WriteBookmarkIdAndName(nsIRDFDataSource *aDs,
rv |= aStrm->Write(kIDEquals, sizeof(kIDEquals)-1, &dummy);
rv |= aStrm->Write(escapedID, strlen(escapedID), &dummy);
rv |= aStrm->Write(kQuoteStr, sizeof(kQuoteStr)-1, &dummy);
nsCRT::free(escapedID);
NS_Free(escapedID);
}
}
@ -5131,7 +5131,7 @@ nsBookmarksService::WriteBookmarkIdAndName(nsIRDFDataSource *aDs,
if (escapedAttrib)
{
rv = aStrm->Write(escapedAttrib, strlen(escapedAttrib), &dummy);
nsCRT::free(escapedAttrib);
NS_Free(escapedAttrib);
}
return rv;
}
@ -5195,12 +5195,12 @@ nsBookmarksService::WriteBookmarkProperties(nsIRDFDataSource *aDs,
{
rv |= aStrm->Write(kQuoteStr, sizeof(kQuoteStr)-1, &dummy);
}
nsCRT::free(escapedAttrib);
NS_Free(escapedAttrib);
escapedAttrib = nsnull;
}
}
}
nsCRT::free(attribute);
NS_Free(attribute);
attribute = nsnull;
}
}

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

@ -59,7 +59,6 @@
#include "nsIStringBundle.h"
#include "nsISupportsArray.h"
#include "nsXPCOMCID.h"
#include "nsCRT.h"
#define MIGRATION_BUNDLE "chrome://browser/locale/migration/migration.properties"
@ -146,7 +145,7 @@ void GetMigrateDataFromArray(MigrationData* aDataArray, PRInt32 aDataArrayLength
if (exists)
*aResult |= cursor->sourceFlag;
}
nsCRT::free(cursor->fileName);
NS_Free(cursor->fileName);
cursor->fileName = nsnull;
}
}

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

@ -591,7 +591,7 @@ nsDogbertProfileMigrator::FixDogbertCookies()
// correct the expires field
char* expiresCString = ToNewCString(expiresString);
unsigned long expires = strtoul(expiresCString, nsnull, 10);
nsCRT::free(expiresCString);
NS_Free(expiresCString);
// if the cookie is supposed to expire at the end of the session
// expires == 0. don't adjust those cookies.

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

@ -435,7 +435,7 @@ nsOperaProfileMigrator::CopyPreferences(PRBool aReplace)
transform->prefSetterFunc(transform, branch);
}
if (colorString)
nsCRT::free(colorString);
free(colorString);
}
else {
nsCAutoString val;
@ -462,7 +462,7 @@ nsOperaProfileMigrator::CopyPreferences(PRBool aReplace)
transform->prefHasValue = PR_TRUE;
transform->prefSetterFunc(transform, branch);
if (transform->type == _OPM(STRING) && transform->stringValue) {
nsCRT::free(transform->stringValue);
NS_Free(transform->stringValue);
transform->stringValue = nsnull;
}
}

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

@ -301,7 +301,7 @@ GetNullTerminatedString(CFStringRef aStringRef)
void
FreeNullTerminatedString(char* aString)
{
nsCRT::free(aString);
free(aString);
aString = nsnull;
}

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

@ -570,7 +570,7 @@ nsSeamonkeyProfileMigrator::WriteFontsBranch(nsIPrefService* aPrefService,
switch (pref->type) {
case nsIPrefBranch::PREF_STRING:
rv = branch->SetCharPref(pref->prefName, pref->stringValue);
nsCRT::free(pref->stringValue);
PL_strfree(pref->stringValue);
pref->stringValue = nsnull;
break;
case nsIPrefBranch::PREF_BOOL:
@ -585,11 +585,11 @@ nsSeamonkeyProfileMigrator::WriteFontsBranch(nsIPrefService* aPrefService,
rv = branch->SetComplexValue(pref->prefName,
NS_GET_IID(nsIPrefLocalizedString),
pls);
nsCRT::free(pref->wstringValue);
NS_Free(pref->wstringValue);
pref->wstringValue = nsnull;
break;
}
nsCRT::free(pref->prefName);
NS_Free(pref->prefName);
pref->prefName = nsnull;
delete pref;
pref = nsnull;

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

@ -325,7 +325,7 @@ nsListCommand::GetCurrentState(nsIEditor *aEditor, const char* aTagName,
aParams->SetBooleanValue(STATE_ALL, !bMixed && inList);
aParams->SetBooleanValue(STATE_MIXED, bMixed);
aParams->SetBooleanValue(STATE_ENABLED, PR_TRUE);
if (tagStr) nsCRT::free(tagStr);
if (tagStr) NS_Free(tagStr);
return NS_OK;
}
@ -429,7 +429,7 @@ nsListItemCommand::ToggleState(nsIEditor *aEditor, const char* aTagName)
{
rv = htmlEditor->RemoveList(nsDependentString(tagStr));
}
nsCRT::free(tagStr);
NS_Free(tagStr);
}
}
else
@ -465,7 +465,7 @@ nsRemoveListCommand::IsCommandEnabled(const char * aCommandName,
*outCmdEnabled = bMixed ? PR_TRUE : (tagStr && *tagStr);
if (tagStr) nsCRT::free(tagStr);
if (tagStr) NS_Free(tagStr);
}
else
*outCmdEnabled = PR_FALSE;

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

@ -100,7 +100,7 @@ ChangeCSSInlineStyleTxn::ValueIncludes(const nsAString &aValueList, const nsAStr
}
start = ++end;
}
nsCRT::free(value);
NS_Free(value);
return result;
}

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

@ -102,8 +102,8 @@ NS_IMETHODIMP DeleteElementTxn::DoTransaction(void)
if (gNoisy)
printf(" DeleteElementTxn: deleting child %s from parent %s\n", c, p);
nsCRT::free(c);
nsCRT::free(p);
NS_Free(c);
NS_Free(p);
}
// end debug output
#endif
@ -147,8 +147,8 @@ NS_IMETHODIMP DeleteElementTxn::UndoTransaction(void)
if (gNoisy)
printf(" DeleteElementTxn: inserting child %s back into parent %s\n", c, p);
nsCRT::free(c);
nsCRT::free(p);
NS_Free(c);
NS_Free(p);
}
// end debug output
#endif

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

@ -1389,7 +1389,7 @@ NS_IMETHODIMP nsHTMLEditor::InsertFromTransferable(nsITransferable *transferable
rv = NS_ERROR_NOT_IMPLEMENTED; // for now give error code
}
}
nsCRT::free(bestFlavor);
NS_Free(bestFlavor);
// Try to scroll the selection into view if the paste/drop succeeded
if (NS_SUCCEEDED(rv))
@ -2055,7 +2055,7 @@ NS_IMETHODIMP nsHTMLEditor::PasteAsPlaintextQuotation(PRInt32 aSelectionType)
rv = InsertAsPlaintextQuotation(stuffToPaste, PR_TRUE, 0);
}
}
nsCRT::free(flav);
NS_Free(flav);
}
return rv;
@ -2670,7 +2670,7 @@ void nsHTMLEditor::FreeTagStackStrings(nsVoidArray &tagStack)
{
PRUnichar* str = (PRUnichar*)tagStack.ElementAt(i);
if (str) {
nsCRT::free(str);
NS_Free(str);
}
}
}

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

@ -131,7 +131,7 @@ NS_IMETHODIMP nsPlaintextEditor::InsertTextFromTransferable(nsITransferable *aTr
rv = InsertTextAt(stuffToPaste, aDestinationNode, aDestOffset, aDoDeleteSelection);
}
}
nsCRT::free(bestFlavor);
NS_Free(bestFlavor);
// Try to scroll the selection into view if the paste/drop succeeded
if (NS_SUCCEEDED(rv))

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

@ -1328,7 +1328,7 @@ nsPlaintextEditor::PasteAsQuotation(PRInt32 aSelectionType)
rv = InsertAsQuotation(stuffToPaste, 0);
}
}
nsCRT::free(flav);
NS_Free(flav);
}
return rv;

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

@ -528,7 +528,7 @@ nsIsIndexFrame::URLEncode(const nsString& aString, nsIUnicodeEncoder* encoder, n
char* outBuf = nsEscape(convertedBuf, url_XPAlphas);
oString.AssignASCII(outBuf);
nsCRT::free(outBuf);
nsMemory::Free(outBuf);
nsMemory::Free(convertedBuf);
}

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

@ -323,7 +323,7 @@ void Area::ParseCoords(const nsAString& aSpec)
char* cp = ToNewCString(aSpec);
if (cp) {
mCoords = lo_parse_coord_list(cp, &mNumCoords);
nsCRT::free(cp);
NS_Free(cp);
}
}

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

@ -1594,7 +1594,7 @@ nsPluginInstanceOwner::~nsPluginInstanceOwner()
}
if (mTagText) {
nsCRT::free(mTagText);
NS_Free(mTagText);
mTagText = nsnull;
}

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

@ -139,7 +139,7 @@ nsPrintData::~nsPrintData()
}
if (mBrandName) {
nsCRT::free(mBrandName);
NS_Free(mBrandName);
}
for (PRInt32 i=0;i<mPrintProgressListeners.Count();i++) {

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

@ -2937,7 +2937,7 @@ NS_IMETHODIMP nsPluginHostImpl::PostURL(nsISupports* pluginInst,
(const char*)dataToPost, isFile, postDataLen,
postHeaders, postHeadersLength);
if (isFile) {
nsCRT::free(dataToPost);
NS_Free(dataToPost);
}
}

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

@ -240,7 +240,7 @@ nsGopherDirListingConv::DigestBufferLines(char* aBuffer, nsCAutoString& aString)
return nsnull;
}
desc = escName;
nsCRT::free(escName);
NS_Free(escName);
PL_strfree(descStr);
} else {
desc = "%20";
@ -260,7 +260,7 @@ nsGopherDirListingConv::DigestBufferLines(char* aBuffer, nsCAutoString& aString)
return nsnull;
}
selector = escName;
nsCRT::free(escName);
NS_Free(escName);
PL_strfree(sel);
line = tabPos+1;
tabPos = PL_strchr(line,'\t');

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

@ -1845,7 +1845,7 @@ PutCookieLine(nsOutputFileStream &strm, const nsString& aLine)
while (*p) {
strm.put(*(p++));
}
nsCRT::free(cp);
NS_Free(cp);
// the lines in a 5.x cookie file call end with '\n', on all platforms
strm.put('\n');
return NS_OK;
@ -1911,7 +1911,7 @@ Fix4xCookies(nsIFileSpec * profilePath) {
/* correct the expires field */
char * expiresCString = ToNewCString(expiresString);
unsigned long expires = strtoul(expiresCString, nsnull, 10);
nsCRT::free(expiresCString);
NS_Free(expiresCString);
/* if the cookie is supposed to expire at the end of the session
* expires == 0. don't adjust those cookies.

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

@ -1028,7 +1028,7 @@ InMemoryDataSource::LogOperation(const char* aOperation,
PR_LogPrint
(" -->(\"%s\")\n", valueCStr);
nsCRT::free(valueCStr);
NS_Free(valueCStr);
}
else {
PR_LogPrint

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

@ -510,7 +510,7 @@ RDFContentSinkImpl::HandleEndElement(const PRUnichar *aName)
("rdfxml: extra close tag '%s' at line %d",
tagCStr, 0/*XXX fix me */);
nsCRT::free(tagCStr);
NS_Free(tagCStr);
}
#endif

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

@ -2044,10 +2044,10 @@ nsCrypto::ImportUserCertificates(const nsAString& aNickname,
}
aReturn.Assign(NS_ConvertASCIItoUTF16(retString));
if (nickname) {
nsCRT::free(nickname);
NS_Free(nickname);
}
if (cmmfResponse) {
nsCRT::free(cmmfResponse);
NS_Free(cmmfResponse);
}
if (certRepContent) {
CMMF_DestroyCertRepContent(certRepContent);

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

@ -317,7 +317,7 @@ nsClipboard :: SetNativeClipboardData ( PRInt32 aWhichClipboard )
const char* mapping = theMapper.ExportMapping(&mappingLen);
if ( mapping && mappingLen ) {
errCode = PutOnClipboard ( nsMimeMapperMac::MappingFlavor(), mapping, mappingLen );
nsCRT::free ( NS_CONST_CAST(char*, mapping) );
nsMemory::Free ( NS_CONST_CAST(char*, mapping) );
}
return errCode;
@ -395,7 +395,7 @@ nsClipboard :: GetNativeClipboardData ( nsITransferable * aTransferable, PRInt32
errCode = GetDataOffClipboard ( nsMimeMapperMac::MappingFlavor(), (void**)&mimeMapperData, 0 );
nsMimeMapperMac theMapper ( mimeMapperData );
if (mimeMapperData)
nsCRT::free ( mimeMapperData );
nsMemory::Free ( mimeMapperData );
// Now walk down the list of flavors. When we find one that is actually on the
// clipboard, copy out the data into the transferable in that format. SetTransferData()

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

@ -486,7 +486,7 @@ nsDragService::RegisterDragItemsAndFlavors(nsISupportsArray* inArray, RgnHandle
if ( mapping && mappingLen ) {
::AddDragItemFlavor ( mDragRef, itemIndex, nsMimeMapperMac::MappingFlavor(),
mapping, mappingLen, flags );
nsCRT::free ( mapping );
nsMemory::Free ( mapping );
::SetDragItemBounds(mDragRef, itemIndex, &dragRgnBounds);
}
@ -527,7 +527,7 @@ nsDragService::GetData ( nsITransferable * aTransferable, PRUint32 aItemIndex )
// create a mime mapper to help us out based on data in a special flavor for this item
char* mappings = LookupMimeMappingsForItem(mDragRef, itemRef);
nsMimeMapperMac theMapper ( mappings );
nsCRT::free ( mappings );
nsMemory::Free ( mappings );
// Now walk down the list of flavors. When we find one that is actually present,
// copy out the data into the transferable in that format. SetTransferData()

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

@ -289,7 +289,7 @@ nsMimeMapperMac::ExportMapping ( short * outLength ) const
strcat(posInString, currMapping);
posInString += strlen(currMapping); // advance marker to get ready for next mapping
}
nsCRT::free ( mimeType );
nsMemory::Free ( mimeType );
nsCRT::free ( currMapping );
}

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

@ -249,7 +249,7 @@ public:
printf("########## PageCycler loaded (%d ms): %s\n",
PR_IntervalToMilliseconds(PR_IntervalNow() - mIntervalTime),
dataStr);
nsCRT::free(dataStr);
NS_Free(dataStr);
nsAutoString url;
rv = GetNextURL(url);
@ -283,7 +283,7 @@ public:
else {
char* dataStr = ToNewCString(data);
printf("########## PageCycler possible failure for: %s\n", dataStr);
nsCRT::free(dataStr);
NS_Free(dataStr);
}
return rv;
}

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

@ -1780,7 +1780,7 @@ nsBookmarksService::getLocaleString(const char *key, nsString &str)
&& (keyUni))
{
str = keyUni;
nsCRT::free(keyUni);
NS_Free(keyUni);
}
else
{
@ -5605,7 +5605,7 @@ nsBookmarksService::WriteBookmarksContainer(nsIRDFDataSource *ds,
if (escapedAttrib)
{
rv |= strm->Write(escapedAttrib, strlen(escapedAttrib), &dummy);
nsCRT::free(escapedAttrib);
NS_Free(escapedAttrib);
}
}
rv |= strm->Write(kCloseH3, sizeof(kCloseH3)-1, &dummy);
@ -5705,7 +5705,7 @@ nsBookmarksService::WriteBookmarksContainer(nsIRDFDataSource *ds,
rv |= strm->Write(escapedAttrib,
strlen(escapedAttrib),
&dummy);
nsCRT::free(escapedAttrib);
NS_Free(escapedAttrib);
escapedAttrib = nsnull;
}
}
@ -5884,7 +5884,7 @@ nsBookmarksService::WriteBookmarkProperties(nsIRDFDataSource *ds,
rv |= strm->Write(escapedAttrib, strlen(escapedAttrib), &dummy);
rv |= strm->Write(kNL, sizeof(kNL)-1, &dummy);
nsCRT::free(escapedAttrib);
NS_Free(escapedAttrib);
escapedAttrib = nsnull;
}
}
@ -5895,7 +5895,7 @@ nsBookmarksService::WriteBookmarkProperties(nsIRDFDataSource *ds,
rv |= strm->Write(attribute, strlen(attribute), &dummy);
rv |= strm->Write(kQuoteStr, sizeof(kQuoteStr)-1, &dummy);
}
nsCRT::free(attribute);
NS_Free(attribute);
attribute = nsnull;
}
}