summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp15
-rw-r--r--core/fpdfapi/parser/cpdf_parser.h3
2 files changed, 9 insertions, 9 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index a3e5dba40a..54b8ea0aa3 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -52,8 +52,7 @@ int32_t GetStreamFirst(const CFX_RetainPtr<CPDF_StreamAcc>& pObjStream) {
} // namespace
CPDF_Parser::CPDF_Parser()
- : m_pDocument(nullptr),
- m_bHasParsed(false),
+ : m_bHasParsed(false),
m_bXRefStream(false),
m_bVersionUpdated(false),
m_FileVersion(0),
@@ -719,8 +718,8 @@ bool CPDF_Parser::RebuildCrossRef() {
last_obj = start_pos;
FX_FILESIZE obj_end = 0;
std::unique_ptr<CPDF_Object> pObject =
- ParseIndirectObjectAtByStrict(m_pDocument, obj_pos, objnum,
- &obj_end);
+ ParseIndirectObjectAtByStrict(m_pDocument.Get(), obj_pos,
+ objnum, &obj_end);
if (CPDF_Stream* pStream = ToStream(pObject.get())) {
if (CPDF_Dictionary* pDict = pStream->GetDict()) {
if ((pDict->KeyExist("Type")) &&
@@ -779,7 +778,7 @@ bool CPDF_Parser::RebuildCrossRef() {
m_pSyntax->SetPos(pos + i - m_pSyntax->m_HeaderOffset);
std::unique_ptr<CPDF_Object> pObj =
- m_pSyntax->GetObject(m_pDocument, 0, 0, true);
+ m_pSyntax->GetObject(m_pDocument.Get(), 0, 0, true);
if (pObj) {
if (pObj->IsDictionary() || pObj->AsStream()) {
CPDF_Stream* pStream = pObj->AsStream();
@@ -800,7 +799,7 @@ bool CPDF_Parser::RebuildCrossRef() {
pElement ? pElement->GetObjNum() : 0;
if (dwObjNum) {
m_pTrailer->SetNewFor<CPDF_Reference>(
- key, m_pDocument, dwObjNum);
+ key, m_pDocument.Get(), dwObjNum);
} else {
m_pTrailer->SetFor(key, pElement->Clone());
}
@@ -920,7 +919,7 @@ bool CPDF_Parser::RebuildCrossRef() {
bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, bool bMainXRef) {
std::unique_ptr<CPDF_Object> pObject(
- ParseIndirectObjectAt(m_pDocument, *pos, 0));
+ ParseIndirectObjectAt(m_pDocument.Get(), *pos, 0));
if (!pObject)
return false;
@@ -1397,7 +1396,7 @@ std::unique_ptr<CPDF_Dictionary> CPDF_Parser::LoadTrailerV4() {
if (m_pSyntax->GetKeyword() != "trailer")
return nullptr;
- return ToDictionary(m_pSyntax->GetObject(m_pDocument, 0, 0, true));
+ return ToDictionary(m_pSyntax->GetObject(m_pDocument.Get(), 0, 0, true));
}
uint32_t CPDF_Parser::GetPermissions() const {
diff --git a/core/fpdfapi/parser/cpdf_parser.h b/core/fpdfapi/parser/cpdf_parser.h
index 7ae2d4627e..c444c99f28 100644
--- a/core/fpdfapi/parser/cpdf_parser.h
+++ b/core/fpdfapi/parser/cpdf_parser.h
@@ -12,6 +12,7 @@
#include <set>
#include <vector>
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_basic.h"
class CPDF_Array;
@@ -150,7 +151,7 @@ class CPDF_Parser {
// the objects.
bool VerifyCrossRefV4();
- CPDF_Document* m_pDocument; // not owned
+ CFX_UnownedPtr<CPDF_Document> m_pDocument;
bool m_bHasParsed;
bool m_bXRefStream;
bool m_bVersionUpdated;