diff options
Diffstat (limited to 'tests/PDFGlyphsToUnicodeTest.cpp')
-rw-r--r-- | tests/PDFGlyphsToUnicodeTest.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/PDFGlyphsToUnicodeTest.cpp b/tests/PDFGlyphsToUnicodeTest.cpp index b3ee2d86f2..a256c93a8d 100644 --- a/tests/PDFGlyphsToUnicodeTest.cpp +++ b/tests/PDFGlyphsToUnicodeTest.cpp @@ -15,14 +15,19 @@ static const int kMaximumGlyphCount = SK_MaxU16 + 1; static bool stream_equals(const SkDynamicMemoryWStream& stream, size_t offset, const char* buffer, size_t len) { - sk_sp<SkData> data = stream.snapshotAsData(); - if (offset + len > data->size()) { + if (len != strlen(buffer)) { return false; } - if (len != strlen(buffer)) { + + const size_t streamSize = stream.bytesWritten(); + + if (offset + len > streamSize) { return false; } - return memcmp(data->bytes() + offset, buffer, len) == 0; + + SkAutoTMalloc<char> data(streamSize); + stream.copyTo(data.get()); + return memcmp(data.get() + offset, buffer, len) == 0; } DEF_TEST(SkPDF_ToUnicode, reporter) { |