summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser/cpdf_parser.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-04-04 15:27:21 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-04 23:05:19 +0000
commit20a909e655147e21f966b95af6b683d85736c8c2 (patch)
tree1bf66f3587e271b31f3d9e4ec34f650dad6ffdea /core/fpdfapi/parser/cpdf_parser.cpp
parent236ce3ba2f274307db9ed49c595e242cd811716c (diff)
downloadpdfium-20a909e655147e21f966b95af6b683d85736c8c2.tar.xz
Remove a couple checks for MakeUnique failures.
Combine some common CCodec_Jbig2Module code. Change-Id: I9a046314bc0e9dddc9a8c1a06b37764e9f3cc4b6 Reviewed-on: https://pdfium-review.googlesource.com/3713 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser/cpdf_parser.cpp')
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index 20e9418904..ecdeeacb19 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -240,17 +240,13 @@ CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() {
if (m_pEncryptDict) {
CFX_ByteString filter = m_pEncryptDict->GetStringFor("Filter");
- std::unique_ptr<CPDF_SecurityHandler> pSecurityHandler;
- Error err = HANDLER_ERROR;
- if (filter == "Standard") {
- pSecurityHandler = pdfium::MakeUnique<CPDF_SecurityHandler>();
- err = PASSWORD_ERROR;
- }
- if (!pSecurityHandler)
+ if (filter != "Standard")
return HANDLER_ERROR;
+ std::unique_ptr<CPDF_SecurityHandler> pSecurityHandler =
+ pdfium::MakeUnique<CPDF_SecurityHandler>();
if (!pSecurityHandler->OnInit(this, m_pEncryptDict))
- return err;
+ return PASSWORD_ERROR;
m_pSecurityHandler = std::move(pSecurityHandler);
std::unique_ptr<CPDF_CryptoHandler> pCryptoHandler(