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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/include/fpdfapi/fpdf_parser.h
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index fda45571196bde7c3985da141bec2862a0a550a5..bdddfc37d7bf1325a0b0e621434496a6900e9cfc 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -61,6 +61,20 @@ inline bool PDFCharIsLineEnding(uint8_t c) {
return c == '\r' || c == '\n';
}
+template <typename T>
+class ScopedSetInsertion {
+ public:
+ ScopedSetInsertion(std::set<T>* org_set, T elem)
+ : m_Set(org_set), m_Entry(elem) {
+ m_Set->insert(m_Entry);
+ }
+ ~ScopedSetInsertion() { m_Set->erase(m_Entry); }
+
+ private:
+ std::set<T>* const m_Set;
+ const T m_Entry;
+};
+
// Indexed by 8-bit char code, contains unicode code points.
extern const FX_WORD PDFDocEncoding[256];
@@ -168,7 +182,9 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder {
CFX_DWordArray m_PageList;
- int _GetPageCount() const;
+ // Retrieve page count information by getting count value from the tree nodes
+ // or walking through the tree nodes to calculate it.
+ int RetrievePageCount() const;
CPDF_Dictionary* _FindPDFPage(CPDF_Dictionary* pPages,
int iPage,
int nPagesToGo,
« 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