Bug 1415508 - use Span in constructing a byte input stream; r=mayhemer

Differential Revision: https://phabricator.services.mozilla.com/D20687

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Alex Gaynor 2019-02-25 19:11:20 +00:00
Родитель 01800513e9
Коммит 0e903787da
27 изменённых файлов: 73 добавлений и 58 удалений

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

@ -87,8 +87,8 @@ already_AddRefed<Document> DOMParser::ParseFromString(const nsAString& aStr,
// The new stream holds a reference to the buffer // The new stream holds a reference to the buffer
nsCOMPtr<nsIInputStream> stream; nsCOMPtr<nsIInputStream> stream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream), utf8str.get(), nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream), utf8str,
utf8str.Length(), NS_ASSIGNMENT_DEPEND); NS_ASSIGNMENT_DEPEND);
if (NS_WARN_IF(NS_FAILED(rv))) { if (NS_WARN_IF(NS_FAILED(rv))) {
aRv.Throw(rv); aRv.Throw(rv);
return nullptr; return nullptr;
@ -111,8 +111,9 @@ already_AddRefed<Document> DOMParser::ParseFromBuffer(Span<const uint8_t> aBuf,
// The new stream holds a reference to the buffer // The new stream holds a reference to the buffer
nsCOMPtr<nsIInputStream> stream; nsCOMPtr<nsIInputStream> stream;
nsresult rv = NS_NewByteInputStream( nsresult rv = NS_NewByteInputStream(
getter_AddRefs(stream), reinterpret_cast<const char*>(aBuf.Elements()), getter_AddRefs(stream),
aBuf.Length(), NS_ASSIGNMENT_DEPEND); MakeSpan(reinterpret_cast<const char*>(aBuf.Elements()), aBuf.Length()),
NS_ASSIGNMENT_DEPEND);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
aRv.Throw(rv); aRv.Throw(rv);
return nullptr; return nullptr;

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

@ -1508,7 +1508,8 @@ void DataTransfer::FillInExternalCustomTypes(nsIVariant* aData, uint32_t aIndex,
} }
nsCOMPtr<nsIInputStream> stringStream; nsCOMPtr<nsIInputStream> stringStream;
NS_NewByteInputStream(getter_AddRefs(stringStream), chrs, checkedLen.value(), NS_NewByteInputStream(getter_AddRefs(stringStream),
MakeSpan(chrs, checkedLen.value()),
NS_ASSIGNMENT_ADOPT); NS_ASSIGNMENT_ADOPT);
nsCOMPtr<nsIObjectInputStream> stream = NS_NewObjectInputStream(stringStream); nsCOMPtr<nsIObjectInputStream> stream = NS_NewObjectInputStream(stringStream);

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

@ -32,8 +32,8 @@ static nsresult GetBufferDataAsStream(
const char* data = reinterpret_cast<const char*>(aData); const char* data = reinterpret_cast<const char*>(aData);
nsCOMPtr<nsIInputStream> stream; nsCOMPtr<nsIInputStream> stream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream), data, aDataLength, nsresult rv = NS_NewByteInputStream(
NS_ASSIGNMENT_COPY); getter_AddRefs(stream), MakeSpan(data, aDataLength), NS_ASSIGNMENT_COPY);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
stream.forget(aResult); stream.forget(aResult);

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

@ -36,7 +36,7 @@ nsresult MemoryBlobImpl::DataOwnerAdapter::Create(DataOwner* aDataOwner,
rv = NS_NewByteInputStream( rv = NS_NewByteInputStream(
getter_AddRefs(stream), getter_AddRefs(stream),
static_cast<const char*>(aDataOwner->mData) + aStart, (int32_t)aLength, MakeSpan(static_cast<const char*>(aDataOwner->mData) + aStart, aLength),
NS_ASSIGNMENT_DEPEND); NS_ASSIGNMENT_DEPEND);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);

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

@ -289,7 +289,8 @@ nsresult nsJSThunk::EvaluateScript(
} }
aChannel->SetContentCharset(*charset); aChannel->SetContentCharset(*charset);
if (bytes) if (bytes)
rv = NS_NewByteInputStream(getter_AddRefs(mInnerStream), bytes, bytesLen, rv = NS_NewByteInputStream(getter_AddRefs(mInnerStream),
mozilla::MakeSpan(bytes, bytesLen),
NS_ASSIGNMENT_ADOPT); NS_ASSIGNMENT_ADOPT);
else else
rv = NS_ERROR_OUT_OF_MEMORY; rv = NS_ERROR_OUT_OF_MEMORY;

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

