Remove useless `CPDF_StreamContentParser::m_bResourceMissing`. It's set, but never read from. Change-Id: Ifaad3503851138cf7d135b6ce2a4cc8070a390cc Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/85953 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index 112d457..7d20124 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -736,10 +736,8 @@ } CPDF_Stream* pXObject = ToStream(FindResourceObj("XObject", name)); - if (!pXObject) { - m_bResourceMissing = true; + if (!pXObject) return; - } ByteString type; if (pXObject->GetDict()) @@ -894,10 +892,9 @@ void CPDF_StreamContentParser::Handle_SetExtendGraphState() { ByteString name = GetString(0); CPDF_Dictionary* pGS = ToDictionary(FindResourceObj("ExtGState", name)); - if (!pGS) { - m_bResourceMissing = true; + if (!pGS) return; - } + m_pCurStates->ProcessExtGS(pGS, this); } @@ -1146,7 +1143,6 @@ const ByteString& name) { CPDF_Dictionary* pFontDict = ToDictionary(FindResourceObj("Font", name)); if (!pFontDict) { - m_bResourceMissing = true; return CPDF_Font::GetStockFont(m_pDocument.Get(), CFX_Font::kDefaultAnsiFontName); } @@ -1182,10 +1178,8 @@ ->GetColorSpace(pDefObj, nullptr); } const CPDF_Object* pCSObj = FindResourceObj("ColorSpace", name); - if (!pCSObj) { - m_bResourceMissing = true; + if (!pCSObj) return nullptr; - } return CPDF_DocPageData::FromDocument(m_pDocument.Get()) ->GetColorSpace(pCSObj, nullptr); } @@ -1193,10 +1187,8 @@ RetainPtr<CPDF_Pattern> CPDF_StreamContentParser::FindPattern( const ByteString& name) { CPDF_Object* pPattern = FindResourceObj("Pattern", name); - if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream())) { - m_bResourceMissing = true; + if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream())) return nullptr; - } return CPDF_DocPageData::FromDocument(m_pDocument.Get()) ->GetPattern(pPattern, m_pCurStates->m_ParentMatrix); } @@ -1204,10 +1196,8 @@ RetainPtr<CPDF_ShadingPattern> CPDF_StreamContentParser::FindShading( const ByteString& name) { CPDF_Object* pPattern = FindResourceObj("Shading", name); - if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream())) { - m_bResourceMissing = true; + if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream())) return nullptr; - } return CPDF_DocPageData::FromDocument(m_pDocument.Get()) ->GetShading(pPattern, m_pCurStates->m_ParentMatrix); }
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.h b/core/fpdfapi/page/cpdf_streamcontentparser.h index 70de6fa..3dcc2ac 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.h +++ b/core/fpdfapi/page/cpdf_streamcontentparser.h
@@ -238,7 +238,6 @@ ByteString m_LastImageName; RetainPtr<CPDF_Image> m_pLastImage; bool m_bColored = false; - bool m_bResourceMissing = false; std::vector<std::unique_ptr<CPDF_AllStates>> m_StateStack; float m_Type3Data[6] = {0.0f}; ContentParam m_ParamBuf[kParamBufSize];