summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-11-30 19:52:42 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-30 19:52:42 +0000
commitc25394f5d8622fbb6203e73843f84ec1739bfa0b (patch)
tree647e120f3ae7d679347691c82af4a6f94f37421b /core/fpdfapi/parser
parent247c0e05dacb3b958bb7aaf06f21b93e78c43e19 (diff)
downloadpdfium-c25394f5d8622fbb6203e73843f84ec1739bfa0b.tar.xz
Use initializer list in CPDF_DataAvail ctor.
Or initialize members in the header. Also make m_dwFileLen member const. Change-Id: Iaaeab9a93e18e4ab313437362c0012d729b01647 Reviewed-on: https://pdfium-review.googlesource.com/9970 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.cpp27
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.h36
2 files changed, 23 insertions, 40 deletions
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index e72d7cdb19..af80fd96ab 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -79,28 +79,11 @@ CPDF_DataAvail::CPDF_DataAvail(
FileAvail* pFileAvail,
const RetainPtr<IFX_SeekableReadStream>& pFileRead,
bool bSupportHintTable)
- : m_pFileAvail(pFileAvail) {
- ASSERT(pFileRead);
- m_pFileRead = pdfium::MakeRetain<CPDF_ReadValidator>(pFileRead, m_pFileAvail);
- m_dwFileLen = m_pFileRead->GetSize();
- m_PagesObjNum = 0;
- m_dwInfoObjNum = 0;
- m_pDocument = 0;
- m_dwEncryptObjNum = 0;
- m_bDocAvail = false;
- m_bMainXRefLoadTried = false;
- m_bDocAvail = false;
- m_bPagesLoad = false;
- m_bPagesTreeLoad = false;
- m_bMainXRefLoadedOK = false;
- m_pCurrentParser = nullptr;
- m_docStatus = PDF_DATAAVAIL_HEADER;
- m_bTotalLoadPageTree = false;
- m_bCurPageDictLoadOK = false;
- m_bLinearedDataOK = false;
- m_bSupportHintTable = bSupportHintTable;
- m_bHeaderAvail = false;
-}
+ : m_pFileAvail(pFileAvail),
+ m_pFileRead(
+ pdfium::MakeRetain<CPDF_ReadValidator>(pFileRead, m_pFileAvail)),
+ m_dwFileLen(m_pFileRead->GetSize()),
+ m_bSupportHintTable(bSupportHintTable) {}
CPDF_DataAvail::~CPDF_DataAvail() {
m_pHintTables.reset();
diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h
index 001bf2280f..dfb1f0cabf 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.h
+++ b/core/fpdfapi/parser/cpdf_data_avail.h
@@ -168,37 +168,37 @@ class CPDF_DataAvail final {
RetainPtr<CPDF_ReadValidator> m_pFileRead;
CPDF_Parser m_parser;
std::unique_ptr<CPDF_Object> m_pRoot;
- uint32_t m_dwRootObjNum;
- uint32_t m_dwInfoObjNum;
+ uint32_t m_dwRootObjNum = 0;
+ uint32_t m_dwInfoObjNum = 0;
std::unique_ptr<CPDF_LinearizedHeader> m_pLinearized;
- bool m_bDocAvail;
+ bool m_bDocAvail = false;
std::unique_ptr<CPDF_CrossRefAvail> m_pCrossRefAvail;
- PDF_DATAAVAIL_STATUS m_docStatus;
- FX_FILESIZE m_dwFileLen;
- CPDF_Document* m_pDocument;
+ PDF_DATAAVAIL_STATUS m_docStatus = PDF_DATAAVAIL_HEADER;
+ const FX_FILESIZE m_dwFileLen;
+ CPDF_Document* m_pDocument = nullptr;
std::vector<uint32_t> m_PageObjList;
- uint32_t m_PagesObjNum;
- bool m_bLinearedDataOK;
- bool m_bMainXRefLoadTried;
- bool m_bMainXRefLoadedOK;
- bool m_bPagesTreeLoad;
- bool m_bPagesLoad;
- CPDF_Parser* m_pCurrentParser;
+ uint32_t m_PagesObjNum = 0;
+ bool m_bLinearedDataOK = false;
+ bool m_bMainXRefLoadTried = false;
+ bool m_bMainXRefLoadedOK = false;
+ bool m_bPagesTreeLoad = false;
+ bool m_bPagesLoad = false;
+ CPDF_Parser* m_pCurrentParser = nullptr;
std::unique_ptr<CPDF_PageObjectAvail> m_pFormAvail;
std::vector<std::unique_ptr<CPDF_Object>> m_PagesArray;
- uint32_t m_dwEncryptObjNum;
- bool m_bTotalLoadPageTree;
- bool m_bCurPageDictLoadOK;
+ uint32_t m_dwEncryptObjNum = 0;
+ bool m_bTotalLoadPageTree = false;
+ bool m_bCurPageDictLoadOK = false;
PageNode m_PageNode;
std::set<uint32_t> m_pageMapCheckState;
std::set<uint32_t> m_pagesLoadState;
std::set<uint32_t> m_SeenPrevPositions;
std::unique_ptr<CPDF_HintTables> m_pHintTables;
- bool m_bSupportHintTable;
+ const bool m_bSupportHintTable;
std::map<uint32_t, std::unique_ptr<CPDF_PageObjectAvail>> m_PagesObjAvail;
std::map<const CPDF_Object*, std::unique_ptr<CPDF_PageObjectAvail>>
m_PagesResourcesAvail;
- bool m_bHeaderAvail;
+ bool m_bHeaderAvail = false;
};
#endif // CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_