diff options
author | weili <weili@chromium.org> | 2016-08-09 13:45:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-08-09 13:45:03 -0700 |
commit | e76203dbefd1df075a063ee019c3908513f6bee5 (patch) | |
tree | 2a763852e1d1de3eee6a67285ea96be2874bfb00 /xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp | |
parent | ad5ac7584844b03c5ceed082e5f5158a632405cc (diff) | |
download | pdfium-e76203dbefd1df075a063ee019c3908513f6bee5.tar.xz |
Use smart pointers for class owned pointers in xfa/fxbarcode
For classes under xfa/fxbarcode, use smart pointers instead
of raw pointer to make memory management easier.
Also fix some styling issues along the changes.
BUG=pdfium:518
Review-Url: https://codereview.chromium.org/2221023003
Diffstat (limited to 'xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp')
-rw-r--r-- | xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp index 8ed5971e0e..8fd85fc6a1 100644 --- a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -27,17 +27,16 @@ #include "xfa/fxbarcode/oned/BC_OnedUPCAWriter.h" CBC_OnedUPCAWriter::CBC_OnedUPCAWriter() { - m_subWriter = nullptr; m_bLeftPadding = TRUE; m_bRightPadding = TRUE; } + void CBC_OnedUPCAWriter::Init() { - m_subWriter = new CBC_OnedEAN13Writer; -} -CBC_OnedUPCAWriter::~CBC_OnedUPCAWriter() { - delete m_subWriter; + m_subWriter.reset(new CBC_OnedEAN13Writer); } +CBC_OnedUPCAWriter::~CBC_OnedUPCAWriter() {} + FX_BOOL CBC_OnedUPCAWriter::CheckContentValidity( const CFX_WideStringC& contents) { for (FX_STRSIZE i = 0; i < contents.GetLength(); ++i) { @@ -63,6 +62,7 @@ CFX_WideString CBC_OnedUPCAWriter::FilterContents( } return filtercontents; } + int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString& contents) { int32_t odd = 0; int32_t even = 0; @@ -79,6 +79,7 @@ int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString& contents) { checksum = (10 - checksum) % 10; return (checksum); } + uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t& outWidth, @@ -88,6 +89,7 @@ uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents, BC_EXCEPTION_CHECK_ReturnValue(e, nullptr); return ret; } + uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents, BCFORMAT format, int32_t& outWidth, |