summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_parser.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-12 16:50:51 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-13 06:00:01 +0000
commite0b592236db902e3e8cbca7ec64f8e2b192e1935 (patch)
treec77a5264e2a2f35c454471941045d3ccb0fe1172 /core/fpdfapi/parser/cpdf_parser.cpp
parentd20e3880234a35a558237316cac5d70fff4224bc (diff)
downloadpdfium-e0b592236db902e3e8cbca7ec64f8e2b192e1935.tar.xz
Avoid tracking ownership via m_bLocalCryptoHandler. Also remove m_bEncryptCloned, as it is always false. Replace some methods with direct calls to underlying code. Change-Id: Ifa9d6f721c59d07e3b8e258f76832ca9f2ea0fc9 Reviewed-on: https://pdfium-review.googlesource.com/4111 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_parser.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index ecdeeacb19..f009798058 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -100,8 +100,8 @@ void CPDF_Parser::SetEncryptDictionary(CPDF_Dictionary* pDict) {
m_pEncryptDict = pDict;
}
-CPDF_CryptoHandler* CPDF_Parser::GetCryptoHandler() {
- return m_pSyntax->m_pCryptoHandler.get();
+CFX_RetainPtr<CPDF_CryptoHandler> CPDF_Parser::GetCryptoHandler() const {
+ return m_pSyntax->m_pCryptoHandler;
}
CFX_RetainPtr<IFX_SeekableReadStream> CPDF_Parser::GetFileAccess() const {
@@ -249,17 +249,16 @@ CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() {
return PASSWORD_ERROR;
m_pSecurityHandler = std::move(pSecurityHandler);
- std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler(
- m_pSecurityHandler->CreateCryptoHandler());
+ auto pCryptoHandler = pdfium::MakeRetain<CPDF_CryptoHandler>();
if (!pCryptoHandler->Init(m_pEncryptDict, m_pSecurityHandler.get()))
return HANDLER_ERROR;
- m_pSyntax->SetEncrypt(std::move(pCryptoHandler));
+ m_pSyntax->SetEncrypt(pCryptoHandler);
}
return SUCCESS;
}
void CPDF_Parser::ReleaseEncryptHandler() {
- m_pSyntax->m_pCryptoHandler.reset();
+ m_pSyntax->m_pCryptoHandler.Reset();
m_pSecurityHandler.reset();
}