From 20a909e655147e21f966b95af6b683d85736c8c2 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Tue, 4 Apr 2017 15:27:21 -0700 Subject: Remove a couple checks for MakeUnique failures. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Combine some common CCodec_Jbig2Module code. Change-Id: I9a046314bc0e9dddc9a8c1a06b37764e9f3cc4b6 Reviewed-on: https://pdfium-review.googlesource.com/3713 Commit-Queue: Lei Zhang Reviewed-by: Nicolás Peña --- core/fpdfapi/parser/cpdf_parser.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'core/fpdfapi') 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 pSecurityHandler; - Error err = HANDLER_ERROR; - if (filter == "Standard") { - pSecurityHandler = pdfium::MakeUnique(); - err = PASSWORD_ERROR; - } - if (!pSecurityHandler) + if (filter != "Standard") return HANDLER_ERROR; + std::unique_ptr pSecurityHandler = + pdfium::MakeUnique(); if (!pSecurityHandler->OnInit(this, m_pEncryptDict)) - return err; + return PASSWORD_ERROR; m_pSecurityHandler = std::move(pSecurityHandler); std::unique_ptr pCryptoHandler( -- cgit v1.2.3