Do more CPDF_StreamContentParser initialization in the header.
Change-Id: I39eae18351d5e2f0c7add286593120d1a1dfab72
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/61610
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 83ed23d..420bf70 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -266,16 +266,7 @@
m_pObjectHolder(pObjHolder),
m_ParsedSet(pParsedSet),
m_BBox(rcBBox),
- m_ParamStartPos(0),
- m_ParamCount(0),
- m_pCurStates(pdfium::MakeUnique<CPDF_AllStates>()),
- m_PathStartX(0.0f),
- m_PathStartY(0.0f),
- m_PathCurrentX(0.0f),
- m_PathCurrentY(0.0f),
- m_PathClipType(0),
- m_bColored(false),
- m_bResourceMissing(false) {
+ m_pCurStates(pdfium::MakeUnique<CPDF_AllStates>()) {
if (pmtContentToUser)
m_mtContentToUser = *pmtContentToUser;
if (pStates) {
@@ -286,9 +277,6 @@
m_pCurStates->m_TextState.Emplace();
m_pCurStates->m_ColorState.Emplace();
}
- for (size_t i = 0; i < FX_ArraySize(m_Type3Data); ++i) {
- m_Type3Data[i] = 0.0;
- }
// Add the sentinel.
m_ContentMarksStack.push(pdfium::MakeUnique<CPDF_ContentMarks>());
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.h b/core/fpdfapi/page/cpdf_streamcontentparser.h
index ae05968..a270320 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.h
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.h
@@ -210,25 +210,25 @@
UnownedPtr<std::set<const uint8_t*>> const m_ParsedSet;
CFX_Matrix m_mtContentToUser;
const CFX_FloatRect m_BBox;
- uint32_t m_ParamStartPos;
- uint32_t m_ParamCount;
+ uint32_t m_ParamStartPos = 0;
+ uint32_t m_ParamCount = 0;
UnownedPtr<CPDF_StreamParser> m_pSyntax;
std::unique_ptr<CPDF_AllStates> m_pCurStates;
std::stack<std::unique_ptr<CPDF_ContentMarks>> m_ContentMarksStack;
std::vector<std::unique_ptr<CPDF_TextObject>> m_ClipTextList;
UnownedPtr<CPDF_TextObject> m_pLastTextObject;
std::vector<FX_PATHPOINT> m_PathPoints;
- float m_PathStartX;
- float m_PathStartY;
- float m_PathCurrentX;
- float m_PathCurrentY;
- uint8_t m_PathClipType;
+ float m_PathStartX = 0.0f;
+ float m_PathStartY = 0.0f;
+ float m_PathCurrentX = 0.0f;
+ float m_PathCurrentY = 0.0f;
+ uint8_t m_PathClipType = 0;
ByteString m_LastImageName;
RetainPtr<CPDF_Image> m_pLastImage;
- bool m_bColored;
- bool m_bResourceMissing;
+ bool m_bColored = false;
+ bool m_bResourceMissing = false;
std::vector<std::unique_ptr<CPDF_AllStates>> m_StateStack;
- float m_Type3Data[6];
+ float m_Type3Data[6] = {0.0f};
ContentParam m_ParamBuf[kParamBufSize];
// The merged stream offsets at which a content stream ends and another