diff options
author | Lei Zhang <thestig@chromium.org> | 2018-07-25 17:35:18 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-25 17:35:18 +0000 |
commit | 5b322338073162afab98bb28c920692c73b995ed (patch) | |
tree | 87a3bcc964b484e4e6c8956d4d7aab465d9914f9 /core/fpdfapi/parser/cpdf_hint_tables_unittest.cpp | |
parent | 1b54bc1474af7923f6b82496924978cb87844ff0 (diff) | |
download | pdfium-5b322338073162afab98bb28c920692c73b995ed.tar.xz |
Move CPDF_SyntaxParser init methods into ctor.
- CPDF_SyntaxParser can no longer be initialized multiple times.
- Make the file length and header offset const.
- Make the header offset type FX_FILESIZE consistently.
- Simplify for the common case where the header offset is 0.
Change-Id: I7138db1fbcec3b7578b0239b92fc1154fa4dc4ce
Reviewed-on: https://pdfium-review.googlesource.com/38850
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_hint_tables_unittest.cpp')
-rw-r--r-- | core/fpdfapi/parser/cpdf_hint_tables_unittest.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/core/fpdfapi/parser/cpdf_hint_tables_unittest.cpp b/core/fpdfapi/parser/cpdf_hint_tables_unittest.cpp index 8a7331d29b..34c1694c59 100644 --- a/core/fpdfapi/parser/cpdf_hint_tables_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_hint_tables_unittest.cpp @@ -48,12 +48,9 @@ class TestLinearizedHeader : public CPDF_LinearizedHeader { static std::unique_ptr<CPDF_LinearizedHeader> MakeHeader( const std::string& inline_data) { - CPDF_SyntaxParser parser; - parser.InitParser( - pdfium::MakeRetain<CFX_BufferSeekableReadStream>( - reinterpret_cast<const unsigned char*>(inline_data.data()), - inline_data.size()), - 0); + CPDF_SyntaxParser parser(pdfium::MakeRetain<CFX_BufferSeekableReadStream>( + reinterpret_cast<const unsigned char*>(inline_data.data()), + inline_data.size())); std::unique_ptr<CPDF_Dictionary> dict = ToDictionary(parser.GetObjectBody(nullptr)); ASSERT(dict); @@ -161,8 +158,7 @@ TEST_F(CPDF_HintTablesTest, FirstPageOffset) { // This hint table is extracted from linearized file, generated by qpdf tool. RetainPtr<CPDF_ReadValidator> validator = MakeValidatorFromFile("hint_table_102p.bin"); - CPDF_SyntaxParser parser; - parser.InitParserWithValidator(validator, 0); + CPDF_SyntaxParser parser(validator, 0); std::unique_ptr<CPDF_Stream> stream = ToStream(parser.GetObjectBody(nullptr)); ASSERT_TRUE(stream); auto hint_tables = pdfium::MakeUnique<CPDF_HintTables>( |