From 0804b3f5114ff09df9b10207997e1f16c868b45e Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 1 May 2017 14:06:10 -0700 Subject: Remove more |new|s, part 7 Remove some dead code along the way. Move some getters to headers and make const. Change-Id: I14280c247b0cfeff8ad7f606302bc8bba1960f1e Reviewed-on: https://pdfium-review.googlesource.com/4730 Commit-Queue: dsinclair Reviewed-by: dsinclair --- xfa/fwl/cfx_barcode.cpp | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'xfa/fwl') diff --git a/xfa/fwl/cfx_barcode.cpp b/xfa/fwl/cfx_barcode.cpp index e999d3a509..eeeac6164e 100644 --- a/xfa/fwl/cfx_barcode.cpp +++ b/xfa/fwl/cfx_barcode.cpp @@ -6,6 +6,8 @@ #include "xfa/fwl/cfx_barcode.h" +#include + #include "fxbarcode/cbc_codabar.h" #include "fxbarcode/cbc_code128.h" #include "fxbarcode/cbc_code39.h" @@ -17,33 +19,34 @@ #include "fxbarcode/cbc_qrcode.h" #include "fxbarcode/cbc_upca.h" #include "fxbarcode/utils.h" +#include "third_party/base/ptr_util.h" namespace { -CBC_CodeBase* CreateBarCodeEngineObject(BC_TYPE type) { +std::unique_ptr CreateBarCodeEngineObject(BC_TYPE type) { switch (type) { case BC_CODE39: - return new CBC_Code39(); + return pdfium::MakeUnique(); case BC_CODABAR: - return new CBC_Codabar(); + return pdfium::MakeUnique(); case BC_CODE128: - return new CBC_Code128(BC_CODE128_B); + return pdfium::MakeUnique(BC_CODE128_B); case BC_CODE128_B: - return new CBC_Code128(BC_CODE128_B); + return pdfium::MakeUnique(BC_CODE128_B); case BC_CODE128_C: - return new CBC_Code128(BC_CODE128_C); + return pdfium::MakeUnique(BC_CODE128_C); case BC_EAN8: - return new CBC_EAN8(); + return pdfium::MakeUnique(); case BC_UPCA: - return new CBC_UPCA(); + return pdfium::MakeUnique(); case BC_EAN13: - return new CBC_EAN13(); + return pdfium::MakeUnique(); case BC_QR_CODE: - return new CBC_QRCode(); + return pdfium::MakeUnique(); case BC_PDF417: - return new CBC_PDF417I(); + return pdfium::MakeUnique(); case BC_DATAMATRIX: - return new CBC_DataMatrix(); + return pdfium::MakeUnique(); case BC_UNKNOWN: default: return nullptr; @@ -57,7 +60,7 @@ CFX_Barcode::CFX_Barcode() {} CFX_Barcode::~CFX_Barcode() {} bool CFX_Barcode::Create(BC_TYPE type) { - m_pBCEngine.reset(CreateBarCodeEngineObject(type)); + m_pBCEngine = CreateBarCodeEngineObject(type); return !!m_pBCEngine; } -- cgit v1.2.3