diff options
author | 2016-10-07 15:50:53 -0400 | |
---|---|---|
committer | 2018-05-18 15:06:24 +0000 | |
commit | 255ab8d9a55d68b7405280dae6b586d17e23cf71 (patch) | |
tree | 06625e0edb3314d6dff3d1cb2bf13d116b6cba3f /tools/skpinfo.cpp | |
parent | 8f8d481b44fc486e7190c6e2db8077226d53c969 (diff) |
Make SkStream readers report failure.
This also fixes an issue noticed while making this change where
SkFontDescriptor improperly round trips negative axis values.
Change-Id: Iacc5929a185659dcacc18c802c4908e4f34c6899
Reviewed-on: https://skia-review.googlesource.com/128341
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'tools/skpinfo.cpp')
-rw-r--r-- | tools/skpinfo.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/skpinfo.cpp b/tools/skpinfo.cpp index 865492d58c..93834bb3a8 100644 --- a/tools/skpinfo.cpp +++ b/tools/skpinfo.cpp @@ -65,7 +65,9 @@ int main(int argc, char** argv) { info.fCullRect.fRight, info.fCullRect.fBottom); } - if (!stream.readBool()) { + bool hasData; + if (!stream.readBool(&hasData)) { return kTruncatedFile; } + if (!hasData) { // If we read true there's a picture playback object flattened // in the file; if false, there isn't a playback, so we're done // reading the file. @@ -73,12 +75,14 @@ int main(int argc, char** argv) { } for (;;) { - uint32_t tag = stream.readU32(); + uint32_t tag; + if (!stream.readU32(&tag)) { return kTruncatedFile; } if (SK_PICT_EOF_TAG == tag) { break; } - uint32_t chunkSize = stream.readU32(); + uint32_t chunkSize; + if (!stream.readU32(&chunkSize)) { return kTruncatedFile; } size_t curPos = stream.getPosition(); // "move" doesn't error out when seeking beyond the end of file |