diff options
author | Lei Zhang <thestig@chromium.org> | 2018-08-10 21:42:43 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-08-10 21:42:43 +0000 |
commit | 6ce3b34281786c2332fa6de81fe67f7f4b883602 (patch) | |
tree | 2aa7a5880d578b0cbe38e42571137a4a56dc47f4 | |
parent | cdd4fa8b86fff5b967e180bcb36907bfccb935c6 (diff) | |
download | pdfium-6ce3b34281786c2332fa6de81fe67f7f4b883602.tar.xz |
Minor cleanup in CPDF_ContentParser.
Add more asserts and use more constants.
Change-Id: I51f1d9d1b501f4e99d9793b6c803676b7221be17
Reviewed-on: https://pdfium-review.googlesource.com/39871
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r-- | core/fpdfapi/page/cpdf_contentparser.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp index 2bb376e841..f93cf47eb8 100644 --- a/core/fpdfapi/page/cpdf_contentparser.cpp +++ b/core/fpdfapi/page/cpdf_contentparser.cpp @@ -6,6 +6,7 @@ #include "core/fpdfapi/page/cpdf_contentparser.h" +#include "constants/page_object.h" #include "core/fpdfapi/font/cpdf_type3char.h" #include "core/fpdfapi/page/cpdf_allstates.h" #include "core/fpdfapi/page/cpdf_form.h" @@ -30,7 +31,8 @@ CPDF_ContentParser::CPDF_ContentParser(CPDF_Page* pPage) return; } - CPDF_Object* pContent = pPage->GetDict()->GetDirectObjectFor("Contents"); + CPDF_Object* pContent = + pPage->GetDict()->GetDirectObjectFor(pdfium::page_object::kContents); if (!pContent) { m_CurrentStage = Stage::kComplete; return; @@ -141,7 +143,10 @@ bool CPDF_ContentParser::Continue(PauseIndicatorIface* pPause) { } CPDF_ContentParser::Stage CPDF_ContentParser::GetContent() { - CPDF_Array* pContent = m_pObjectHolder->GetDict()->GetArrayFor("Contents"); + ASSERT(m_CurrentStage == Stage::kGetContent); + ASSERT(m_pObjectHolder->IsPage()); + CPDF_Array* pContent = + m_pObjectHolder->GetDict()->GetArrayFor(pdfium::page_object::kContents); CPDF_Stream* pStreamObj = ToStream( pContent ? pContent->GetDirectObjectAt(m_CurrentOffset) : nullptr); m_StreamArray[m_CurrentOffset] = |