| Index: xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
|
| diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
|
| index 9935326cc117ca36dbada1b424e9ca69a6e7fc4a..51002bab841fa945599990af60f8782edff1c934 100644
|
| --- a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
|
| +++ b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
|
| @@ -24,6 +24,7 @@
|
|
|
| #include <algorithm>
|
| #include <memory>
|
| +#include <utility>
|
|
|
| #include "xfa/fxbarcode/BC_UtilCodingConvert.h"
|
| #include "xfa/fxbarcode/common/BC_CommonByteArray.h"
|
| @@ -408,7 +409,7 @@ void CBC_QRCoderEncoder::EncodeWithSpecifyVersion(
|
| qrCode->GetVersion(),
|
| qrCode->GetMaskPattern(), matrix.get(), e);
|
| BC_EXCEPTION_CHECK_ReturnVoid(e);
|
| - qrCode->SetMatrix(matrix.release());
|
| + qrCode->SetMatrix(std::move(matrix));
|
| if (!qrCode->IsValid()) {
|
| e = BCExceptionInvalidQRCode;
|
| BC_EXCEPTION_CHECK_ReturnVoid(e);
|
| @@ -492,7 +493,7 @@ catchException:
|
| CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(),
|
| qrCode->GetVersion(),
|
| qrCode->GetMaskPattern(), matrix.get(), e);
|
| - BC_EXCEPTION_CHECK_ReturnVoid(e) qrCode->SetMatrix(matrix.release());
|
| + BC_EXCEPTION_CHECK_ReturnVoid(e) qrCode->SetMatrix(std::move(matrix));
|
| if (!qrCode->IsValid()) {
|
| e = BCExceptionInvalidQRCode;
|
| BC_EXCEPTION_CHECK_ReturnVoid(e);
|
| @@ -542,7 +543,7 @@ void CBC_QRCoderEncoder::Encode(const CFX_WideString& content,
|
| CBC_QRCoderMatrixUtil::BuildMatrix(&finalBits, qrCode->GetECLevel(),
|
| qrCode->GetVersion(),
|
| qrCode->GetMaskPattern(), matrix.get(), e);
|
| - BC_EXCEPTION_CHECK_ReturnVoid(e) qrCode->SetMatrix(matrix.release());
|
| + BC_EXCEPTION_CHECK_ReturnVoid(e) qrCode->SetMatrix(std::move(matrix));
|
| if (!qrCode->IsValid()) {
|
| e = BCExceptionInvalidQRCode;
|
| BC_EXCEPTION_CHECK_ReturnVoid(e);
|
| @@ -595,7 +596,7 @@ int32_t CBC_QRCoderEncoder::ChooseMaskPattern(
|
| int32_t& e) {
|
| int32_t minPenalty = 65535;
|
| int32_t bestMaskPattern = -1;
|
| - for (int32_t maskPattern = 0; maskPattern < CBC_QRCoder::NUM_MASK_PATTERNS;
|
| + for (int32_t maskPattern = 0; maskPattern < CBC_QRCoder::kNumMaskPatterns;
|
| maskPattern++) {
|
| CBC_QRCoderMatrixUtil::BuildMatrix(bits, ecLevel, version, maskPattern,
|
| matrix, e);
|
| @@ -854,12 +855,13 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
|
| GetNumDataBytesAndNumECBytesForBlockID(numTotalBytes, numDataBytes,
|
| numRSBlocks, i, numDataBytesInBlock,
|
| numEcBytesInBlosk);
|
| - CBC_CommonByteArray* dataBytes = new CBC_CommonByteArray;
|
| + std::unique_ptr<CBC_CommonByteArray> dataBytes(new CBC_CommonByteArray);
|
| dataBytes->Set(bits->GetArray(), dataBytesOffset, numDataBytesInBlock);
|
| - CBC_CommonByteArray* ecBytes =
|
| - GenerateECBytes(dataBytes, numEcBytesInBlosk, e);
|
| + std::unique_ptr<CBC_CommonByteArray> ecBytes(
|
| + GenerateECBytes(dataBytes.get(), numEcBytesInBlosk, e));
|
| BC_EXCEPTION_CHECK_ReturnVoid(e);
|
| - blocks.Add(new CBC_QRCoderBlockPair(dataBytes, ecBytes));
|
| + blocks.Add(
|
| + new CBC_QRCoderBlockPair(std::move(dataBytes), std::move(ecBytes)));
|
| maxNumDataBytes = std::max(maxNumDataBytes, dataBytes->Size());
|
| maxNumEcBytes = std::max(maxNumEcBytes, ecBytes->Size());
|
| dataBytesOffset += numDataBytesInBlock;
|
|
|