summaryrefslogtreecommitdiff
path: root/core/fpdfapi/edit
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-23 17:21:01 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-24 16:41:29 +0000
commit08f4b7762a4453818c76c680f5295986e21418ce (patch)
treec6a771759b639180add570f4dd882d103f8efe9c /core/fpdfapi/edit
parent129b0135adf99be8e2c3015267a4689c6d62dca1 (diff)
downloadpdfium-08f4b7762a4453818c76c680f5295986e21418ce.tar.xz
Convert to CFX_UnownedPtr, part 4.
Fix strange ownership issue in cpdf_type3char.cpp, and describe the absolutely insane stuff happening there. Change-Id: Iae70f9eca8f125ed3ef677729f1776ba9f10183c Reviewed-on: https://pdfium-review.googlesource.com/5830 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
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;