summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_edit_embeddertest.cpp
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2018-06-06 12:31:18 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-06 12:31:18 +0000
commiteababa10789bc0d73a325291e2854090ee3896cd (patch)
tree67bb315c3e405c622c9fac40f0f473b4ec2b8fc1 /fpdfsdk/fpdf_edit_embeddertest.cpp
parentc22d671728605bc614dc84ec6a42a5647808b30d (diff)
downloadpdfium-eababa10789bc0d73a325291e2854090ee3896cd.tar.xz
Use CPDF_StreamAcc to data access of CPDF_Stream.
Change-Id: I68b88e013ac542f245dbe7b6889799c814d46eb8 Reviewed-on: https://pdfium-review.googlesource.com/33690 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_edit_embeddertest.cpp')
-rw-r--r--fpdfsdk/fpdf_edit_embeddertest.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index b2a7c32153..f339a82336 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -13,6 +13,7 @@
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_number.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
+#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "core/fxcrt/fx_system.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
#include "public/cpp/fpdf_scopers.h"
@@ -74,14 +75,18 @@ class FPDFEditEmbeddertest : public EmbedderTest {
EXPECT_TRUE(font_desc->KeyExist(present));
EXPECT_FALSE(font_desc->KeyExist(absent));
+ auto streamAcc =
+ pdfium::MakeRetain<CPDF_StreamAcc>(font_desc->GetStreamFor(present));
+ streamAcc->LoadAllDataRaw();
+
// Check that the font stream is the one that was provided
- const CPDF_Stream* font_stream = font_desc->GetStreamFor(present);
- ASSERT_EQ(size, font_stream->GetRawSize());
+ ASSERT_EQ(size, streamAcc->GetSize());
if (font_type == FPDF_FONT_TRUETYPE) {
ASSERT_EQ(static_cast<int>(size),
- font_stream->GetDict()->GetIntegerFor("Length1"));
+ streamAcc->GetDict()->GetIntegerFor("Length1"));
}
- uint8_t* stream_data = font_stream->GetRawData();
+
+ const uint8_t* stream_data = streamAcc->GetData();
for (size_t j = 0; j < size; j++)
EXPECT_EQ(data[j], stream_data[j]) << " at byte " << j;
}