@ -1542,8 +1542,8 @@ nsresult XMLHttpRequestMainThread::StreamReaderFunc(
// to the parser, because calling ReadSegments() recursively on the same // to the parser, because calling ReadSegments() recursively on the same
// stream is not supported. // stream is not supported.
nsCOMPtr<nsIInputStream> copyStream; nsCOMPtr<nsIInputStream> copyStream;
rv = NS_NewByteInputStream(getter_AddRefs(copyStream), fromRawSegment, rv = NS_NewByteInputStream(getter_AddRefs(copyStream),
count); MakeSpan(fromRawSegment, count));
if (NS_SUCCEEDED(rv) && xmlHttpRequest->mXMLParserStreamListener) { if (NS_SUCCEEDED(rv) && xmlHttpRequest->mXMLParserStreamListener) {
NS_ASSERTION(copyStream, "NS_NewByteInputStream lied"); NS_ASSERTION(copyStream, "NS_NewByteInputStream lied");

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

@ -293,9 +293,10 @@ gfxSVGGlyphsDocument::~gfxSVGGlyphsDocument() {
static nsresult CreateBufferedStream(const uint8_t *aBuffer, uint32_t aBufLen, static nsresult CreateBufferedStream(const uint8_t *aBuffer, uint32_t aBufLen,
nsCOMPtr<nsIInputStream> &aResult) { nsCOMPtr<nsIInputStream> &aResult) {
nsCOMPtr<nsIInputStream> stream; nsCOMPtr<nsIInputStream> stream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream), nsresult rv = NS_NewByteInputStream(
reinterpret_cast<const char *>(aBuffer), getter_AddRefs(stream),
aBufLen, NS_ASSIGNMENT_DEPEND); MakeSpan(reinterpret_cast<const char *>(aBuffer), aBufLen),
NS_ASSIGNMENT_DEPEND);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIInputStream> aBufferedStream; nsCOMPtr<nsIInputStream> aBufferedStream;

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

@ -213,8 +213,8 @@ imgTools::DecodeImageFromBuffer(const char* aBuffer, uint32_t aSize,
// Let's create a temporary inputStream. // Let's create a temporary inputStream.
nsCOMPtr<nsIInputStream> stream; nsCOMPtr<nsIInputStream> stream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream), aBuffer, aSize, nsresult rv = NS_NewByteInputStream(
NS_ASSIGNMENT_DEPEND); getter_AddRefs(stream), MakeSpan(aBuffer, aSize), NS_ASSIGNMENT_DEPEND);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
MOZ_ASSERT(stream); MOZ_ASSERT(stream);
MOZ_ASSERT(NS_InputStreamIsBuffered(stream)); MOZ_ASSERT(NS_InputStreamIsBuffered(stream));

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

@ -159,8 +159,8 @@ nsresult nsDeflateConverter::PushAvailableData(nsIRequest *aRequest,
MOZ_ASSERT(bytesToWrite <= INT32_MAX); MOZ_ASSERT(bytesToWrite <= INT32_MAX);
nsCOMPtr<nsIInputStream> stream; nsCOMPtr<nsIInputStream> stream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream), nsresult rv = NS_NewByteInputStream(
(char *)mWriteBuffer, bytesToWrite); getter_AddRefs(stream), MakeSpan((char *)mWriteBuffer, bytesToWrite));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
rv = mListener->OnDataAvailable(aRequest, mContext, stream, mOffset, rv = mListener->OnDataAvailable(aRequest, mContext, stream, mOffset,

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

@ -120,7 +120,8 @@ nsresult nsZipDataStream::ProcessData(nsIRequest *aRequest,
MOZ_ASSERT(aCount <= INT32_MAX); MOZ_ASSERT(aCount <= INT32_MAX);
nsCOMPtr<nsIInputStream> stream; nsCOMPtr<nsIInputStream> stream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream), aBuffer, aCount); nsresult rv =
NS_NewByteInputStream(getter_AddRefs(stream), MakeSpan(aBuffer, aCount));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
rv = mOutput->OnDataAvailable(aRequest, aContext, stream, aOffset, aCount); rv = mOutput->OnDataAvailable(aRequest, aContext, stream, aOffset, aCount);

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

@ -422,8 +422,9 @@ void FTPChannelChild::DoOnDataAvailable(const nsresult& channelStatus,
// support only reading part of the data, allowing later calls to read the // support only reading part of the data, allowing later calls to read the
// rest. // rest.
nsCOMPtr<nsIInputStream> stringStream; nsCOMPtr<nsIInputStream> stringStream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stringStream), data.get(), nsresult rv =
count, NS_ASSIGNMENT_DEPEND); NS_NewByteInputStream(getter_AddRefs(stringStream),
MakeSpan(data).To(count), NS_ASSIGNMENT_DEPEND);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
Cancel(rv); Cancel(rv);
return; return;

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

@ -260,8 +260,9 @@ void FTPChannelParent::DivertOnDataAvailable(const nsCString& data,
} }
nsCOMPtr<nsIInputStream> stringStream; nsCOMPtr<nsIInputStream> stringStream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stringStream), data.get(), nsresult rv =
count, NS_ASSIGNMENT_DEPEND); NS_NewByteInputStream(getter_AddRefs(stringStream),
MakeSpan(data).To(count), NS_ASSIGNMENT_DEPEND);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
if (mChannel) { if (mChannel) {
mChannel->Cancel(rv); mChannel->Cancel(rv);

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

@ -847,8 +847,9 @@ void HttpChannelChild::OnTransportAndData(const nsresult& channelStatus,
// support only reading part of the data, allowing later calls to read the // support only reading part of the data, allowing later calls to read the
// rest. // rest.
nsCOMPtr<nsIInputStream> stringStream; nsCOMPtr<nsIInputStream> stringStream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stringStream), data.get(), nsresult rv =
count, NS_ASSIGNMENT_DEPEND); NS_NewByteInputStream(getter_AddRefs(stringStream),
MakeSpan(data).To(count), NS_ASSIGNMENT_DEPEND);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
Cancel(rv); Cancel(rv);
return; return;

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

@ -1078,8 +1078,9 @@ void HttpChannelParent::DivertOnDataAvailable(const nsCString& data,
} }
nsCOMPtr<nsIInputStream> stringStream; nsCOMPtr<nsIInputStream> stringStream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stringStream), data.get(), nsresult rv =
count, NS_ASSIGNMENT_DEPEND); NS_NewByteInputStream(getter_AddRefs(stringStream),
MakeSpan(data).To(count), NS_ASSIGNMENT_DEPEND);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
if (mChannel) { if (mChannel) {
mChannel->Cancel(rv); mChannel->Cancel(rv);

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

@ -378,8 +378,7 @@ nsresult nsHttpTransaction::Init(
// a non-owning reference to the request header data, so we MUST keep // a non-owning reference to the request header data, so we MUST keep
// mReqHeaderBuf around). // mReqHeaderBuf around).
nsCOMPtr<nsIInputStream> headers; nsCOMPtr<nsIInputStream> headers;
rv = NS_NewByteInputStream(getter_AddRefs(headers), mReqHeaderBuf.get(), rv = NS_NewByteInputStream(getter_AddRefs(headers), mReqHeaderBuf);
mReqHeaderBuf.Length());
if (NS_FAILED(rv)) return rv; if (NS_FAILED(rv)) return rv;
mHasRequestBody = !!requestBody; mHasRequestBody = !!requestBody;

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

@ -225,8 +225,8 @@ void WyciwygChannelChild::OnDataAvailable(const nsCString& data,
// support only reading part of the data, allowing later calls to read the // support only reading part of the data, allowing later calls to read the
// rest. // rest.
nsCOMPtr<nsIInputStream> stringStream; nsCOMPtr<nsIInputStream> stringStream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stringStream), data.get(), nsresult rv = NS_NewByteInputStream(getter_AddRefs(stringStream), data,
data.Length(), NS_ASSIGNMENT_DEPEND); NS_ASSIGNMENT_DEPEND);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
Cancel(rv); Cancel(rv);
return; return;

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

@ -279,9 +279,10 @@ OCSPRequest::Run() {
} }
nsCOMPtr<nsIInputStream> uploadStream; nsCOMPtr<nsIInputStream> uploadStream;
rv = NS_NewByteInputStream(getter_AddRefs(uploadStream), rv = NS_NewByteInputStream(
reinterpret_cast<const char*>(mPOSTData.begin()), getter_AddRefs(uploadStream),
mPOSTData.length()); MakeSpan(reinterpret_cast<const char*>(mPOSTData.begin()),
mPOSTData.length()));
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return NotifyDone(rv, lock); return NotifyDone(rv, lock);
} }

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

