summaryrefslogtreecommitdiff
path: root/core/fpdfapi/edit
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/edit')
-rw-r--r--core/fpdfapi/edit/cpdf_creator.cpp8
-rw-r--r--core/fpdfapi/edit/cpdf_creator.h13
2 files changed, 11 insertions, 10 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index b318c7a7df..1c0cd69a4b 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -513,7 +513,7 @@ int32_t CPDF_Creator::WriteDoc_Stage2() {
if (m_pEncryptDict && m_pEncryptDict->IsInline()) {
m_dwLastObjNum += 1;
FX_FILESIZE saveOffset = m_Archive->CurrentOffset();
- if (!WriteIndirectObj(m_dwLastObjNum, m_pEncryptDict))
+ if (!WriteIndirectObj(m_dwLastObjNum, m_pEncryptDict.Get()))
return -1;
m_ObjectOffsets[m_dwLastObjNum] = saveOffset;
@@ -819,10 +819,10 @@ void CPDF_Creator::InitID() {
CFX_ByteString user_pass = m_pParser->GetPassword();
uint32_t flag = PDF_ENCRYPT_CONTENT;
CPDF_SecurityHandler handler;
- handler.OnCreate(m_pEncryptDict, m_pIDArray.get(), user_pass.raw_str(),
- user_pass.GetLength(), flag);
+ handler.OnCreate(m_pEncryptDict.Get(), m_pIDArray.get(),
+ user_pass.raw_str(), user_pass.GetLength(), flag);
m_pCryptoHandler = pdfium::MakeRetain<CPDF_CryptoHandler>();
- m_pCryptoHandler->Init(m_pEncryptDict, &handler);
+ m_pCryptoHandler->Init(m_pEncryptDict.Get(), &handler);
m_bSecurityChanged = true;
}
}
diff --git a/core/fpdfapi/edit/cpdf_creator.h b/core/fpdfapi/edit/cpdf_creator.h
index 618fffde79..f141c3880a 100644
--- a/core/fpdfapi/edit/cpdf_creator.h
+++ b/core/fpdfapi/edit/cpdf_creator.h
@@ -12,6 +12,7 @@
#include <vector>
#include "core/fxcrt/cfx_retain_ptr.h"
+#include "core/fxcrt/cfx_unowned_ptr.h"
#include "core/fxcrt/fx_basic.h"
class CPDF_Array;
@@ -40,9 +41,9 @@ class CPDF_Creator {
uint32_t GetNextObjectNumber() { return ++m_dwLastObjNum; }
uint32_t GetLastObjectNumber() const { return m_dwLastObjNum; }
CPDF_CryptoHandler* GetCryptoHandler() { return m_pCryptoHandler.Get(); }
- CPDF_Document* GetDocument() const { return m_pDocument; }
+ CPDF_Document* GetDocument() const { return m_pDocument.Get(); }
CPDF_Array* GetIDArray() const { return m_pIDArray.get(); }
- CPDF_Dictionary* GetEncryptDict() const { return m_pEncryptDict; }
+ CPDF_Dictionary* GetEncryptDict() const { return m_pEncryptDict.Get(); }
uint32_t GetEncryptObjectNumber() const { return m_dwEncryptObjNum; }
uint32_t GetObjectOffset(uint32_t objnum) { return m_ObjectOffsets[objnum]; }
@@ -79,13 +80,13 @@ class CPDF_Creator {
bool IsXRefNeedEnd();
- CPDF_Document* const m_pDocument;
- CPDF_Parser* const m_pParser;
+ CFX_UnownedPtr<CPDF_Document> const m_pDocument;
+ CFX_UnownedPtr<CPDF_Parser> const m_pParser;
bool m_bSecurityChanged;
- CPDF_Dictionary* m_pEncryptDict;
+ CFX_UnownedPtr<CPDF_Dictionary> m_pEncryptDict;
uint32_t m_dwEncryptObjNum;
CFX_RetainPtr<CPDF_CryptoHandler> m_pCryptoHandler;
- CPDF_Object* m_pMetadata;
+ CFX_UnownedPtr<CPDF_Object> m_pMetadata;
uint32_t m_dwLastObjNum;
std::unique_ptr<IFX_ArchiveStream> m_Archive;
FX_FILESIZE m_SavedOffset;