Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Unified Diff: core/fpdfapi/parser/cpdf_parser.cpp

Issue 2571913002: Avoid the ptr.reset(new XXX()) anti-pattern (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_document_unittest.cpp ('k') | core/fpdfapi/parser/cpdf_stream.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/parser/cpdf_parser.cpp
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index 47c5c4eab43080c9ef445b3c02820c1ca13eb0f9..62364c0a753dd2098a170063230b53e7501e316f 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)
« no previous file with comments | « core/fpdfapi/parser/cpdf_document_unittest.cpp ('k') | core/fpdfapi/parser/cpdf_stream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698