зеркало из https://github.com/mozilla/gecko-dev.git
Bug 801483 - make nsBufferedInputStream::Init fallible. r=bsmith
This commit is contained in:
Родитель
7c9e895d6d
Коммит
3122b4a8f4
|
@ -359,15 +359,11 @@ DeviceStorageFile::Write(nsIInputStream* aInputStream)
|
|||
}
|
||||
|
||||
nsCOMPtr<nsIOutputStream> bufferedOutputStream;
|
||||
NS_NewBufferedOutputStream(getter_AddRefs(bufferedOutputStream),
|
||||
outputStream,
|
||||
4096*4);
|
||||
rv = NS_NewBufferedOutputStream(getter_AddRefs(bufferedOutputStream),
|
||||
outputStream,
|
||||
4096*4);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!bufferedOutputStream) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
rv = NS_OK;
|
||||
while (bufSize) {
|
||||
uint32_t wrote;
|
||||
rv = bufferedOutputStream->WriteFrom(aInputStream,
|
||||
|
|
|
@ -8116,6 +8116,7 @@ DumpToPNG(nsIPresShell* shell, nsAString& name) {
|
|||
nsCOMPtr<nsIOutputStream> bufferedOutputStream;
|
||||
rv = NS_NewBufferedOutputStream(getter_AddRefs(bufferedOutputStream),
|
||||
outputStream, length);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
uint32_t numWritten;
|
||||
rv = bufferedOutputStream->WriteFrom(encoder, length, &numWritten);
|
||||
|
|
|
@ -1033,7 +1033,7 @@ NS_BackgroundOutputStream(nsIOutputStream **result,
|
|||
return rv;
|
||||
}
|
||||
|
||||
inline nsresult
|
||||
MOZ_WARN_UNUSED_RESULT inline nsresult
|
||||
NS_NewBufferedInputStream(nsIInputStream **result,
|
||||
nsIInputStream *str,
|
||||
uint32_t bufferSize)
|
||||
|
|
|
@ -72,7 +72,8 @@ nsBufferedStream::Init(nsISupports* stream, uint32_t bufferSize)
|
|||
mBufferSize = bufferSize;
|
||||
mBufferStartOffset = 0;
|
||||
mCursor = 0;
|
||||
mBuffer = new char[bufferSize];
|
||||
const mozilla::fallible_t fallible = mozilla::fallible_t();
|
||||
mBuffer = new (fallible) char[bufferSize];
|
||||
if (mBuffer == nullptr)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
|
|
|
@ -1744,9 +1744,9 @@ nsOfflineCacheDevice::OpenOutputStreamForEntry(nsCacheEntry *entry,
|
|||
seekable->SetEOF();
|
||||
|
||||
nsCOMPtr<nsIOutputStream> bufferedOut;
|
||||
NS_NewBufferedOutputStream(getter_AddRefs(bufferedOut), out, 16 * 1024);
|
||||
if (!bufferedOut)
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
nsresult rv =
|
||||
NS_NewBufferedOutputStream(getter_AddRefs(bufferedOut), out, 16 * 1024);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
bufferedOut.swap(*result);
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче