diff options
author | Lei Zhang <thestig@chromium.org> | 2018-07-03 13:41:34 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-07-03 13:41:34 +0000 |
commit | 825f29ce7a61fc5d0ea12c5fd7aaa88984adb965 (patch) | |
tree | 2e278c6cf417652e6ed2ee92d582ad4c014cd0c1 | |
parent | 42e2790cb7c9f531be1cfc78b1241f592776db07 (diff) | |
download | pdfium-825f29ce7a61fc5d0ea12c5fd7aaa88984adb965.tar.xz |
Use GetPos() and SetPos() in CPDF_SyntaxParser::ReadStream().
Change-Id: I711508cdffd9756837657390d73b88c2d8c62db5
Reviewed-on: https://pdfium-review.googlesource.com/36891
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Art Snake <art-snake@yandex-team.ru>
Reviewed-by: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | core/fpdfapi/parser/cpdf_syntax_parser.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp index 09ed011cda..afdac58257 100644 --- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp @@ -525,19 +525,19 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream( // Locate the start of stream. ToNextLine(); - FX_FILESIZE streamStartPos = m_Pos; + FX_FILESIZE streamStartPos = GetPos(); const ByteStringView kEndStreamStr("endstream"); const ByteStringView kEndObjStr("endobj"); bool bSearchForKeyword = true; if (len >= 0) { - pdfium::base::CheckedNumeric<FX_FILESIZE> pos = m_Pos; + pdfium::base::CheckedNumeric<FX_FILESIZE> pos = GetPos(); pos += len; if (pos.IsValid() && pos.ValueOrDie() < m_FileLen) m_Pos = pos.ValueOrDie(); - m_Pos += ReadEOLMarkers(m_Pos); + m_Pos += ReadEOLMarkers(GetPos()); memset(m_WordBuffer, 0, kEndStreamStr.GetLength() + 1); GetNextWordInternal(nullptr); // Earlier version of PDF specification doesn't require EOL marker before @@ -562,9 +562,9 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream( break; // Stop searching when "endstream" is found. - if (IsWholeWord(m_Pos - kEndStreamStr.GetLength(), m_FileLen, + if (IsWholeWord(GetPos() - kEndStreamStr.GetLength(), m_FileLen, kEndStreamStr, true)) { - endStreamOffset = m_Pos - streamStartPos - kEndStreamStr.GetLength(); + endStreamOffset = GetPos() - streamStartPos - kEndStreamStr.GetLength(); break; } } @@ -579,9 +579,9 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream( break; // Stop searching when "endobj" is found. - if (IsWholeWord(m_Pos - kEndObjStr.GetLength(), m_FileLen, kEndObjStr, + if (IsWholeWord(GetPos() - kEndObjStr.GetLength(), m_FileLen, kEndObjStr, true)) { - endObjOffset = m_Pos - streamStartPos - kEndObjStr.GetLength(); + endObjOffset = GetPos() - streamStartPos - kEndObjStr.GetLength(); break; } } @@ -620,7 +620,7 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream( // Read up to the end of the buffer. Note, we allow zero length streams as // we need to pass them through when we are importing pages into a new // document. - len = std::min(len, m_FileLen - m_Pos - m_HeaderOffset); + len = std::min(len, m_FileLen - GetPos() - m_HeaderOffset); if (len < 0) return nullptr; @@ -631,11 +631,11 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream( } auto pStream = pdfium::MakeUnique<CPDF_Stream>(std::move(pData), len, std::move(pDict)); - streamStartPos = m_Pos; + streamStartPos = GetPos(); memset(m_WordBuffer, 0, kEndObjStr.GetLength() + 1); GetNextWordInternal(nullptr); - int numMarkers = ReadEOLMarkers(m_Pos); + int numMarkers = ReadEOLMarkers(GetPos()); if (m_WordSize == static_cast<unsigned int>(kEndObjStr.GetLength()) && numMarkers != 0 && memcmp(m_WordBuffer, kEndObjStr.raw_str(), kEndObjStr.GetLength()) == 0) { |