mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 901820 - Part 1. replace nsCRT::strdup with strdup. r=bsmedberg
This commit is contained in:
parent
071ff6dbcc
commit
9d06ff2f05
@ -131,7 +131,7 @@ nsresult nsCollationOS2::AllocateRawSortKey(int32_t strength,
|
||||
if (uLen < iBufferLength) {
|
||||
// Success!
|
||||
// Give 'em the real size in bytes...
|
||||
*key = (uint8_t *)nsCRT::strdup((PRUnichar*) pLocalBuffer);
|
||||
*key = (uint8_t *)NS_strdup((PRUnichar*) pLocalBuffer);
|
||||
*outLen = uLen * 2 + 2;
|
||||
res = NS_OK;
|
||||
}
|
||||
|
@ -771,7 +771,7 @@ nsStringBundleService::FormatStatusMessage(nsresult aStatus,
|
||||
|
||||
// XXX hack for mailnews who has already formatted their messages:
|
||||
if (aStatus == NS_OK && aStatusArg) {
|
||||
*result = nsCRT::strdup(aStatusArg);
|
||||
*result = NS_strdup(aStatusArg);
|
||||
NS_ENSURE_TRUE(*result, NS_ERROR_OUT_OF_MEMORY);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ nsSaveAsCharset::GetCharset(char * *aCharset)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*aCharset = nsCRT::strdup(charset);
|
||||
*aCharset = strdup(charset);
|
||||
return (*aCharset) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,9 @@ nsStandardURL::~nsStandardURL()
|
||||
{
|
||||
LOG(("Destroying nsStandardURL @%p\n", this));
|
||||
|
||||
CRTFREEIF(mHostA);
|
||||
if (mHostA) {
|
||||
free(mHostA);
|
||||
}
|
||||
#ifdef DEBUG_DUMP_URLS_AT_SHUTDOWN
|
||||
PR_REMOVE_LINK(&mDebugCList);
|
||||
#endif
|
||||
@ -375,7 +377,10 @@ nsStandardURL::InvalidateCache(bool invalidateCachedFile)
|
||||
{
|
||||
if (invalidateCachedFile)
|
||||
mFile = 0;
|
||||
CRTFREEIF(mHostA);
|
||||
if (mHostA) {
|
||||
free(mHostA);
|
||||
mHostA = nullptr;
|
||||
}
|
||||
mSpecEncoding = eEncoding_Unknown;
|
||||
}
|
||||
|
||||
@ -1743,7 +1748,7 @@ nsStandardURL::CloneInternal(nsStandardURL::RefHandlingEnum refHandlingMode,
|
||||
clone->mURLType = mURLType;
|
||||
clone->mParser = mParser;
|
||||
clone->mFile = mFile;
|
||||
clone->mHostA = mHostA ? nsCRT::strdup(mHostA) : nullptr;
|
||||
clone->mHostA = mHostA ? strdup(mHostA) : nullptr;
|
||||
clone->mMutable = true;
|
||||
clone->mSupportsFileURL = mSupportsFileURL;
|
||||
clone->mHostEncoding = mHostEncoding;
|
||||
|
@ -169,7 +169,7 @@ nsHttpAuthCache::SetAuthEntry(const char *scheme,
|
||||
if (NS_FAILED(rv))
|
||||
delete node;
|
||||
else
|
||||
PL_HashTableAdd(mDB, nsCRT::strdup(key.get()), node);
|
||||
PL_HashTableAdd(mDB, strdup(key.get()), node);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ nsHttpAuthCache::FreeEntry(void *self, PLHashEntry *he, unsigned flag)
|
||||
else if (flag == HT_FREE_ENTRY) {
|
||||
// three wonderful flavors of freeing memory ;-)
|
||||
delete (nsHttpAuthNode *) he->value;
|
||||
nsCRT::free((char *) he->key);
|
||||
free((char *) he->key);
|
||||
free(he);
|
||||
}
|
||||
}
|
||||
|
@ -1421,7 +1421,7 @@ PrepareAcceptLanguages(const char *i_AcceptLanguages, nsACString &o_AcceptLangua
|
||||
const char *comma;
|
||||
int32_t available;
|
||||
|
||||
o_Accept = nsCRT::strdup(i_AcceptLanguages);
|
||||
o_Accept = strdup(i_AcceptLanguages);
|
||||
if (!o_Accept)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
for (p = o_Accept, n = size = 0; '\0' != *p; p++) {
|
||||
@ -1432,7 +1432,7 @@ PrepareAcceptLanguages(const char *i_AcceptLanguages, nsACString &o_AcceptLangua
|
||||
available = size + ++n * 11 + 1;
|
||||
q_Accept = new char[available];
|
||||
if (!q_Accept) {
|
||||
nsCRT::free(o_Accept);
|
||||
free(o_Accept);
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
*q_Accept = '\0';
|
||||
@ -1479,7 +1479,7 @@ PrepareAcceptLanguages(const char *i_AcceptLanguages, nsACString &o_AcceptLangua
|
||||
MOZ_ASSERT(available > 0, "allocated string not long enough");
|
||||
}
|
||||
}
|
||||
nsCRT::free(o_Accept);
|
||||
free(o_Accept);
|
||||
|
||||
o_AcceptLanguages.Assign((const char *) q_Accept);
|
||||
delete [] q_Accept;
|
||||
|
@ -1347,7 +1347,7 @@ mozTXTToHTMLConv::ScanTXT(const PRUnichar *text, uint32_t whattodo,
|
||||
// need to reallocate and re-copy the characters already in the out String.
|
||||
NS_ASSERTION(inLength, "ScanTXT passed 0 length string");
|
||||
if (inLength == 0) {
|
||||
*_retval = nsCRT::strdup(text);
|
||||
*_retval = NS_strdup(text);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -87,14 +87,14 @@ TestOpenInputStream(const char* url)
|
||||
rv = uri->GetSpec(&str);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
fprintf(stdout, "%s resolved to ", str);
|
||||
nsCRT::free(str);
|
||||
free(str);
|
||||
|
||||
rv = channel->GetURI(getter_AddRefs(uri));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = uri->GetSpec(&str);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
fprintf(stdout, "%s\n", str);
|
||||
nsCRT::free(str);
|
||||
free(str);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -123,7 +123,7 @@ public:
|
||||
rv = uri->GetSpec(&str);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
fprintf(stdout, "Starting to load %s\n", str);
|
||||
nsCRT::free(str);
|
||||
free(str);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
@ -141,7 +141,7 @@ public:
|
||||
rv = uri->GetSpec(&str);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
fprintf(stdout, "Ending load %s, status=%x\n", str, aStatus);
|
||||
nsCRT::free(str);
|
||||
free(str);
|
||||
}
|
||||
}
|
||||
gDone = true;
|
||||
|
@ -122,7 +122,7 @@ DecodeCert(const char *value, nsIX509Cert ** _retval)
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCRT::free((char*)data);
|
||||
free((char*)data);
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -244,7 +244,7 @@ SendMessage(const char *msg, const char *base64Cert, char ** _retval)
|
||||
rv = encode(output.data, output.len, _retval);
|
||||
|
||||
done:
|
||||
if (certDER) nsCRT::free((char *)certDER);
|
||||
if (certDER) free((char *)certDER);
|
||||
if (cert) CERT_DestroyCertificate(cert);
|
||||
if (cmsMsg) NSS_CMSMessage_Destroy(cmsMsg);
|
||||
if (arena) PORT_FreeArena(arena, false); /* false? */
|
||||
|
@ -724,7 +724,7 @@ nsKeygenFormProcessor::GetPublicKey(nsAString& aValue, nsAString& aChallenge,
|
||||
}
|
||||
|
||||
CopyASCIItoUTF16(keystring, aOutPublicKey);
|
||||
nsCRT::free(keystring);
|
||||
free(keystring);
|
||||
|
||||
rv = NS_OK;
|
||||
loser:
|
||||
|
@ -734,7 +734,7 @@ nsPKCS12Blob::nickname_collision(SECItem *oldNick, PRBool *cancel, void *wincx)
|
||||
return nullptr;
|
||||
|
||||
newNick->type = siAsciiString;
|
||||
newNick->data = (unsigned char*) nsCRT::strdup(nickname.get());
|
||||
newNick->data = (unsigned char*) strdup(nickname.get());
|
||||
newNick->len = strlen((char*)newNick->data);
|
||||
return newNick;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ nsUserInfo::GetUsername(char * *aUsername)
|
||||
printf("username = %s\n", pw->pw_name);
|
||||
#endif
|
||||
|
||||
*aUsername = nsCRT::strdup(pw->pw_name);
|
||||
*aUsername = strdup(pw->pw_name);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -117,7 +117,7 @@ nsUserInfo::GetDomain(char * *aDomain)
|
||||
#endif
|
||||
|
||||
if (domainname && domainname[0]) {
|
||||
*aDomain = nsCRT::strdup(domainname);
|
||||
*aDomain = strdup(domainname);
|
||||
rv = NS_OK;
|
||||
}
|
||||
else {
|
||||
@ -128,7 +128,7 @@ nsUserInfo::GetDomain(char * *aDomain)
|
||||
// if the nodename is foo.bar.org, use bar.org as the domain
|
||||
char *pos = strchr(buf.nodename,'.');
|
||||
if (pos) {
|
||||
*aDomain = nsCRT::strdup(pos+1);
|
||||
*aDomain = strdup(pos+1);
|
||||
rv = NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -1459,7 +1459,7 @@ nsDragService::SourceDataGet(GtkWidget *aWidget,
|
||||
|
||||
PR_LOG(sDragLm, PR_LOG_DEBUG, ("Type is %s\n", typeName));
|
||||
// make a copy since |nsXPIDLCString| won't use |g_free|...
|
||||
mimeFlavor.Adopt(nsCRT::strdup(typeName));
|
||||
mimeFlavor.Adopt(strdup(typeName));
|
||||
g_free(typeName);
|
||||
// check to make sure that we have data items to return.
|
||||
if (!mSourceDataItems) {
|
||||
|
@ -401,21 +401,21 @@ NS_IMETHODIMP nsDeviceContextSpecWin::Init(nsIWidget* aWidget,
|
||||
if (!aIsPrintPreview) {
|
||||
rv = CheckForPrintToFile(mPrintSettings, deviceName, nullptr);
|
||||
if (NS_FAILED(rv)) {
|
||||
nsCRT::free(deviceName);
|
||||
nsCRT::free(driverName);
|
||||
free(deviceName);
|
||||
free(driverName);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
// clean up
|
||||
nsCRT::free(deviceName);
|
||||
nsCRT::free(driverName);
|
||||
free(deviceName);
|
||||
free(driverName);
|
||||
|
||||
return NS_OK;
|
||||
} else {
|
||||
PR_PL(("***** nsDeviceContextSpecWin::Init - deviceName/driverName/devMode was NULL!\n"));
|
||||
if (deviceName) nsCRT::free(deviceName);
|
||||
if (driverName) nsCRT::free(driverName);
|
||||
if (deviceName) free(deviceName);
|
||||
if (driverName) free(driverName);
|
||||
if (devMode) ::HeapFree(::GetProcessHeap(), 0, devMode);
|
||||
}
|
||||
}
|
||||
|
@ -132,11 +132,11 @@ nsPrintSettingsWin& nsPrintSettingsWin::operator=(const nsPrintSettingsWin& rhs)
|
||||
((nsPrintSettings&) *this) = rhs;
|
||||
|
||||
if (mDeviceName) {
|
||||
nsCRT::free(mDeviceName);
|
||||
free(mDeviceName);
|
||||
}
|
||||
|
||||
if (mDriverName) {
|
||||
nsCRT::free(mDriverName);
|
||||
free(mDriverName);
|
||||
}
|
||||
|
||||
// Use free because we used the native malloc to create the memory
|
||||
|
@ -51,7 +51,7 @@ uint32_t GetDataForFlavor (const nsTArray<DataStruct>& aArray,
|
||||
//-------------------------------------------------------------------------
|
||||
DataStruct::~DataStruct()
|
||||
{
|
||||
if (mCacheFileName) nsCRT::free(mCacheFileName);
|
||||
if (mCacheFileName) free(mCacheFileName);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@ -133,7 +133,7 @@ DataStruct::WriteCache(nsISupports* aData, uint32_t aDataLen)
|
||||
if (!mCacheFileName) {
|
||||
nsXPIDLCString fName;
|
||||
cacheFile->GetNativeLeafName(fName);
|
||||
mCacheFileName = nsCRT::strdup(fName);
|
||||
mCacheFileName = strdup(fName);
|
||||
}
|
||||
|
||||
// write out the contents of the clipboard
|
||||
|
@ -185,8 +185,7 @@ static void
|
||||
TypesToLogFreeEntry(void *pool, PLHashEntry *he, unsigned flag)
|
||||
{
|
||||
if (flag == HT_FREE_ENTRY) {
|
||||
nsCRT::free(const_cast<char*>
|
||||
(reinterpret_cast<const char*>(he->key)));
|
||||
free(const_cast<char*>(reinterpret_cast<const char*>(he->key)));
|
||||
PR_Free(he);
|
||||
}
|
||||
}
|
||||
@ -758,7 +757,7 @@ static void InitTraceLog(void)
|
||||
if (cm) {
|
||||
*cm = '\0';
|
||||
}
|
||||
PL_HashTableAdd(gTypesToLog, nsCRT::strdup(cp), (void*)1);
|
||||
PL_HashTableAdd(gTypesToLog, strdup(cp), (void*)1);
|
||||
fprintf(stdout, "%s ", cp);
|
||||
if (!cm) break;
|
||||
*cm = ',';
|
||||
|
@ -70,7 +70,7 @@ GetKeysEnumerate(const char *key, nsISupports* data,
|
||||
void *arg)
|
||||
{
|
||||
GetKeysEnumData *gkedp = (GetKeysEnumData *)arg;
|
||||
gkedp->keys[gkedp->next] = nsCRT::strdup(key);
|
||||
gkedp->keys[gkedp->next] = strdup(key);
|
||||
|
||||
if (!gkedp->keys[gkedp->next]) {
|
||||
gkedp->res = NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -705,7 +705,7 @@ void nsHTTPIndex::GetDestination(nsIRDFResource* r, nsXPIDLCString& dest) {
|
||||
if (!url) {
|
||||
const char* temp;
|
||||
r->GetValueConst(&temp);
|
||||
dest.Adopt(temp ? nsCRT::strdup(temp) : 0);
|
||||
dest.Adopt(temp ? strdup(temp) : 0);
|
||||
} else {
|
||||
const PRUnichar* uri;
|
||||
url->GetValueConst(&uri);
|
||||
@ -756,7 +756,7 @@ nsHTTPIndex::GetURI(char * *uri)
|
||||
if (! uri)
|
||||
return(NS_ERROR_NULL_POINTER);
|
||||
|
||||
if ((*uri = nsCRT::strdup("rdf:httpindex")) == nullptr)
|
||||
if ((*uri = strdup("rdf:httpindex")) == nullptr)
|
||||
return(NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
return(NS_OK);
|
||||
|
Loading…
Reference in New Issue
Block a user