Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1092)

Unified Diff: src/core/SkStream.cpp

Issue 1640793002: Consolidate SkStream copying methods (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698