diff options
author | dsinclair <dsinclair@chromium.org> | 2016-08-22 10:24:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-22 10:24:43 -0700 |
commit | 8d6c929d2605dc568beb73aab2c585622947fee2 (patch) | |
tree | 9144254a1bcd59bad80dd4d06d17a96977966c47 /core/fpdfapi/fpdf_parser/cfdf_document.cpp | |
parent | a4f46c57f4e4217f50e98ac74b360793284ee73f (diff) | |
download | pdfium-8d6c929d2605dc568beb73aab2c585622947fee2.tar.xz |
Revert of Move parser pointer to CPDF_Document (patchset #6 id:100001 of https://codereview.chromium.org/2253723002/ )
Reason for revert:
Causing asan issues. See crbug.com/639451.
Original issue's description:
> Move parser pointer to CPDF_Document
>
> The CPDF_IndirectObjectHolder has two subclasses, CPDF_Document and
> CFDF_Document. The CPDF document requires the parser and the CFDF document
> does not. This cl moves the parser pointer up to CPDF_Document.
>
> Committed: https://pdfium.googlesource.com/pdfium/+/260f5fbf3553a96fa49b029cc050220039c30e2a
TBR=tsepez@chromium.org,thestig@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
Review-Url: https://codereview.chromium.org/2266033002
Diffstat (limited to 'core/fpdfapi/fpdf_parser/cfdf_document.cpp')
-rw-r--r-- | core/fpdfapi/fpdf_parser/cfdf_document.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.cpp b/core/fpdfapi/fpdf_parser/cfdf_document.cpp index f286346d70..c039871401 100644 --- a/core/fpdfapi/fpdf_parser/cfdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cfdf_document.cpp @@ -10,17 +10,16 @@ #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -CFDF_Document::CFDF_Document() - : CPDF_IndirectObjectHolder(), - m_pRootDict(nullptr), - m_pFile(nullptr), - m_bOwnFile(FALSE) {} - +CFDF_Document::CFDF_Document() : CPDF_IndirectObjectHolder(nullptr) { + m_pRootDict = nullptr; + m_pFile = nullptr; + m_bOwnFile = FALSE; +} CFDF_Document::~CFDF_Document() { - if (m_bOwnFile && m_pFile) + if (m_bOwnFile && m_pFile) { m_pFile->Release(); + } } - CFDF_Document* CFDF_Document::CreateNewDoc() { CFDF_Document* pDoc = new CFDF_Document; pDoc->m_pRootDict = new CPDF_Dictionary; @@ -66,7 +65,7 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) { if (!pObj) break; - ReplaceIndirectObjectIfHigherGeneration(objnum, pObj); + InsertIndirectObject(objnum, pObj); word = parser.GetNextWord(nullptr); if (word != "endobj") break; @@ -89,9 +88,9 @@ FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const { return FALSE; } buf << "%FDF-1.2\r\n"; - for (const auto& pair : *this) + for (const auto& pair : m_IndirectObjs) { buf << pair.first << " 0 obj\r\n" << pair.second << "\r\nendobj\r\n\r\n"; - + } buf << "trailer\r\n<</Root " << m_pRootDict->GetObjNum() << " 0 R>>\r\n%%EOF\r\n"; return TRUE; |