diff options
author | Lei Zhang <thestig@chromium.org> | 2016-02-24 18:20:51 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2016-02-24 18:20:51 -0800 |
commit | 2e6864282e65c55ff6809f5aaae011b31c3a361a (patch) | |
tree | 98daecaf078529986a4efc2c43a3f43c0dcc01dd /xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp | |
parent | 969ea09df096b987662b9658e3ffa023ca4ebf70 (diff) | |
download | pdfium-2e6864282e65c55ff6809f5aaae011b31c3a361a.tar.xz |
Get rid of CBC_AutoPtr and use std::unique_ptr instead.
Also fix IWYU in various fxbarcode headers.
R=dsinclair@chromium.org
Review URL: https://codereview.chromium.org/1734823002 .
Diffstat (limited to 'xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp')
-rw-r--r-- | xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp index a451ab50b8..eb31ddc301 100644 --- a/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp +++ b/xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp @@ -20,7 +20,10 @@ * limitations under the License. */ +#include "xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h" + #include <algorithm> +#include <memory> #include "xfa/src/fxbarcode/BC_UtilCodingConvert.h" #include "xfa/src/fxbarcode/common/BC_CommonByteArray.h" @@ -31,8 +34,6 @@ #include "xfa/src/fxbarcode/qrcode/BC_QRCoderBitVector.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderBlockPair.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderECBlocks.h" -#include "xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h" -#include "xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderMaskUtil.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderMatrixUtil.h" #include "xfa/src/fxbarcode/qrcode/BC_QRCoderMode.h" @@ -408,10 +409,9 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion( qrCode->GetNumDataBytes(), qrCode->GetNumRSBlocks(), &finalBits, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - CBC_CommonByteMatrix* pDecoder = new CBC_CommonByteMatrix( - qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()); - pDecoder->Init(); - CBC_AutoPtr<CBC_CommonByteMatrix> matrix(pDecoder); + std::unique_ptr<CBC_CommonByteMatrix> matrix(new CBC_CommonByteMatrix( + qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth())); + matrix->Init(); int32_t maskPattern = ChooseMaskPattern( &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e); BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -499,10 +499,9 @@ catchException: qrCode->GetNumDataBytes(), qrCode->GetNumRSBlocks(), &finalBits, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - CBC_CommonByteMatrix* pDecoder = new CBC_CommonByteMatrix( - qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()); - pDecoder->Init(); - CBC_AutoPtr<CBC_CommonByteMatrix> matrix(pDecoder); + std::unique_ptr<CBC_CommonByteMatrix> matrix(new CBC_CommonByteMatrix( + qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth())); + matrix->Init(); int32_t maskPattern = ChooseMaskPattern( &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e); BC_EXCEPTION_CHECK_ReturnVoid(e); @@ -550,10 +549,9 @@ void CBC_QRCoderEncoder::Encode(const CFX_WideString& content, qrCode->GetNumDataBytes(), qrCode->GetNumRSBlocks(), &finalBits, e); BC_EXCEPTION_CHECK_ReturnVoid(e); - CBC_CommonByteMatrix* pDecoder = new CBC_CommonByteMatrix( - qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth()); - pDecoder->Init(); - CBC_AutoPtr<CBC_CommonByteMatrix> matrix(pDecoder); + std::unique_ptr<CBC_CommonByteMatrix> matrix(new CBC_CommonByteMatrix( + qrCode->GetMatrixWidth(), qrCode->GetMatrixWidth())); + matrix->Init(); int32_t maskPattern = ChooseMaskPattern( &finalBits, qrCode->GetECLevel(), qrCode->GetVersion(), matrix.get(), e); BC_EXCEPTION_CHECK_ReturnVoid(e); |