From ea23e0a2d6540d6fbc03ebc74e1e6c17dc254f32 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 1 May 2017 14:24:19 -0700 Subject: Remove more |new|s, part 8 Change-Id: I0e3f4bd33e66fd48db8371a5cc2f8db964720d08 Reviewed-on: https://pdfium-review.googlesource.com/4731 Reviewed-by: dsinclair Commit-Queue: dsinclair --- fxbarcode/cbc_codabar.cpp | 4 +++- fxbarcode/cbc_code128.cpp | 3 ++- fxbarcode/cbc_code39.cpp | 4 +++- fxbarcode/cbc_codebase.cpp | 5 ++++- fxbarcode/cbc_codebase.h | 2 +- fxbarcode/cbc_datamatrix.cpp | 4 +++- fxbarcode/cbc_ean13.cpp | 4 +++- fxbarcode/cbc_ean8.cpp | 3 ++- fxbarcode/cbc_onecode.cpp | 5 ++++- fxbarcode/cbc_onecode.h | 4 +++- fxbarcode/cbc_pdf417i.cpp | 4 +++- fxbarcode/cbc_qrcode.cpp | 4 +++- fxbarcode/cbc_upca.cpp | 3 ++- 13 files changed, 36 insertions(+), 13 deletions(-) diff --git a/fxbarcode/cbc_codabar.cpp b/fxbarcode/cbc_codabar.cpp index 1d671cebb3..d1501212cc 100644 --- a/fxbarcode/cbc_codabar.cpp +++ b/fxbarcode/cbc_codabar.cpp @@ -24,8 +24,10 @@ #include #include "fxbarcode/oned/BC_OnedCodaBarWriter.h" +#include "third_party/base/ptr_util.h" -CBC_Codabar::CBC_Codabar() : CBC_OneCode(new CBC_OnedCodaBarWriter) {} +CBC_Codabar::CBC_Codabar() + : CBC_OneCode(pdfium::MakeUnique()) {} CBC_Codabar::~CBC_Codabar() {} diff --git a/fxbarcode/cbc_code128.cpp b/fxbarcode/cbc_code128.cpp index 822aba06bc..93a4ae88f4 100644 --- a/fxbarcode/cbc_code128.cpp +++ b/fxbarcode/cbc_code128.cpp @@ -24,9 +24,10 @@ #include #include "fxbarcode/oned/BC_OnedCode128Writer.h" +#include "third_party/base/ptr_util.h" CBC_Code128::CBC_Code128(BC_TYPE type) - : CBC_OneCode(new CBC_OnedCode128Writer(type)) {} + : CBC_OneCode(pdfium::MakeUnique(type)) {} CBC_Code128::~CBC_Code128() {} diff --git a/fxbarcode/cbc_code39.cpp b/fxbarcode/cbc_code39.cpp index 8b7e08b67e..97debaa88f 100644 --- a/fxbarcode/cbc_code39.cpp +++ b/fxbarcode/cbc_code39.cpp @@ -24,8 +24,10 @@ #include #include "fxbarcode/oned/BC_OnedCode39Writer.h" +#include "third_party/base/ptr_util.h" -CBC_Code39::CBC_Code39() : CBC_OneCode(new CBC_OnedCode39Writer) {} +CBC_Code39::CBC_Code39() + : CBC_OneCode(pdfium::MakeUnique()) {} CBC_Code39::~CBC_Code39() {} diff --git a/fxbarcode/cbc_codebase.cpp b/fxbarcode/cbc_codebase.cpp index f283473775..2278f931e8 100644 --- a/fxbarcode/cbc_codebase.cpp +++ b/fxbarcode/cbc_codebase.cpp @@ -21,9 +21,12 @@ #include "fxbarcode/cbc_codebase.h" +#include + #include "fxbarcode/BC_Writer.h" -CBC_CodeBase::CBC_CodeBase(CBC_Writer* pWriter) : m_pBCWriter(pWriter) {} +CBC_CodeBase::CBC_CodeBase(std::unique_ptr pWriter) + : m_pBCWriter(std::move(pWriter)) {} CBC_CodeBase::~CBC_CodeBase() {} diff --git a/fxbarcode/cbc_codebase.h b/fxbarcode/cbc_codebase.h index 3c6b05129d..7b83fd70d2 100644 --- a/fxbarcode/cbc_codebase.h +++ b/fxbarcode/cbc_codebase.h @@ -21,7 +21,7 @@ class CFX_RenderDevice; class CBC_CodeBase { public: - explicit CBC_CodeBase(CBC_Writer* pWriter); + explicit CBC_CodeBase(std::unique_ptr pWriter); virtual ~CBC_CodeBase(); virtual BC_TYPE GetType() = 0; diff --git a/fxbarcode/cbc_datamatrix.cpp b/fxbarcode/cbc_datamatrix.cpp index 60b1f72d03..f1c98ced02 100644 --- a/fxbarcode/cbc_datamatrix.cpp +++ b/fxbarcode/cbc_datamatrix.cpp @@ -24,8 +24,10 @@ #include #include "fxbarcode/datamatrix/BC_DataMatrixWriter.h" +#include "third_party/base/ptr_util.h" -CBC_DataMatrix::CBC_DataMatrix() : CBC_CodeBase(new CBC_DataMatrixWriter) {} +CBC_DataMatrix::CBC_DataMatrix() + : CBC_CodeBase(pdfium::MakeUnique()) {} CBC_DataMatrix::~CBC_DataMatrix() {} diff --git a/fxbarcode/cbc_ean13.cpp b/fxbarcode/cbc_ean13.cpp index 73638b951f..1c57a877f2 100644 --- a/fxbarcode/cbc_ean13.cpp +++ b/fxbarcode/cbc_ean13.cpp @@ -24,8 +24,10 @@ #include #include "fxbarcode/oned/BC_OnedEAN13Writer.h" +#include "third_party/base/ptr_util.h" -CBC_EAN13::CBC_EAN13() : CBC_OneCode(new CBC_OnedEAN13Writer) {} +CBC_EAN13::CBC_EAN13() + : CBC_OneCode(pdfium::MakeUnique()) {} CBC_EAN13::~CBC_EAN13() {} diff --git a/fxbarcode/cbc_ean8.cpp b/fxbarcode/cbc_ean8.cpp index e5c26e6535..3b4369e80f 100644 --- a/fxbarcode/cbc_ean8.cpp +++ b/fxbarcode/cbc_ean8.cpp @@ -24,8 +24,9 @@ #include #include "fxbarcode/oned/BC_OnedEAN8Writer.h" +#include "third_party/base/ptr_util.h" -CBC_EAN8::CBC_EAN8() : CBC_OneCode(new CBC_OnedEAN8Writer) {} +CBC_EAN8::CBC_EAN8() : CBC_OneCode(pdfium::MakeUnique()) {} CBC_EAN8::~CBC_EAN8() {} diff --git a/fxbarcode/cbc_onecode.cpp b/fxbarcode/cbc_onecode.cpp index ec7033a1f1..2d64704f7e 100644 --- a/fxbarcode/cbc_onecode.cpp +++ b/fxbarcode/cbc_onecode.cpp @@ -21,9 +21,12 @@ #include "fxbarcode/cbc_onecode.h" +#include + #include "fxbarcode/oned/BC_OneDimWriter.h" -CBC_OneCode::CBC_OneCode(CBC_Writer* pWriter) : CBC_CodeBase(pWriter) {} +CBC_OneCode::CBC_OneCode(std::unique_ptr pWriter) + : CBC_CodeBase(std::move(pWriter)) {} CBC_OneCode::~CBC_OneCode() {} diff --git a/fxbarcode/cbc_onecode.h b/fxbarcode/cbc_onecode.h index 08abe6677d..e6b5b7b511 100644 --- a/fxbarcode/cbc_onecode.h +++ b/fxbarcode/cbc_onecode.h @@ -7,6 +7,8 @@ #ifndef FXBARCODE_CBC_ONECODE_H_ #define FXBARCODE_CBC_ONECODE_H_ +#include + #include "core/fxcrt/fx_string.h" #include "core/fxcrt/fx_system.h" #include "fxbarcode/cbc_codebase.h" @@ -16,7 +18,7 @@ class CFX_Font; class CBC_OneCode : public CBC_CodeBase { public: - explicit CBC_OneCode(CBC_Writer* pWriter); + explicit CBC_OneCode(std::unique_ptr pWriter); ~CBC_OneCode() override; virtual bool CheckContentValidity(const CFX_WideStringC& contents); diff --git a/fxbarcode/cbc_pdf417i.cpp b/fxbarcode/cbc_pdf417i.cpp index 51a3643c8b..23ad3ef74d 100644 --- a/fxbarcode/cbc_pdf417i.cpp +++ b/fxbarcode/cbc_pdf417i.cpp @@ -24,8 +24,10 @@ #include #include "fxbarcode/pdf417/BC_PDF417Writer.h" +#include "third_party/base/ptr_util.h" -CBC_PDF417I::CBC_PDF417I() : CBC_CodeBase(new CBC_PDF417Writer) {} +CBC_PDF417I::CBC_PDF417I() + : CBC_CodeBase(pdfium::MakeUnique()) {} CBC_PDF417I::~CBC_PDF417I() {} diff --git a/fxbarcode/cbc_qrcode.cpp b/fxbarcode/cbc_qrcode.cpp index 5bdc9768f0..6565623db2 100644 --- a/fxbarcode/cbc_qrcode.cpp +++ b/fxbarcode/cbc_qrcode.cpp @@ -24,8 +24,10 @@ #include #include "fxbarcode/qrcode/BC_QRCodeWriter.h" +#include "third_party/base/ptr_util.h" -CBC_QRCode::CBC_QRCode() : CBC_CodeBase(new CBC_QRCodeWriter) {} +CBC_QRCode::CBC_QRCode() + : CBC_CodeBase(pdfium::MakeUnique()) {} CBC_QRCode::~CBC_QRCode() {} diff --git a/fxbarcode/cbc_upca.cpp b/fxbarcode/cbc_upca.cpp index da22469c47..6c2e08a9fb 100644 --- a/fxbarcode/cbc_upca.cpp +++ b/fxbarcode/cbc_upca.cpp @@ -24,8 +24,9 @@ #include #include "fxbarcode/oned/BC_OnedUPCAWriter.h" +#include "third_party/base/ptr_util.h" -CBC_UPCA::CBC_UPCA() : CBC_OneCode(new CBC_OnedUPCAWriter) {} +CBC_UPCA::CBC_UPCA() : CBC_OneCode(pdfium::MakeUnique()) {} CBC_UPCA::~CBC_UPCA() {} -- cgit v1.2.3