diff options
author | tsepez <tsepez@chromium.org> | 2016-12-14 05:57:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-14 05:57:10 -0800 |
commit | a9caab94c1f16929e5acf2676117224617d80f53 (patch) | |
tree | d71ff9a82fae6e6080deb76375f43056127b3ee2 /core/fpdfapi/parser/cpdf_parser.cpp | |
parent | 992ecf7c189e5cabf43e5ad862511cf63d030966 (diff) | |
download | pdfium-a9caab94c1f16929e5acf2676117224617d80f53.tar.xz |
Avoid the ptr.reset(new XXX()) anti-pattern
Be suspicious of |new|. This removes some of the
easy cases.
Review-Url: https://codereview.chromium.org/2571913002
Diffstat (limited to 'core/fpdfapi/parser/cpdf_parser.cpp')
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index 47c5c4eab4..62364c0a75 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -24,6 +24,7 @@ #include "core/fpdfapi/parser/fpdf_parser_utility.h" #include "core/fxcrt/fx_ext.h" #include "core/fxcrt/fx_safe_types.h" +#include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" namespace { @@ -57,7 +58,7 @@ CPDF_Parser::CPDF_Parser() m_FileVersion(0), m_pEncryptDict(nullptr), m_dwXrefStartObjNum(0) { - m_pSyntax.reset(new CPDF_SyntaxParser); + m_pSyntax = pdfium::MakeUnique<CPDF_SyntaxParser>(); } CPDF_Parser::~CPDF_Parser() { @@ -242,7 +243,7 @@ CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() { std::unique_ptr<CPDF_SecurityHandler> pSecurityHandler; Error err = HANDLER_ERROR; if (filter == "Standard") { - pSecurityHandler.reset(new CPDF_SecurityHandler); + pSecurityHandler = pdfium::MakeUnique<CPDF_SecurityHandler>(); err = PASSWORD_ERROR; } if (!pSecurityHandler) |