From 2e6864282e65c55ff6809f5aaae011b31c3a361a Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Wed, 24 Feb 2016 18:20:51 -0800 Subject: 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 . --- xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'xfa/src/fxbarcode/qrcode/BC_QRCoderEncoder.cpp') 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 +#include #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 matrix(pDecoder); + std::unique_ptr 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 matrix(pDecoder); + std::unique_ptr 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 matrix(pDecoder); + std::unique_ptr 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); -- cgit v1.2.3