summaryrefslogtreecommitdiff
path: root/xfa/fwl/cfx_barcode.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-01 14:06:10 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-02 13:59:36 +0000
commit0804b3f5114ff09df9b10207997e1f16c868b45e (patch)
tree59c6a06f89fe78ccab51b954386a03d8d7625aa2 /xfa/fwl/cfx_barcode.cpp
parent40baddef7fda756c29b813dc1fd67b28d745aa8c (diff)
downloadpdfium-0804b3f5114ff09df9b10207997e1f16c868b45e.tar.xz
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 <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fwl/cfx_barcode.cpp')
-rw-r--r--xfa/fwl/cfx_barcode.cpp29
1 files changed, 16 insertions, 13 deletions
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 <memory>
+
#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<CBC_CodeBase> CreateBarCodeEngineObject(BC_TYPE type) {
switch (type) {
case BC_CODE39:
- return new CBC_Code39();
+ return pdfium::MakeUnique<CBC_Code39>();
case BC_CODABAR:
- return new CBC_Codabar();
+ return pdfium::MakeUnique<CBC_Codabar>();
case BC_CODE128:
- return new CBC_Code128(BC_CODE128_B);
+ return pdfium::MakeUnique<CBC_Code128>(BC_CODE128_B);
case BC_CODE128_B:
- return new CBC_Code128(BC_CODE128_B);
+ return pdfium::MakeUnique<CBC_Code128>(BC_CODE128_B);
case BC_CODE128_C:
- return new CBC_Code128(BC_CODE128_C);
+ return pdfium::MakeUnique<CBC_Code128>(BC_CODE128_C);
case BC_EAN8:
- return new CBC_EAN8();
+ return pdfium::MakeUnique<CBC_EAN8>();
case BC_UPCA:
- return new CBC_UPCA();
+ return pdfium::MakeUnique<CBC_UPCA>();
case BC_EAN13:
- return new CBC_EAN13();
+ return pdfium::MakeUnique<CBC_EAN13>();
case BC_QR_CODE:
- return new CBC_QRCode();
+ return pdfium::MakeUnique<CBC_QRCode>();
case BC_PDF417:
- return new CBC_PDF417I();
+ return pdfium::MakeUnique<CBC_PDF417I>();
case BC_DATAMATRIX:
- return new CBC_DataMatrix();
+ return pdfium::MakeUnique<CBC_DataMatrix>();
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;
}