diff options
author | Lei Zhang <thestig@chromium.org> | 2018-07-25 20:57:25 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-25 20:57:25 +0000 |
commit | a35063cb627d611e77816216d0d8946794a98079 (patch) | |
tree | 458125d329ef663797001d78a9181429085ec9b5 /core/fpdfapi/parser/cpdf_parser.cpp | |
parent | 35b51e95b9a4d0c064efd905e946a554d6f47890 (diff) | |
download | pdfium-a35063cb627d611e77816216d0d8946794a98079.tar.xz |
Change GetHeaderOffset() to return Optional<FX_FILESIZE>.
Remove |kInvalidHeaderOffset|.
Change-Id: I5978e745e97aa4e13299dd21028721725ac0c996
Reviewed-on: https://pdfium-review.googlesource.com/38853
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_parser.cpp')
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index ba8974a0de..e93f293f84 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -121,13 +121,13 @@ void CPDF_Parser::ShrinkObjectMap(uint32_t objnum) { bool CPDF_Parser::InitSyntaxParser( const RetainPtr<CPDF_ReadValidator>& validator) { - const int32_t header_offset = GetHeaderOffset(validator); - if (header_offset == kInvalidHeaderOffset) + const Optional<FX_FILESIZE> header_offset = GetHeaderOffset(validator); + if (!header_offset) return false; - if (validator->GetSize() < header_offset + kPDFHeaderSize) + if (validator->GetSize() < *header_offset + kPDFHeaderSize) return false; - m_pSyntax = pdfium::MakeUnique<CPDF_SyntaxParser>(validator, header_offset); + m_pSyntax = pdfium::MakeUnique<CPDF_SyntaxParser>(validator, *header_offset); return ParseFileVersion(); } |