Bug 737164 part B - use fallible or infallible strings appropriately in necko, r=jduell

--HG--
extra : rebase_source : 5fbaa24f4483a3f0b9ffdcd96669133af0b92d56
This commit is contained in:
Benjamin Smedberg 2012-05-08 13:55:19 -04:00
Родитель c19ee28084
Коммит ee61cfb21d
2 изменённых файлов: 6 добавлений и 6 удалений

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

@ -75,14 +75,12 @@ NS_IMETHODIMP nsNetAddr::GetAddress(nsACString & aAddress)
switch(mAddr.raw.family) {
/* PR_NetAddrToString can handle INET and INET6, but not LOCAL. */
case PR_AF_INET:
if(!aAddress.SetCapacity(16))
return NS_ERROR_OUT_OF_MEMORY;
aAddress.SetCapacity(16);
PR_NetAddrToString(&mAddr, aAddress.BeginWriting(), 16);
aAddress.SetLength(strlen(aAddress.BeginReading()));
break;
case PR_AF_INET6:
if(!aAddress.SetCapacity(46))
return NS_ERROR_OUT_OF_MEMORY;
aAddress.SetCapacity(46);
PR_NetAddrToString(&mAddr, aAddress.BeginWriting(), 46);
aAddress.SetLength(strlen(aAddress.BeginReading()));
break;

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

@ -43,6 +43,8 @@
#define SNIFFING_BUFFER_SIZE 512 // specified in draft-abarth-mime-sniff-06
using mozilla::fallible_t;
NS_IMETHODIMP
nsUnicharStreamLoader::Init(nsIUnicharStreamLoaderObserver *aObserver)
{
@ -50,7 +52,7 @@ nsUnicharStreamLoader::Init(nsIUnicharStreamLoaderObserver *aObserver)
mObserver = aObserver;
if (!mRawData.SetCapacity(SNIFFING_BUFFER_SIZE))
if (!mRawData.SetCapacity(SNIFFING_BUFFER_SIZE, fallible_t()))
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
@ -237,7 +239,7 @@ nsUnicharStreamLoader::WriteSegmentFun(nsIInputStream *,
self->mDecoder->GetMaxLength(aSegment + consumed, srcLen, &dstLen);
PRUint32 capacity = haveRead + dstLen;
if (!self->mBuffer.SetCapacity(capacity)) {
if (!self->mBuffer.SetCapacity(capacity, fallible_t())) {
return NS_ERROR_OUT_OF_MEMORY;
}