зеркало из https://github.com/mozilla/pjs.git
making string conversions explicit
This commit is contained in:
Родитель
d5acc2d706
Коммит
a99318a97e
|
@ -219,7 +219,7 @@ nsDirectoryIndexStream::Read(char* aBuf, PRUint32 aCount, PRUint32* aReadCount)
|
|||
}
|
||||
|
||||
// The "content-length" field
|
||||
mBuf.Append(fileInfoSize, 10);
|
||||
mBuf.AppendWithConversion(fileInfoSize, 10);
|
||||
mBuf.Append(' ');
|
||||
|
||||
// The "last-modified" field
|
||||
|
|
|
@ -946,9 +946,10 @@ nsFileTransport::Process(void)
|
|||
}
|
||||
if (mProgress) {
|
||||
// XXX fix up this message for i18n
|
||||
nsAutoString msg = "Read ";
|
||||
nsAutoString msg;
|
||||
msg.AssignWithConversion("Read ");
|
||||
#ifdef PR_LOGGING
|
||||
msg += (const char*)mSpec;
|
||||
msg.AppendWithConversion(NS_STATIC_CAST(const char*, mSpec));
|
||||
#endif
|
||||
(void)mProgress->OnStatus(this, mContext, msg.GetUnicode());
|
||||
}
|
||||
|
@ -1090,9 +1091,10 @@ nsFileTransport::Process(void)
|
|||
}
|
||||
if (mProgress) {
|
||||
// XXX fix up this message for i18n
|
||||
nsAutoString msg = "Wrote ";
|
||||
nsAutoString msg;
|
||||
msg.AssignWithConversion("Wrote ");
|
||||
#ifdef PR_LOGGING
|
||||
msg += (const char*)mSpec;
|
||||
msg.AppendWithConversion(NS_STATIC_CAST(const char*, mSpec));
|
||||
#endif
|
||||
(void)mProgress->OnStatus(this, mContext, msg.GetUnicode());
|
||||
}
|
||||
|
|
|
@ -80,9 +80,10 @@ nsSimpleURI::GetSpec(char* *result)
|
|||
nsAutoString string;
|
||||
// NS_LOCK_INSTANCE();
|
||||
|
||||
string.Assign(mScheme);
|
||||
string.Append(':');
|
||||
string.Append(mPath);
|
||||
// STRING USE WARNING: perhaps |string| should be |nsCAutoString|? -- scc
|
||||
string.AssignWithConversion(mScheme);
|
||||
string.AppendWithConversion(':');
|
||||
string.AppendWithConversion(mPath);
|
||||
|
||||
// NS_UNLOCK_INSTANCE();
|
||||
*result = string.ToNewCString();
|
||||
|
@ -92,7 +93,9 @@ nsSimpleURI::GetSpec(char* *result)
|
|||
NS_IMETHODIMP
|
||||
nsSimpleURI::SetSpec(const char* aSpec)
|
||||
{
|
||||
nsAutoString spec(aSpec);
|
||||
nsAutoString spec;
|
||||
spec.AssignWithConversion(aSpec);
|
||||
|
||||
PRInt32 pos = spec.Find(":");
|
||||
if (pos == -1)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -2147,9 +2147,9 @@ nsSocketTransport::fireStatus(PRUint32 aCode)
|
|||
|
||||
nsAutoString mesg(tempmesg);
|
||||
if (mPrintHost)
|
||||
mesg.Append(mPrintHost);
|
||||
mesg.AppendWithConversion(mPrintHost);
|
||||
else
|
||||
mesg.Append(mHostName);
|
||||
mesg.AppendWithConversion(mHostName);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
@ -2210,7 +2210,8 @@ nsSocketTransport::GetSocketErrorString(PRUint32 iCode,
|
|||
case eSocketState_Created:
|
||||
case eSocketState_WaitDNS:
|
||||
{
|
||||
static nsAutoString mesg("Resolving host ");
|
||||
// STRING USE WARNING: this needs to be looked at -- scc
|
||||
static nsAutoString mesg; mesg.AssignWithConversion("Resolving host ");
|
||||
*oString = mesg.ToNewUnicode();
|
||||
if (!*oString) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = NS_OK;
|
||||
|
@ -2218,7 +2219,8 @@ nsSocketTransport::GetSocketErrorString(PRUint32 iCode,
|
|||
break;
|
||||
case eSocketState_Connected:
|
||||
{
|
||||
static nsAutoString mesg("Connected to ");
|
||||
// STRING USE WARNING: this needs to be looked at -- scc
|
||||
static nsAutoString mesg; mesg.AssignWithConversion("Connected to ");
|
||||
*oString = mesg.ToNewUnicode();
|
||||
if (!*oString) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = NS_OK;
|
||||
|
@ -2226,8 +2228,9 @@ nsSocketTransport::GetSocketErrorString(PRUint32 iCode,
|
|||
break;
|
||||
case eSocketState_WaitReadWrite:
|
||||
{
|
||||
static nsAutoString frommesg("Transferring data from ");
|
||||
static nsAutoString tomesg("Sending request to ");
|
||||
// STRING USE WARNING: this needs to be looked at -- scc
|
||||
static nsAutoString frommesg; frommesg.AssignWithConversion("Transferring data from ");
|
||||
static nsAutoString tomesg; tomesg.AssignWithConversion("Sending request to ");
|
||||
*oString = (mWriteContext == nsnull) ?
|
||||
frommesg.ToNewUnicode() : tomesg.ToNewUnicode();
|
||||
if (!*oString) return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
@ -2236,7 +2239,8 @@ nsSocketTransport::GetSocketErrorString(PRUint32 iCode,
|
|||
break;
|
||||
case eSocketState_WaitConnect:
|
||||
{
|
||||
static nsAutoString mesg("Connecting to ");
|
||||
// STRING USE WARNING: this needs to be looked at -- scc
|
||||
static nsAutoString mesg; mesg.AssignWithConversion("Connecting to ");
|
||||
*oString = mesg.ToNewUnicode();
|
||||
if (!*oString) return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = NS_OK;
|
||||
|
|
|
@ -132,7 +132,7 @@ nsNetDiskCache::~nsNetDiskCache()
|
|||
return;
|
||||
|
||||
|
||||
if( trash.Compare( filename, PR_FALSE, 5 ) == 0)
|
||||
if( trash.CompareWithConversion( filename, PR_FALSE, 5 ) == 0)
|
||||
file->Delete( PR_TRUE );
|
||||
|
||||
nsCRT::free(filename) ;
|
||||
|
@ -324,7 +324,9 @@ NS_IMPL_ISUPPORTS3(nsNetDiskCache,
|
|||
NS_IMETHODIMP
|
||||
nsNetDiskCache::GetDescription(PRUnichar* *aDescription)
|
||||
{
|
||||
nsAutoString description("Disk Cache") ;
|
||||
nsAutoString description ;
|
||||
description.AssignWithConversion("Disk Cache") ;
|
||||
|
||||
*aDescription = description.ToNewUnicode() ;
|
||||
if(!*aDescription)
|
||||
return NS_ERROR_OUT_OF_MEMORY ;
|
||||
|
|
|
@ -71,7 +71,9 @@ NS_IMPL_ISUPPORTS(nsMemCache, NS_GET_IID(nsINetDataCache))
|
|||
NS_IMETHODIMP
|
||||
nsMemCache::GetDescription(PRUnichar * *aDescription)
|
||||
{
|
||||
nsAutoString description("Memory Cache");
|
||||
nsAutoString description;
|
||||
description.AssignWithConversion("Memory Cache");
|
||||
|
||||
*aDescription = description.ToNewUnicode();
|
||||
if (!*aDescription)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -450,7 +450,7 @@ nsCachedNetData::Deserialize(PRBool aDeserializeFlags)
|
|||
nsAllocator::Free(metaData);
|
||||
|
||||
nsCOMPtr<nsISupports> stringStreamSupports;
|
||||
rv = NS_NewStringInputStream(getter_AddRefs(stringStreamSupports), metaDataCStr);
|
||||
rv = NS_NewCStringInputStream(getter_AddRefs(stringStreamSupports), metaDataCStr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCOMPtr<nsIInputStream> inputStream = do_QueryInterface(stringStreamSupports);
|
||||
|
|
|
@ -85,9 +85,11 @@ nsSocketProviderService::GetSocketProvider(const char *aSocketType, nsISocketPro
|
|||
|
||||
char buf[MAX_SOCKET_TYPE_PROGID_LENGTH];
|
||||
|
||||
nsAutoString progID(NS_NETWORK_SOCKET_PROGID_PREFIX);
|
||||
// STRING USE WARNING: perhaps |progID| should be an |nsCAutoString| -- scc
|
||||
nsAutoString progID;
|
||||
progID.AssignWithConversion(NS_NETWORK_SOCKET_PROGID_PREFIX);
|
||||
|
||||
progID += aSocketType;
|
||||
progID.AppendWithConversion(aSocketType);
|
||||
progID.ToCString(buf, MAX_SOCKET_TYPE_PROGID_LENGTH);
|
||||
|
||||
rv = nsServiceManager::GetService(buf, NS_GET_IID(nsISocketProvider), (nsISupports **)_result);
|
||||
|
|
Загрузка…
Ссылка в новой задаче