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

Side by Side Diff: core/include/fpdfapi/fpdf_parser.h

Issue 1583073004: Merge to XFA: Correct the way to count pages and to avoid infinite loop (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 11 months 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 | « no previous file | core/src/fpdfapi/fpdf_parser/fpdf_parser_document.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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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_INCLUDE_FPDFAPI_FPDF_PARSER_H_ 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
8 #define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ 8 #define CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
9 9
10 #include <map> 10 #include <map>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return PDF_CharType[c] == 'D'; 54 return PDF_CharType[c] == 'D';
55 } 55 }
56 inline bool PDFCharIsOther(uint8_t c) { 56 inline bool PDFCharIsOther(uint8_t c) {
57 return PDF_CharType[c] == 'R'; 57 return PDF_CharType[c] == 'R';
58 } 58 }
59 59
60 inline bool PDFCharIsLineEnding(uint8_t c) { 60 inline bool PDFCharIsLineEnding(uint8_t c) {
61 return c == '\r' || c == '\n'; 61 return c == '\r' || c == '\n';
62 } 62 }
63 63
64 template <typename T>
65 class ScopedSetInsertion {
66 public:
67 ScopedSetInsertion(std::set<T>* org_set, T elem)
68 : m_Set(org_set), m_Entry(elem) {
69 m_Set->insert(m_Entry);
70 }
71 ~ScopedSetInsertion() { m_Set->erase(m_Entry); }
72
73 private:
74 std::set<T>* const m_Set;
75 const T m_Entry;
76 };
77
64 // Indexed by 8-bit char code, contains unicode code points. 78 // Indexed by 8-bit char code, contains unicode code points.
65 extern const FX_WORD PDFDocEncoding[256]; 79 extern const FX_WORD PDFDocEncoding[256];
66 80
67 class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder { 81 class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
68 public: 82 public:
69 CPDF_Document(); 83 CPDF_Document();
70 explicit CPDF_Document(CPDF_Parser* pParser); 84 explicit CPDF_Document(CPDF_Parser* pParser);
71 85
72 ~CPDF_Document(); 86 ~CPDF_Document();
73 87
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 CFX_ByteString m_ID2; 175 CFX_ByteString m_ID2;
162 176
163 FX_BOOL m_bLinearized; 177 FX_BOOL m_bLinearized;
164 178
165 FX_DWORD m_dwFirstPageNo; 179 FX_DWORD m_dwFirstPageNo;
166 180
167 FX_DWORD m_dwFirstPageObjNum; 181 FX_DWORD m_dwFirstPageObjNum;
168 182
169 CFX_DWordArray m_PageList; 183 CFX_DWordArray m_PageList;
170 184
171 int _GetPageCount() const; 185 // Retrieve page count information by getting count value from the tree nodes
186 // or walking through the tree nodes to calculate it.
187 int RetrievePageCount() const;
172 CPDF_Dictionary* _FindPDFPage(CPDF_Dictionary* pPages, 188 CPDF_Dictionary* _FindPDFPage(CPDF_Dictionary* pPages,
173 int iPage, 189 int iPage,
174 int nPagesToGo, 190 int nPagesToGo,
175 int level); 191 int level);
176 int _FindPageIndex(CPDF_Dictionary* pNode, 192 int _FindPageIndex(CPDF_Dictionary* pNode,
177 FX_DWORD& skip_count, 193 FX_DWORD& skip_count,
178 FX_DWORD objnum, 194 FX_DWORD objnum,
179 int& index, 195 int& index,
180 int level = 0); 196 int level = 0);
181 FX_BOOL IsContentUsedElsewhere(FX_DWORD objnum, CPDF_Dictionary* pPageDict); 197 FX_BOOL IsContentUsedElsewhere(FX_DWORD objnum, CPDF_Dictionary* pPageDict);
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
981 FX_DWORD src_size, 997 FX_DWORD src_size,
982 const CPDF_Dictionary* pDict, 998 const CPDF_Dictionary* pDict,
983 uint8_t*& dest_buf, 999 uint8_t*& dest_buf,
984 FX_DWORD& dest_size, 1000 FX_DWORD& dest_size,
985 CFX_ByteString& ImageEncoding, 1001 CFX_ByteString& ImageEncoding,
986 CPDF_Dictionary*& pImageParms, 1002 CPDF_Dictionary*& pImageParms,
987 FX_DWORD estimated_size, 1003 FX_DWORD estimated_size,
988 FX_BOOL bImageAcc); 1004 FX_BOOL bImageAcc);
989 1005
990 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_ 1006 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698