Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(486)

Side by Side Diff: core/fpdfapi/parser/cpdf_data_avail.h

Issue 2477443002: Remove FX_BOOL from core (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_crypto_handler.cpp ('k') | core/fpdfapi/parser/cpdf_data_avail.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_ 7 #ifndef CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_
8 #define CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_ 8 #define CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_
9 9
10 #include <vector> 10 #include <vector>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 enum DocFormStatus { 76 enum DocFormStatus {
77 FormError = -1, // PDF_FORM_ERROR 77 FormError = -1, // PDF_FORM_ERROR
78 FormNotAvailable = 0, // PDF_FORM_NOTAVAIL 78 FormNotAvailable = 0, // PDF_FORM_NOTAVAIL
79 FormAvailable = 1, // PDF_FORM_AVAIL 79 FormAvailable = 1, // PDF_FORM_AVAIL
80 FormNotExist = 2, // PDF_FORM_NOTEXIST 80 FormNotExist = 2, // PDF_FORM_NOTEXIST
81 }; 81 };
82 82
83 class FileAvail { 83 class FileAvail {
84 public: 84 public:
85 virtual ~FileAvail(); 85 virtual ~FileAvail();
86 virtual FX_BOOL IsDataAvail(FX_FILESIZE offset, uint32_t size) = 0; 86 virtual bool IsDataAvail(FX_FILESIZE offset, uint32_t size) = 0;
87 }; 87 };
88 88
89 class DownloadHints { 89 class DownloadHints {
90 public: 90 public:
91 virtual ~DownloadHints(); 91 virtual ~DownloadHints();
92 virtual void AddSegment(FX_FILESIZE offset, uint32_t size) = 0; 92 virtual void AddSegment(FX_FILESIZE offset, uint32_t size) = 0;
93 }; 93 };
94 94
95 CPDF_DataAvail(FileAvail* pFileAvail, 95 CPDF_DataAvail(FileAvail* pFileAvail,
96 IFX_SeekableReadStream* pFileRead, 96 IFX_SeekableReadStream* pFileRead,
97 FX_BOOL bSupportHintTable); 97 bool bSupportHintTable);
98 ~CPDF_DataAvail(); 98 ~CPDF_DataAvail();
99 99
100 DocAvailStatus IsDocAvail(DownloadHints* pHints); 100 DocAvailStatus IsDocAvail(DownloadHints* pHints);
101 void SetDocument(CPDF_Document* pDoc); 101 void SetDocument(CPDF_Document* pDoc);
102 DocAvailStatus IsPageAvail(uint32_t dwPage, DownloadHints* pHints); 102 DocAvailStatus IsPageAvail(uint32_t dwPage, DownloadHints* pHints);
103 DocFormStatus IsFormAvail(DownloadHints* pHints); 103 DocFormStatus IsFormAvail(DownloadHints* pHints);
104 DocLinearizationStatus IsLinearizedPDF(); 104 DocLinearizationStatus IsLinearizedPDF();
105 FX_BOOL IsLinearized(); 105 bool IsLinearized();
106 void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, uint32_t* pSize); 106 void GetLinearizedMainXRefInfo(FX_FILESIZE* pPos, uint32_t* pSize);
107 IFX_SeekableReadStream* GetFileRead() const { return m_pFileRead; } 107 IFX_SeekableReadStream* GetFileRead() const { return m_pFileRead; }
108 int GetPageCount() const; 108 int GetPageCount() const;
109 CPDF_Dictionary* GetPage(int index); 109 CPDF_Dictionary* GetPage(int index);
110 110
111 friend class CPDF_HintTables; 111 friend class CPDF_HintTables;
112 112
113 protected: 113 protected:
114 class PageNode { 114 class PageNode {
115 public: 115 public:
116 PageNode(); 116 PageNode();
117 ~PageNode(); 117 ~PageNode();
118 118
119 PDF_PAGENODE_TYPE m_type; 119 PDF_PAGENODE_TYPE m_type;
120 uint32_t m_dwPageNo; 120 uint32_t m_dwPageNo;
121 CFX_ArrayTemplate<PageNode*> m_childNode; 121 CFX_ArrayTemplate<PageNode*> m_childNode;
122 }; 122 };
123 123
124 static const int kMaxDataAvailRecursionDepth = 64; 124 static const int kMaxDataAvailRecursionDepth = 64;
125 static int s_CurrentDataAvailRecursionDepth; 125 static int s_CurrentDataAvailRecursionDepth;
126 static const int kMaxPageRecursionDepth = 1024; 126 static const int kMaxPageRecursionDepth = 1024;
127 127
128 uint32_t GetObjectSize(uint32_t objnum, FX_FILESIZE& offset); 128 uint32_t GetObjectSize(uint32_t objnum, FX_FILESIZE& offset);
129 FX_BOOL AreObjectsAvailable(std::vector<CPDF_Object*>& obj_array, 129 bool AreObjectsAvailable(std::vector<CPDF_Object*>& obj_array,
130 FX_BOOL bParsePage, 130 bool bParsePage,
131 DownloadHints* pHints, 131 DownloadHints* pHints,
132 std::vector<CPDF_Object*>& ret_array); 132 std::vector<CPDF_Object*>& ret_array);
133 FX_BOOL CheckDocStatus(DownloadHints* pHints); 133 bool CheckDocStatus(DownloadHints* pHints);
134 FX_BOOL CheckHeader(DownloadHints* pHints); 134 bool CheckHeader(DownloadHints* pHints);
135 FX_BOOL CheckFirstPage(DownloadHints* pHints); 135 bool CheckFirstPage(DownloadHints* pHints);
136 FX_BOOL CheckHintTables(DownloadHints* pHints); 136 bool CheckHintTables(DownloadHints* pHints);
137 FX_BOOL CheckEnd(DownloadHints* pHints); 137 bool CheckEnd(DownloadHints* pHints);
138 FX_BOOL CheckCrossRef(DownloadHints* pHints); 138 bool CheckCrossRef(DownloadHints* pHints);
139 FX_BOOL CheckCrossRefItem(DownloadHints* pHints); 139 bool CheckCrossRefItem(DownloadHints* pHints);
140 FX_BOOL CheckTrailer(DownloadHints* pHints); 140 bool CheckTrailer(DownloadHints* pHints);
141 FX_BOOL CheckRoot(DownloadHints* pHints); 141 bool CheckRoot(DownloadHints* pHints);
142 FX_BOOL CheckInfo(DownloadHints* pHints); 142 bool CheckInfo(DownloadHints* pHints);
143 FX_BOOL CheckPages(DownloadHints* pHints); 143 bool CheckPages(DownloadHints* pHints);
144 FX_BOOL CheckPage(DownloadHints* pHints); 144 bool CheckPage(DownloadHints* pHints);
145 FX_BOOL CheckResources(DownloadHints* pHints); 145 bool CheckResources(DownloadHints* pHints);
146 FX_BOOL CheckAnnots(DownloadHints* pHints); 146 bool CheckAnnots(DownloadHints* pHints);
147 FX_BOOL CheckAcroForm(DownloadHints* pHints); 147 bool CheckAcroForm(DownloadHints* pHints);
148 FX_BOOL CheckAcroFormSubObject(DownloadHints* pHints); 148 bool CheckAcroFormSubObject(DownloadHints* pHints);
149 FX_BOOL CheckTrailerAppend(DownloadHints* pHints); 149 bool CheckTrailerAppend(DownloadHints* pHints);
150 FX_BOOL CheckPageStatus(DownloadHints* pHints); 150 bool CheckPageStatus(DownloadHints* pHints);
151 FX_BOOL CheckAllCrossRefStream(DownloadHints* pHints); 151 bool CheckAllCrossRefStream(DownloadHints* pHints);
152 152
153 int32_t CheckCrossRefStream(DownloadHints* pHints, FX_FILESIZE& xref_offset); 153 int32_t CheckCrossRefStream(DownloadHints* pHints, FX_FILESIZE& xref_offset);
154 FX_BOOL IsLinearizedFile(uint8_t* pData, uint32_t dwLen); 154 bool IsLinearizedFile(uint8_t* pData, uint32_t dwLen);
155 void SetStartOffset(FX_FILESIZE dwOffset); 155 void SetStartOffset(FX_FILESIZE dwOffset);
156 FX_BOOL GetNextToken(CFX_ByteString& token); 156 bool GetNextToken(CFX_ByteString& token);
157 FX_BOOL GetNextChar(uint8_t& ch); 157 bool GetNextChar(uint8_t& ch);
158 CPDF_Object* ParseIndirectObjectAt( 158 CPDF_Object* ParseIndirectObjectAt(
159 FX_FILESIZE pos, 159 FX_FILESIZE pos,
160 uint32_t objnum, 160 uint32_t objnum,
161 CPDF_IndirectObjectHolder* pObjList = nullptr); 161 CPDF_IndirectObjectHolder* pObjList = nullptr);
162 CPDF_Object* GetObject(uint32_t objnum, 162 CPDF_Object* GetObject(uint32_t objnum,
163 DownloadHints* pHints, 163 DownloadHints* pHints,
164 FX_BOOL* pExistInFile); 164 bool* pExistInFile);
165 FX_BOOL GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages); 165 bool GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages);
166 FX_BOOL PreparePageItem(); 166 bool PreparePageItem();
167 FX_BOOL LoadPages(DownloadHints* pHints); 167 bool LoadPages(DownloadHints* pHints);
168 FX_BOOL LoadAllXref(DownloadHints* pHints); 168 bool LoadAllXref(DownloadHints* pHints);
169 FX_BOOL LoadAllFile(DownloadHints* pHints); 169 bool LoadAllFile(DownloadHints* pHints);
170 DocAvailStatus CheckLinearizedData(DownloadHints* pHints); 170 DocAvailStatus CheckLinearizedData(DownloadHints* pHints);
171 FX_BOOL CheckPageAnnots(uint32_t dwPage, DownloadHints* pHints); 171 bool CheckPageAnnots(uint32_t dwPage, DownloadHints* pHints);
172 172
173 DocAvailStatus CheckLinearizedFirstPage(uint32_t dwPage, 173 DocAvailStatus CheckLinearizedFirstPage(uint32_t dwPage,
174 DownloadHints* pHints); 174 DownloadHints* pHints);
175 FX_BOOL HaveResourceAncestor(CPDF_Dictionary* pDict); 175 bool HaveResourceAncestor(CPDF_Dictionary* pDict);
176 FX_BOOL CheckPage(uint32_t dwPage, DownloadHints* pHints); 176 bool CheckPage(uint32_t dwPage, DownloadHints* pHints);
177 FX_BOOL LoadDocPages(DownloadHints* pHints); 177 bool LoadDocPages(DownloadHints* pHints);
178 FX_BOOL LoadDocPage(uint32_t dwPage, DownloadHints* pHints); 178 bool LoadDocPage(uint32_t dwPage, DownloadHints* pHints);
179 FX_BOOL CheckPageNode(PageNode& pageNodes, 179 bool CheckPageNode(PageNode& pageNodes,
180 int32_t iPage, 180 int32_t iPage,
181 int32_t& iCount, 181 int32_t& iCount,
182 DownloadHints* pHints, 182 DownloadHints* pHints,
183 int level); 183 int level);
184 FX_BOOL CheckUnkownPageNode(uint32_t dwPageNo, 184 bool CheckUnkownPageNode(uint32_t dwPageNo,
185 PageNode* pPageNode, 185 PageNode* pPageNode,
186 DownloadHints* pHints); 186 DownloadHints* pHints);
187 FX_BOOL CheckArrayPageNode(uint32_t dwPageNo, 187 bool CheckArrayPageNode(uint32_t dwPageNo,
188 PageNode* pPageNode, 188 PageNode* pPageNode,
189 DownloadHints* pHints); 189 DownloadHints* pHints);
190 FX_BOOL CheckPageCount(DownloadHints* pHints); 190 bool CheckPageCount(DownloadHints* pHints);
191 bool IsFirstCheck(uint32_t dwPage); 191 bool IsFirstCheck(uint32_t dwPage);
192 void ResetFirstCheck(uint32_t dwPage); 192 void ResetFirstCheck(uint32_t dwPage);
193 FX_BOOL IsDataAvail(FX_FILESIZE offset, uint32_t size, DownloadHints* pHints); 193 bool IsDataAvail(FX_FILESIZE offset, uint32_t size, DownloadHints* pHints);
194 194
195 FileAvail* const m_pFileAvail; 195 FileAvail* const m_pFileAvail;
196 IFX_SeekableReadStream* const m_pFileRead; 196 IFX_SeekableReadStream* const m_pFileRead;
197 CPDF_Parser m_parser; 197 CPDF_Parser m_parser;
198 CPDF_SyntaxParser m_syntaxParser; 198 CPDF_SyntaxParser m_syntaxParser;
199 CPDF_Object* m_pRoot; 199 CPDF_Object* m_pRoot;
200 uint32_t m_dwRootObjNum; 200 uint32_t m_dwRootObjNum;
201 uint32_t m_dwInfoObjNum; 201 uint32_t m_dwInfoObjNum;
202 CPDF_Object* m_pLinearized; 202 CPDF_Object* m_pLinearized;
203 CPDF_Object* m_pTrailer; 203 CPDF_Object* m_pTrailer;
204 FX_BOOL m_bDocAvail; 204 bool m_bDocAvail;
205 FX_FILESIZE m_dwHeaderOffset; 205 FX_FILESIZE m_dwHeaderOffset;
206 FX_FILESIZE m_dwLastXRefOffset; 206 FX_FILESIZE m_dwLastXRefOffset;
207 FX_FILESIZE m_dwXRefOffset; 207 FX_FILESIZE m_dwXRefOffset;
208 FX_FILESIZE m_dwTrailerOffset; 208 FX_FILESIZE m_dwTrailerOffset;
209 FX_FILESIZE m_dwCurrentOffset; 209 FX_FILESIZE m_dwCurrentOffset;
210 PDF_DATAAVAIL_STATUS m_docStatus; 210 PDF_DATAAVAIL_STATUS m_docStatus;
211 FX_FILESIZE m_dwFileLen; 211 FX_FILESIZE m_dwFileLen;
212 CPDF_Document* m_pDocument; 212 CPDF_Document* m_pDocument;
213 std::set<uint32_t> m_ObjectSet; 213 std::set<uint32_t> m_ObjectSet;
214 std::vector<CPDF_Object*> m_objs_array; 214 std::vector<CPDF_Object*> m_objs_array;
215 FX_FILESIZE m_Pos; 215 FX_FILESIZE m_Pos;
216 FX_FILESIZE m_bufferOffset; 216 FX_FILESIZE m_bufferOffset;
217 uint32_t m_bufferSize; 217 uint32_t m_bufferSize;
218 CFX_ByteString m_WordBuf; 218 CFX_ByteString m_WordBuf;
219 uint8_t m_bufferData[512]; 219 uint8_t m_bufferData[512];
220 CFX_ArrayTemplate<uint32_t> m_XRefStreamList; 220 CFX_ArrayTemplate<uint32_t> m_XRefStreamList;
221 CFX_ArrayTemplate<uint32_t> m_PageObjList; 221 CFX_ArrayTemplate<uint32_t> m_PageObjList;
222 uint32_t m_PagesObjNum; 222 uint32_t m_PagesObjNum;
223 FX_BOOL m_bLinearized; 223 bool m_bLinearized;
224 uint32_t m_dwFirstPageNo; 224 uint32_t m_dwFirstPageNo;
225 FX_BOOL m_bLinearedDataOK; 225 bool m_bLinearedDataOK;
226 FX_BOOL m_bMainXRefLoadTried; 226 bool m_bMainXRefLoadTried;
227 FX_BOOL m_bMainXRefLoadedOK; 227 bool m_bMainXRefLoadedOK;
228 FX_BOOL m_bPagesTreeLoad; 228 bool m_bPagesTreeLoad;
229 FX_BOOL m_bPagesLoad; 229 bool m_bPagesLoad;
230 CPDF_Parser* m_pCurrentParser; 230 CPDF_Parser* m_pCurrentParser;
231 FX_FILESIZE m_dwCurrentXRefSteam; 231 FX_FILESIZE m_dwCurrentXRefSteam;
232 FX_BOOL m_bAnnotsLoad; 232 bool m_bAnnotsLoad;
233 FX_BOOL m_bHaveAcroForm; 233 bool m_bHaveAcroForm;
234 uint32_t m_dwAcroFormObjNum; 234 uint32_t m_dwAcroFormObjNum;
235 FX_BOOL m_bAcroFormLoad; 235 bool m_bAcroFormLoad;
236 CPDF_Object* m_pAcroForm; 236 CPDF_Object* m_pAcroForm;
237 std::vector<CPDF_Object*> m_arrayAcroforms; 237 std::vector<CPDF_Object*> m_arrayAcroforms;
238 CPDF_Dictionary* m_pPageDict; 238 CPDF_Dictionary* m_pPageDict;
239 CPDF_Object* m_pPageResource; 239 CPDF_Object* m_pPageResource;
240 FX_BOOL m_bNeedDownLoadResource; 240 bool m_bNeedDownLoadResource;
241 FX_BOOL m_bPageLoadedOK; 241 bool m_bPageLoadedOK;
242 FX_BOOL m_bLinearizedFormParamLoad; 242 bool m_bLinearizedFormParamLoad;
243 std::vector<CPDF_Object*> m_PagesArray; 243 std::vector<CPDF_Object*> m_PagesArray;
244 uint32_t m_dwEncryptObjNum; 244 uint32_t m_dwEncryptObjNum;
245 FX_FILESIZE m_dwPrevXRefOffset; 245 FX_FILESIZE m_dwPrevXRefOffset;
246 FX_BOOL m_bTotalLoadPageTree; 246 bool m_bTotalLoadPageTree;
247 FX_BOOL m_bCurPageDictLoadOK; 247 bool m_bCurPageDictLoadOK;
248 PageNode m_pageNodes; 248 PageNode m_pageNodes;
249 std::set<uint32_t> m_pageMapCheckState; 249 std::set<uint32_t> m_pageMapCheckState;
250 std::set<uint32_t> m_pagesLoadState; 250 std::set<uint32_t> m_pagesLoadState;
251 std::unique_ptr<CPDF_HintTables> m_pHintTables; 251 std::unique_ptr<CPDF_HintTables> m_pHintTables;
252 FX_BOOL m_bSupportHintTable; 252 bool m_bSupportHintTable;
253 }; 253 };
254 254
255 #endif // CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_ 255 #endif // CORE_FPDFAPI_PARSER_CPDF_DATA_AVAIL_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_crypto_handler.cpp ('k') | core/fpdfapi/parser/cpdf_data_avail.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698