@ -22,8 +22,9 @@ namespace scache {
nsresult NewObjectInputStreamFromBuffer(UniquePtr<char[]> buffer, uint32_t len, nsresult NewObjectInputStreamFromBuffer(UniquePtr<char[]> buffer, uint32_t len,
nsIObjectInputStream **stream) { nsIObjectInputStream **stream) {
nsCOMPtr<nsIInputStream> stringStream; nsCOMPtr<nsIInputStream> stringStream;
nsresult rv = NS_NewByteInputStream( nsresult rv = NS_NewByteInputStream(getter_AddRefs(stringStream),
getter_AddRefs(stringStream), buffer.release(), len, NS_ASSIGNMENT_ADOPT); MakeSpan(buffer.release(), len),
NS_ASSIGNMENT_ADOPT);
MOZ_ALWAYS_SUCCEEDS(rv); MOZ_ALWAYS_SUCCEEDS(rv);
nsCOMPtr<nsIObjectInputStream> objectInput = nsCOMPtr<nsIObjectInputStream> objectInput =

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

@ -358,9 +358,9 @@ nsresult StreamFilterParent::Write(Data& aData) {
AssertIsIOThread(); AssertIsIOThread();
nsCOMPtr<nsIInputStream> stream; nsCOMPtr<nsIInputStream> stream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream), nsresult rv = NS_NewByteInputStream(
reinterpret_cast<char*>(aData.Elements()), getter_AddRefs(stream),
aData.Length()); MakeSpan(reinterpret_cast<char*>(aData.Elements()), aData.Length()));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
rv = mOrigListener->OnDataAvailable(mChannel, mContext, stream, mOffset, rv = mOrigListener->OnDataAvailable(mChannel, mContext, stream, mOffset,

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

@ -1224,8 +1224,8 @@ nsresult FetchAndConvertUnsupportedPayloads::ConvertPayload(
// Convert the payload to an input stream. // Convert the payload to an input stream.
nsCOMPtr<nsIInputStream> stream; nsCOMPtr<nsIInputStream> stream;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream), aPayload.get(), nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream), aPayload,
aPayload.Length(), NS_ASSIGNMENT_DEPEND); NS_ASSIGNMENT_DEPEND);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
// Decode the input stream to a surface. // Decode the input stream to a surface.

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

@ -66,9 +66,9 @@ void afl_interface_stream(const char* testFile, FuzzingTestFuncStream testFunc);
static int LibFuzzerTest##moduleName(const uint8_t* data, size_t size) { \ static int LibFuzzerTest##moduleName(const uint8_t* data, size_t size) { \
if (size > INT32_MAX) return 0; \ if (size > INT32_MAX) return 0; \
nsCOMPtr<nsIInputStream> stream; \ nsCOMPtr<nsIInputStream> stream; \
nsresult rv = \ nsresult rv = NS_NewByteInputStream(getter_AddRefs(stream), \
NS_NewByteInputStream(getter_AddRefs(stream), (const char*)data, \ MakeSpan((const char*)data, size), \
size, NS_ASSIGNMENT_DEPEND); \ NS_ASSIGNMENT_DEPEND); \
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); \ MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); \
testFunc(stream.forget()); \ testFunc(stream.forget()); \
return 0; \ return 0; \

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

