summaryrefslogtreecommitdiff
path: root/core/fpdfapi/parser
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r--core/fpdfapi/parser/cpdf_document_unittest.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp5
-rw-r--r--core/fpdfapi/parser/cpdf_stream.cpp3
3 files changed, 6 insertions, 4 deletions
diff --git a/core/fpdfapi/parser/cpdf_document_unittest.cpp b/core/fpdfapi/parser/cpdf_document_unittest.cpp
index e4fe033c8a..91beba3a6b 100644
--- a/core/fpdfapi/parser/cpdf_document_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_document_unittest.cpp
@@ -108,7 +108,7 @@ class CPDF_TestDocumentWithPageWithoutPageNum : public CPDF_Document {
allPages->Add(CreateNumberedPage(2));
CPDF_Dictionary* pagesDict =
CreatePageTreeNode(std::move(allPages), this, 3);
- m_pOwnedRootDict.reset(new CPDF_Dictionary());
+ m_pOwnedRootDict = pdfium::MakeUnique<CPDF_Dictionary>();
m_pOwnedRootDict->SetNewFor<CPDF_Reference>("Pages", this,
pagesDict->GetObjNum());
m_pRootDict = m_pOwnedRootDict.get();
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)
diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp
index 4f76ec1c63..3159791e82 100644
--- a/core/fpdfapi/parser/cpdf_stream.cpp
+++ b/core/fpdfapi/parser/cpdf_stream.cpp
@@ -13,6 +13,7 @@
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "third_party/base/numerics/safe_conversions.h"
+#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
CPDF_Stream::CPDF_Stream() {}
@@ -103,7 +104,7 @@ void CPDF_Stream::SetData(const uint8_t* pData, uint32_t size) {
FXSYS_memcpy(m_pDataBuf.get(), pData, size);
m_dwSize = size;
if (!m_pDict)
- m_pDict.reset(new CPDF_Dictionary());
+ m_pDict = pdfium::MakeUnique<CPDF_Dictionary>();
m_pDict->SetNewFor<CPDF_Number>("Length", static_cast<int>(size));
m_pDict->RemoveFor("Filter");
m_pDict->RemoveFor("DecodeParms");