Index: src/core/SkStream.cpp |
diff --git a/src/core/SkStream.cpp b/src/core/SkStream.cpp |
index 9529308e8689ff135aa77e24dddb7639ec97a812..80628d452c79773515c2323f135f6e13aea98fb4 100644 |
--- a/src/core/SkStream.cpp |
+++ b/src/core/SkStream.cpp |
@@ -890,12 +890,9 @@ SkData* SkCopyStreamToData(SkStream* stream) { |
} |
SkDynamicMemoryWStream tempStream; |
- const size_t bufferSize = 4096; |
- char buffer[bufferSize]; |
- do { |
- size_t bytesRead = stream->read(buffer, bufferSize); |
- tempStream.write(buffer, bytesRead); |
- } while (!stream->isAtEnd()); |
+ if (!SkStreamCopy(&tempStream, stream)) { |
+ return nullptr; |
+ } |
return tempStream.copyToData(); |
} |