summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-08-09 13:45:03 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-09 13:45:03 -0700
commite76203dbefd1df075a063ee019c3908513f6bee5 (patch)
tree2a763852e1d1de3eee6a67285ea96be2874bfb00 /xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp
parentad5ac7584844b03c5ceed082e5f5158a632405cc (diff)
downloadpdfium-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/qrcode/BC_QRCodeWriter.cpp')
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp
index c9f16cafd1..b2b87bc9a6 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCodeWriter.cpp
@@ -35,16 +35,19 @@ CBC_QRCodeWriter::CBC_QRCodeWriter() {
m_iCorrectLevel = 1;
m_iVersion = 0;
}
+
CBC_QRCodeWriter::~CBC_QRCodeWriter() {}
+
void CBC_QRCodeWriter::ReleaseAll() {
- delete CBC_ReedSolomonGF256::QRCodeFild;
- CBC_ReedSolomonGF256::QRCodeFild = nullptr;
+ delete CBC_ReedSolomonGF256::QRCodeField;
+ CBC_ReedSolomonGF256::QRCodeField = nullptr;
delete CBC_ReedSolomonGF256::DataMatrixField;
CBC_ReedSolomonGF256::DataMatrixField = nullptr;
CBC_QRCoderMode::Destroy();
CBC_QRCoderErrorCorrectionLevel::Destroy();
CBC_QRCoderVersion::Destroy();
}
+
FX_BOOL CBC_QRCodeWriter::SetVersion(int32_t version) {
if (version < 0 || version > 40) {
return FALSE;
@@ -52,6 +55,7 @@ FX_BOOL CBC_QRCodeWriter::SetVersion(int32_t version) {
m_iVersion = version;
return TRUE;
}
+
FX_BOOL CBC_QRCodeWriter::SetErrorCorrectionLevel(int32_t level) {
if (level < 0 || level > 3) {
return FALSE;
@@ -59,6 +63,7 @@ FX_BOOL CBC_QRCodeWriter::SetErrorCorrectionLevel(int32_t level) {
m_iCorrectLevel = level;
return TRUE;
}
+
uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents,
int32_t ecLevel,
int32_t& outWidth,
@@ -97,6 +102,7 @@ uint8_t* CBC_QRCodeWriter::Encode(const CFX_WideString& contents,
FXSYS_memcpy(result, qr.GetMatrix()->GetArray(), outWidth * outHeight);
return result;
}
+
uint8_t* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents,
BCFORMAT format,
int32_t& outWidth,
@@ -105,6 +111,7 @@ uint8_t* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents,
int32_t& e) {
return nullptr;
}
+
uint8_t* CBC_QRCodeWriter::Encode(const CFX_ByteString& contents,
BCFORMAT format,
int32_t& outWidth,