@ -151,8 +151,9 @@ mozilla::ipc::IPCResult ExternalHelperAppParent::RecvOnDataAvailable(
MOZ_ASSERT(mPending, "must be pending!"); MOZ_ASSERT(mPending, "must be pending!");
nsCOMPtr<nsIInputStream> stringStream; nsCOMPtr<nsIInputStream> stringStream;
DebugOnly<nsresult> rv = NS_NewByteInputStream( DebugOnly<nsresult> rv =
getter_AddRefs(stringStream), data.get(), count, NS_ASSIGNMENT_DEPEND); NS_NewByteInputStream(getter_AddRefs(stringStream),
MakeSpan(data).To(count), NS_ASSIGNMENT_DEPEND);
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create dependent string!"); NS_ASSERTION(NS_SUCCEEDED(rv), "failed to create dependent string!");
mStatus = mStatus =
mListener->OnDataAvailable(this, nullptr, stringStream, offset, count); mListener->OnDataAvailable(this, nullptr, stringStream, offset, count);

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

@ -287,8 +287,10 @@ nsresult nsClipboard::TransferableFromPasteboard(nsITransferable* aTransferable,
if (successfullyConverted) { if (successfullyConverted) {
// Put the converted data in a form Gecko can understand // Put the converted data in a form Gecko can understand
nsCOMPtr<nsIInputStream> byteStream; nsCOMPtr<nsIInputStream> byteStream;
NS_NewByteInputStream(getter_AddRefs(byteStream), (const char*)[encodedData bytes], NS_NewByteInputStream(
[encodedData length], NS_ASSIGNMENT_COPY); getter_AddRefs(byteStream),
mozilla::MakeSpan((const char*)[encodedData bytes], [encodedData length]),
NS_ASSIGNMENT_COPY);
aTransferable->SetTransferData(flavorStr.get(), byteStream); aTransferable->SetTransferData(flavorStr.get(), byteStream);
} }

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

@ -244,8 +244,9 @@ nsClipboard::GetData(nsITransferable *aTransferable, int32_t aWhichClipboard) {
if (!clipboardData) continue; if (!clipboardData) continue;
nsCOMPtr<nsIInputStream> byteStream; nsCOMPtr<nsIInputStream> byteStream;
NS_NewByteInputStream(getter_AddRefs(byteStream), clipboardData, NS_NewByteInputStream(getter_AddRefs(byteStream),
clipboardDataLength, NS_ASSIGNMENT_COPY); MakeSpan(clipboardData, clipboardDataLength),
NS_ASSIGNMENT_COPY);
aTransferable->SetTransferData(flavorStr.get(), byteStream); aTransferable->SetTransferData(flavorStr.get(), byteStream);
mContext->ReleaseClipboardData(clipboardData); mContext->ReleaseClipboardData(clipboardData);

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

@ -444,7 +444,7 @@ nsStringInputStream::Clone(nsIInputStream** aCloneOut) {
} }
nsresult NS_NewByteInputStream(nsIInputStream** aStreamResult, nsresult NS_NewByteInputStream(nsIInputStream** aStreamResult,
const char* aStringToRead, int32_t aLength, Span<const char> aStringToRead,
nsAssignmentType aAssignment) { nsAssignmentType aAssignment) {
MOZ_ASSERT(aStreamResult, "null out ptr"); MOZ_ASSERT(aStreamResult, "null out ptr");
@ -453,13 +453,14 @@ nsresult NS_NewByteInputStream(nsIInputStream** aStreamResult,
nsresult rv; nsresult rv;
switch (aAssignment) { switch (aAssignment) {
case NS_ASSIGNMENT_COPY: case NS_ASSIGNMENT_COPY:
rv = stream->SetData(aStringToRead, aLength); rv = stream->SetData(aStringToRead.Elements(), aStringToRead.Length());
break; break;
case NS_ASSIGNMENT_DEPEND: case NS_ASSIGNMENT_DEPEND:
rv = stream->ShareData(aStringToRead, aLength); rv = stream->ShareData(aStringToRead.Elements(), aStringToRead.Length());
break; break;
case NS_ASSIGNMENT_ADOPT: case NS_ASSIGNMENT_ADOPT:
rv = stream->AdoptData(const_cast<char*>(aStringToRead), aLength); rv = stream->AdoptData(const_cast<char*>(aStringToRead.Elements()),
aStringToRead.Length());
break; break;
default: default:
NS_ERROR("invalid assignment type"); NS_ERROR("invalid assignment type");

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

@ -48,8 +48,8 @@
* determined by scanning the buffer for the first null byte. * determined by scanning the buffer for the first null byte.
*/ */
extern nsresult NS_NewByteInputStream( extern nsresult NS_NewByteInputStream(
nsIInputStream** aStreamResult, const char* aStringToRead, nsIInputStream** aStreamResult, mozilla::Span<const char> aStringToRead,
int32_t aLength = -1, nsAssignmentType aAssignment = NS_ASSIGNMENT_DEPEND); nsAssignmentType aAssignment = NS_ASSIGNMENT_DEPEND);
/** /**
* Factory method to get an nsInputStream from an nsACString. Result will * Factory method to get an nsInputStream from an nsACString. Result will

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

@ -84,8 +84,8 @@ static void TestCompressUncompress(uint32_t aNumBytes) {
static void TestUncompressCorrupt(const char* aCorruptData, static void TestUncompressCorrupt(const char* aCorruptData,
uint32_t aCorruptLength) { uint32_t aCorruptLength) {
nsCOMPtr<nsIInputStream> source; nsCOMPtr<nsIInputStream> source;
nsresult rv = NS_NewByteInputStream(getter_AddRefs(source), aCorruptData, nsresult rv = NS_NewByteInputStream(getter_AddRefs(source),
aCorruptLength); MakeSpan(aCorruptData, aCorruptLength));
ASSERT_TRUE(NS_SUCCEEDED(rv)); ASSERT_TRUE(NS_SUCCEEDED(rv));
nsCOMPtr<nsIInputStream> uncompress = new SnappyUncompressInputStream(source); nsCOMPtr<nsIInputStream> uncompress = new SnappyUncompressInputStream(source);