From 5b322338073162afab98bb28c920692c73b995ed Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 25 Jul 2018 17:35:18 +0000 Subject: 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 Commit-Queue: Lei Zhang --- core/fpdfapi/parser/cpdf_parser_unittest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/fpdfapi/parser/cpdf_parser_unittest.cpp') diff --git a/core/fpdfapi/parser/cpdf_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_parser_unittest.cpp index 4ce1238ee3..2e7e06066b 100644 --- a/core/fpdfapi/parser/cpdf_parser_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_parser_unittest.cpp @@ -42,15 +42,15 @@ class CPDF_TestParser : public CPDF_Parser { return false; // For the test file, the header is set at the beginning. - m_pSyntax->InitParser(pFileAccess, 0); + m_pSyntax = pdfium::MakeUnique(pFileAccess); return true; } // Setup reading from a buffer and initial states. bool InitTestFromBufferWithOffset(const unsigned char* buffer, size_t len, - int header_offset) { - m_pSyntax->InitParser( + FX_FILESIZE header_offset) { + m_pSyntax = CPDF_SyntaxParser::CreateForTesting( pdfium::MakeRetain(buffer, len), header_offset); return true; -- cgit v1.2.3