summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-03-28 12:06:45 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-03-28 19:22:50 +0000
commit8b6186f89002099d406508acecf4bccc4ef64c95 (patch)
treedf104ee415cfa90a53a23b88f1f66c3c2fd8d84e /xfa/fxbarcode
parentb0baff546bdcd911c80007829d9af5f05d0c04b0 (diff)
downloadpdfium-8b6186f89002099d406508acecf4bccc4ef64c95.tar.xz
Remove CFX_ArrayTemplate from FX barcode code.
This is now the last usage in pdfium, types to be removed in a follow-on CL. Change-Id: I16f67eb3eb99f21bb231829168203be125129ad7 Reviewed-on: https://pdfium-review.googlesource.com/3247 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxbarcode')
-rw-r--r--xfa/fxbarcode/BC_UtilCodingConvert.cpp12
-rw-r--r--xfa/fxbarcode/BC_UtilCodingConvert.h6
-rw-r--r--xfa/fxbarcode/BC_Utils.cpp13
-rw-r--r--xfa/fxbarcode/common/BC_CommonBitArray.cpp63
-rw-r--r--xfa/fxbarcode/common/BC_CommonBitArray.h22
-rw-r--r--xfa/fxbarcode/common/BC_CommonBitMatrix.cpp7
-rw-r--r--xfa/fxbarcode/common/BC_CommonByteArray.cpp2
-rw-r--r--xfa/fxbarcode/common/BC_CommonByteArray.h4
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp57
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h10
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp5
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp128
-rw-r--r--xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h10
-rw-r--r--xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp9
-rw-r--r--xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h6
-rw-r--r--xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp11
-rw-r--r--xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp49
-rw-r--r--xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h10
-rw-r--r--xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp24
-rw-r--r--xfa/fxbarcode/oned/BC_OnedCode128Writer.h6
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417.cpp28
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417.h8
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp44
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h12
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp35
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h12
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp16
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h13
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp6
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp17
-rw-r--r--xfa/fxbarcode/pdf417/BC_PDF417Writer.h4
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp12
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h6
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp25
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h2
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp472
-rw-r--r--xfa/fxbarcode/qrcode/BC_QRCoderVersion.h10
-rw-r--r--xfa/fxbarcode/utils.h4
38 files changed, 595 insertions, 585 deletions
diff --git a/xfa/fxbarcode/BC_UtilCodingConvert.cpp b/xfa/fxbarcode/BC_UtilCodingConvert.cpp
index c06cffc218..159bced47a 100644
--- a/xfa/fxbarcode/BC_UtilCodingConvert.cpp
+++ b/xfa/fxbarcode/BC_UtilCodingConvert.cpp
@@ -22,20 +22,20 @@ void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src,
}
void CBC_UtilCodingConvert::LocaleToUtf8(const CFX_ByteString& src,
- CFX_ArrayTemplate<uint8_t>& dst) {
+ std::vector<uint8_t>& dst) {
CFX_WideString unicode = CFX_WideString::FromLocal(src.AsStringC());
CFX_ByteString utf8 = unicode.UTF8Encode();
for (int32_t i = 0; i < utf8.GetLength(); i++) {
- dst.Add(utf8[i]);
+ dst.push_back(utf8[i]);
}
}
-void CBC_UtilCodingConvert::Utf8ToLocale(const CFX_ArrayTemplate<uint8_t>& src,
+void CBC_UtilCodingConvert::Utf8ToLocale(const std::vector<uint8_t>& src,
CFX_ByteString& dst) {
CFX_ByteString utf8;
- for (int32_t i = 0; i < src.GetSize(); i++) {
- utf8 += src[i];
- }
+ for (uint8_t value : src)
+ utf8 += value;
+
CFX_WideString unicode = CFX_WideString::FromUTF8(utf8.AsStringC());
dst = CFX_ByteString::FromUnicode(unicode);
}
diff --git a/xfa/fxbarcode/BC_UtilCodingConvert.h b/xfa/fxbarcode/BC_UtilCodingConvert.h
index 859eeea1e9..51cc93df19 100644
--- a/xfa/fxbarcode/BC_UtilCodingConvert.h
+++ b/xfa/fxbarcode/BC_UtilCodingConvert.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_BC_UTILCODINGCONVERT_H_
#define XFA_FXBARCODE_BC_UTILCODINGCONVERT_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
class CBC_UtilCodingConvert {
@@ -18,8 +20,8 @@ class CBC_UtilCodingConvert {
static void LocaleToUtf8(const CFX_ByteString& source,
CFX_ByteString& result);
static void LocaleToUtf8(const CFX_ByteString& source,
- CFX_ArrayTemplate<uint8_t>& result);
- static void Utf8ToLocale(const CFX_ArrayTemplate<uint8_t>& source,
+ std::vector<uint8_t>& result);
+ static void Utf8ToLocale(const std::vector<uint8_t>& source,
CFX_ByteString& result);
static void Utf8ToLocale(const uint8_t* source,
int32_t count,
diff --git a/xfa/fxbarcode/BC_Utils.cpp b/xfa/fxbarcode/BC_Utils.cpp
index b1dcf4a973..d0e89dce10 100644
--- a/xfa/fxbarcode/BC_Utils.cpp
+++ b/xfa/fxbarcode/BC_Utils.cpp
@@ -4,6 +4,8 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
#include "xfa/fxbarcode/utils.h"
@@ -21,14 +23,13 @@ bool BC_FX_ByteString_Replace(CFX_ByteString& dst,
}
return true;
}
+
void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, char c) {
- for (int32_t i = 0; i < count; i++) {
+ for (int32_t i = 0; i < count; i++)
dst += c;
- }
}
void BC_FX_ByteString_Append(CFX_ByteString& dst,
- const CFX_ArrayTemplate<uint8_t>& ba) {
- for (int32_t i = 0; i < ba.GetSize(); i++) {
- dst += ba[i];
- }
+ const std::vector<uint8_t>& ba) {
+ for (uint8_t value : ba)
+ dst += value;
}
diff --git a/xfa/fxbarcode/common/BC_CommonBitArray.cpp b/xfa/fxbarcode/common/BC_CommonBitArray.cpp
index 0371837fde..f53e677389 100644
--- a/xfa/fxbarcode/common/BC_CommonBitArray.cpp
+++ b/xfa/fxbarcode/common/BC_CommonBitArray.cpp
@@ -21,49 +21,63 @@
*/
#include "xfa/fxbarcode/common/BC_CommonBitArray.h"
+
+#include <utility>
+
#include "xfa/fxbarcode/utils.h"
CBC_CommonBitArray::CBC_CommonBitArray(CBC_CommonBitArray* array) {
m_size = array->GetSize();
- m_bits.Copy(array->GetBits());
+ m_bits = array->GetBits();
}
+
CBC_CommonBitArray::CBC_CommonBitArray() {
- m_bits.SetSize(1);
+ m_bits.resize(1);
m_size = 0;
}
+
CBC_CommonBitArray::CBC_CommonBitArray(int32_t size) {
- m_bits.SetSize((size + 31) >> 5);
+ m_bits.resize((size + 31) >> 5);
m_size = size;
}
-CBC_CommonBitArray::~CBC_CommonBitArray() {
- m_size = 0;
-}
-int32_t CBC_CommonBitArray::GetSize() {
+
+CBC_CommonBitArray::~CBC_CommonBitArray() {}
+
+size_t CBC_CommonBitArray::GetSize() {
return m_size;
}
-CFX_ArrayTemplate<int32_t>& CBC_CommonBitArray::GetBits() {
+
+std::vector<int32_t>& CBC_CommonBitArray::GetBits() {
return m_bits;
}
-int32_t CBC_CommonBitArray::GetSizeInBytes() {
+
+size_t CBC_CommonBitArray::GetSizeInBytes() {
return (m_size + 7) >> 3;
}
-bool CBC_CommonBitArray::Get(int32_t i) {
+
+bool CBC_CommonBitArray::Get(size_t i) {
return (m_bits[i >> 5] & (1 << (i & 0x1f))) != 0;
}
-void CBC_CommonBitArray::Set(int32_t i) {
+
+void CBC_CommonBitArray::Set(size_t i) {
m_bits[i >> 5] |= 1 << (i & 0x1F);
}
-void CBC_CommonBitArray::Flip(int32_t i) {
+
+void CBC_CommonBitArray::Flip(size_t i) {
m_bits[i >> 5] ^= 1 << (i & 0x1F);
}
-void CBC_CommonBitArray::SetBulk(int32_t i, int32_t newBits) {
+
+void CBC_CommonBitArray::SetBulk(size_t i, int32_t newBits) {
m_bits[i >> 5] = newBits;
}
+
void CBC_CommonBitArray::Clear() {
- FXSYS_memset(&m_bits[0], 0x00, m_bits.GetSize() * sizeof(int32_t));
+ for (auto& value : m_bits)
+ value = 0;
}
-bool CBC_CommonBitArray::IsRange(int32_t start,
- int32_t end,
+
+bool CBC_CommonBitArray::IsRange(size_t start,
+ size_t end,
bool value,
int32_t& e) {
if (end < start) {
@@ -95,19 +109,16 @@ bool CBC_CommonBitArray::IsRange(int32_t start,
}
return true;
}
+
int32_t* CBC_CommonBitArray::GetBitArray() {
- return &m_bits[0];
+ return m_bits.data();
}
+
void CBC_CommonBitArray::Reverse() {
- int32_t* newBits = FX_Alloc(int32_t, m_bits.GetSize());
- FXSYS_memset(newBits, 0x00, m_bits.GetSize() * sizeof(int32_t));
- int32_t size = m_size;
- int32_t i;
- for (i = 0; i < size; i++) {
- if (Get(size - i - 1)) {
+ std::vector<int32_t> newBits(m_bits.size());
+ for (size_t i = 0; i < m_size; i++) {
+ if (Get(m_size - i - 1))
newBits[i >> 5] |= 1 << (i & 0x1F);
- }
}
- FXSYS_memcpy(&m_bits[0], newBits, m_bits.GetSize() * sizeof(int32_t));
- FX_Free(newBits);
+ m_bits = std::move(newBits);
}
diff --git a/xfa/fxbarcode/common/BC_CommonBitArray.h b/xfa/fxbarcode/common/BC_CommonBitArray.h
index 6ad8ab321d..841ca99149 100644
--- a/xfa/fxbarcode/common/BC_CommonBitArray.h
+++ b/xfa/fxbarcode/common/BC_CommonBitArray.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_COMMON_BC_COMMONBITARRAY_H_
#define XFA_FXBARCODE_COMMON_BC_COMMONBITARRAY_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
class CBC_CommonBitArray {
@@ -16,21 +18,21 @@ class CBC_CommonBitArray {
CBC_CommonBitArray();
virtual ~CBC_CommonBitArray();
- int32_t GetSize();
- CFX_ArrayTemplate<int32_t>& GetBits();
- int32_t GetSizeInBytes();
- bool Get(int32_t i);
- void Set(int32_t i);
- void Flip(int32_t i);
- void SetBulk(int32_t i, int32_t newBits);
- bool IsRange(int32_t start, int32_t end, bool value, int32_t& e);
+ size_t GetSize();
+ size_t GetSizeInBytes();
+ std::vector<int32_t>& GetBits();
int32_t* GetBitArray();
+ bool Get(size_t i);
+ void Set(size_t i);
+ void Flip(size_t i);
+ void SetBulk(size_t i, int32_t newBits);
+ bool IsRange(size_t start, size_t end, bool value, int32_t& e);
void Reverse();
void Clear();
private:
- int32_t m_size;
- CFX_ArrayTemplate<int32_t> m_bits;
+ size_t m_size;
+ std::vector<int32_t> m_bits;
};
#endif // XFA_FXBARCODE_COMMON_BC_COMMONBITARRAY_H_
diff --git a/xfa/fxbarcode/common/BC_CommonBitMatrix.cpp b/xfa/fxbarcode/common/BC_CommonBitMatrix.cpp
index b9b218c60f..5e65bd74cf 100644
--- a/xfa/fxbarcode/common/BC_CommonBitMatrix.cpp
+++ b/xfa/fxbarcode/common/BC_CommonBitMatrix.cpp
@@ -104,7 +104,7 @@ void CBC_CommonBitMatrix::SetRegion(int32_t left,
CBC_CommonBitArray* CBC_CommonBitMatrix::GetRow(int32_t y,
CBC_CommonBitArray* row) {
CBC_CommonBitArray* rowArray = nullptr;
- if (!row || row->GetSize() < m_width) {
+ if (!row || static_cast<int32_t>(row->GetSize()) < m_width) {
rowArray = new CBC_CommonBitArray(m_width);
} else {
rowArray = new CBC_CommonBitArray(row);
@@ -123,11 +123,12 @@ void CBC_CommonBitMatrix::SetRow(int32_t y, CBC_CommonBitArray* row) {
l++;
}
}
+
void CBC_CommonBitMatrix::SetCol(int32_t y, CBC_CommonBitArray* col) {
- for (int32_t i = 0; i < col->GetBits().GetSize(); i++) {
+ for (size_t i = 0; i < col->GetBits().size(); ++i)
m_bits[i * m_rowSize + y] = col->GetBitArray()[i];
- }
}
+
int32_t CBC_CommonBitMatrix::GetWidth() {
return m_width;
}
diff --git a/xfa/fxbarcode/common/BC_CommonByteArray.cpp b/xfa/fxbarcode/common/BC_CommonByteArray.cpp
index 050ecb0bf8..e950f0f941 100644
--- a/xfa/fxbarcode/common/BC_CommonByteArray.cpp
+++ b/xfa/fxbarcode/common/BC_CommonByteArray.cpp
@@ -85,7 +85,7 @@ void CBC_CommonByteArray::Set(uint8_t* source, int32_t offset, int32_t count) {
FXSYS_memcpy(m_bytes, source + offset, count);
m_index = count;
}
-void CBC_CommonByteArray::Set(CFX_ArrayTemplate<uint8_t>* source,
+void CBC_CommonByteArray::Set(std::vector<uint8_t>* source,
int32_t offset,
int32_t count) {
FX_Free(m_bytes);
diff --git a/xfa/fxbarcode/common/BC_CommonByteArray.h b/xfa/fxbarcode/common/BC_CommonByteArray.h
index 009f625a86..e1fe4c7f2e 100644
--- a/xfa/fxbarcode/common/BC_CommonByteArray.h
+++ b/xfa/fxbarcode/common/BC_CommonByteArray.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_
#define XFA_FXBARCODE_COMMON_BC_COMMONBYTEARRAY_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
// TODO(weili): The usage of this class should be replaced by
@@ -25,7 +27,7 @@ class CBC_CommonByteArray {
void AppendByte(int32_t value);
void Reserve(int32_t capacity);
void Set(uint8_t* source, int32_t offset, int32_t count);
- void Set(CFX_ArrayTemplate<uint8_t>* source, int32_t offset, int32_t count);
+ void Set(std::vector<uint8_t>* source, int32_t offset, int32_t count);
private:
int32_t m_size;
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
index 7698890366..82a729b067 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.cpp
@@ -30,18 +30,17 @@
CBC_ReedSolomonEncoder::CBC_ReedSolomonEncoder(CBC_ReedSolomonGF256* field) {
m_field = field;
}
+
void CBC_ReedSolomonEncoder::Init() {
- m_cachedGenerators.Add(new CBC_ReedSolomonGF256Poly(m_field, 1));
+ m_cachedGenerators.push_back(new CBC_ReedSolomonGF256Poly(m_field, 1));
}
-CBC_ReedSolomonGF256Poly* CBC_ReedSolomonEncoder::BuildGenerator(int32_t degree,
+
+CBC_ReedSolomonGF256Poly* CBC_ReedSolomonEncoder::BuildGenerator(size_t degree,
int32_t& e) {
- if (degree >= m_cachedGenerators.GetSize()) {
- CBC_ReedSolomonGF256Poly* lastGenerator =
- m_cachedGenerators[m_cachedGenerators.GetSize() - 1];
- for (int32_t d = m_cachedGenerators.GetSize(); d <= degree; d++) {
- CFX_ArrayTemplate<int32_t> temp;
- temp.Add(1);
- temp.Add(m_field->Exp(d - 1));
+ if (degree >= m_cachedGenerators.size()) {
+ CBC_ReedSolomonGF256Poly* lastGenerator = m_cachedGenerators.back();
+ for (size_t d = m_cachedGenerators.size(); d <= degree; ++d) {
+ std::vector<int32_t> temp = {1, m_field->Exp(d - 1)};
CBC_ReedSolomonGF256Poly temp_poly;
temp_poly.Init(m_field, &temp, e);
if (e != BCExceptionNO)
@@ -50,31 +49,31 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonEncoder::BuildGenerator(int32_t degree,
lastGenerator->Multiply(&temp_poly, e);
if (e != BCExceptionNO)
return nullptr;
- m_cachedGenerators.Add(nextGenerator);
+ m_cachedGenerators.push_back(nextGenerator);
lastGenerator = nextGenerator;
}
}
return m_cachedGenerators[degree];
}
-void CBC_ReedSolomonEncoder::Encode(CFX_ArrayTemplate<int32_t>* toEncode,
- int32_t ecBytes,
+
+void CBC_ReedSolomonEncoder::Encode(std::vector<int32_t>* toEncode,
+ size_t ecBytes,
int32_t& e) {
if (ecBytes == 0) {
e = BCExceptionNoCorrectionBytes;
return;
}
- int32_t dataBytes = toEncode->GetSize() - ecBytes;
- if (dataBytes <= 0) {
+ if (toEncode->size() <= ecBytes) {
e = BCExceptionNoDataBytesProvided;
return;
}
CBC_ReedSolomonGF256Poly* generator = BuildGenerator(ecBytes, e);
if (e != BCExceptionNO)
return;
- CFX_ArrayTemplate<int32_t> infoCoefficients;
- infoCoefficients.SetSize(dataBytes);
- for (int32_t x = 0; x < dataBytes; x++) {
- infoCoefficients[x] = toEncode->operator[](x);
+ size_t dataBytes = toEncode->size() - ecBytes;
+ std::vector<int32_t> infoCoefficients(dataBytes);
+ for (size_t x = 0; x < dataBytes; x++) {
+ infoCoefficients[x] = (*toEncode)[x];
}
CBC_ReedSolomonGF256Poly info;
info.Init(m_field, &infoCoefficients, e);
@@ -84,25 +83,23 @@ void CBC_ReedSolomonEncoder::Encode(CFX_ArrayTemplate<int32_t>* toEncode,
info.MultiplyByMonomial(ecBytes, 1, e));
if (e != BCExceptionNO)
return;
- std::unique_ptr<CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>> temp(
+ std::unique_ptr<std::vector<CBC_ReedSolomonGF256Poly*>> temp(
infoTemp->Divide(generator, e));
if (e != BCExceptionNO)
return;
CBC_ReedSolomonGF256Poly* remainder = (*temp)[1];
- CFX_ArrayTemplate<int32_t>* coefficients = remainder->GetCoefficients();
- int32_t numZeroCoefficients = ecBytes - coefficients->GetSize();
- for (int32_t i = 0; i < numZeroCoefficients; i++) {
+ std::vector<int32_t>* coefficients = remainder->GetCoefficients();
+ size_t numZeroCoefficients =
+ ecBytes > coefficients->size() ? ecBytes - coefficients->size() : 0;
+ for (size_t i = 0; i < numZeroCoefficients; i++)
(*toEncode)[dataBytes + i] = 0;
- }
- for (int32_t y = 0; y < coefficients->GetSize(); y++) {
- (*toEncode)[dataBytes + numZeroCoefficients + y] =
- coefficients->operator[](y);
- }
- for (int32_t k = 0; k < temp->GetSize(); k++) {
+ for (size_t y = 0; y < coefficients->size(); y++)
+ (*toEncode)[dataBytes + numZeroCoefficients + y] = (*coefficients)[y];
+ for (size_t k = 0; k < temp->size(); k++)
delete (*temp)[k];
- }
}
+
CBC_ReedSolomonEncoder::~CBC_ReedSolomonEncoder() {
- for (int32_t i = 0; i < m_cachedGenerators.GetSize(); i++)
+ for (size_t i = 0; i < m_cachedGenerators.size(); i++)
delete m_cachedGenerators[i];
}
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h
index 95828f1a0e..5e5c7c52d3 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomon.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
#define XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
class CBC_ReedSolomonGF256;
@@ -17,16 +19,14 @@ class CBC_ReedSolomonEncoder {
explicit CBC_ReedSolomonEncoder(CBC_ReedSolomonGF256* field);
virtual ~CBC_ReedSolomonEncoder();
- void Encode(CFX_ArrayTemplate<int32_t>* toEncode,
- int32_t ecBytes,
- int32_t& e);
+ void Encode(std::vector<int32_t>* toEncode, size_t ecBytes, int32_t& e);
virtual void Init();
private:
- CBC_ReedSolomonGF256Poly* BuildGenerator(int32_t degree, int32_t& e);
+ CBC_ReedSolomonGF256Poly* BuildGenerator(size_t degree, int32_t& e);
CBC_ReedSolomonGF256* m_field;
- CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*> m_cachedGenerators;
+ std::vector<CBC_ReedSolomonGF256Poly*> m_cachedGenerators;
};
#endif // XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMON_H_
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
index ce84d8e08d..349ed0789a 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.cpp
@@ -22,6 +22,8 @@
#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
+#include <vector>
+
#include "third_party/base/ptr_util.h"
#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
@@ -86,8 +88,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256::BuildMonomial(
return nullptr;
return temp;
}
- CFX_ArrayTemplate<int32_t> coefficients;
- coefficients.SetSize(degree + 1);
+ std::vector<int32_t> coefficients(degree + 1);
coefficients[0] = coefficient;
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
temp->Init(this, &coefficients, e);
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
index a0bbc025c4..e4ee30b586 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.cpp
@@ -23,7 +23,9 @@
#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h"
#include <memory>
+#include <utility>
+#include "third_party/base/stl_util.h"
#include "xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256.h"
CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field,
@@ -32,69 +34,75 @@ CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly(CBC_ReedSolomonGF256* field,
return;
m_field = field;
- m_coefficients.Add(coefficients);
+ m_coefficients.push_back(coefficients);
}
+
CBC_ReedSolomonGF256Poly::CBC_ReedSolomonGF256Poly() {
m_field = nullptr;
}
+
void CBC_ReedSolomonGF256Poly::Init(CBC_ReedSolomonGF256* field,
- CFX_ArrayTemplate<int32_t>* coefficients,
+ std::vector<int32_t>* coefficients,
int32_t& e) {
- if (!coefficients || coefficients->GetSize() == 0) {
+ if (!coefficients || coefficients->empty()) {
e = BCExceptionCoefficientsSizeIsNull;
return;
}
m_field = field;
- int32_t coefficientsLength = coefficients->GetSize();
- if ((coefficientsLength > 1 && (*coefficients)[0] == 0)) {
- int32_t firstNonZero = 1;
- while ((firstNonZero < coefficientsLength) &&
- ((*coefficients)[firstNonZero] == 0)) {
+ size_t coefficientsLength = coefficients->size();
+ if (coefficientsLength > 1 && coefficients->front() == 0) {
+ size_t firstNonZero = 1;
+ while (firstNonZero < coefficientsLength &&
+ (*coefficients)[firstNonZero] == 0) {
firstNonZero++;
}
if (firstNonZero == coefficientsLength) {
- m_coefficients.Copy(*(m_field->GetZero()->GetCoefficients()));
+ m_coefficients = *(m_field->GetZero()->GetCoefficients());
} else {
- m_coefficients.SetSize(coefficientsLength - firstNonZero);
- for (int32_t i = firstNonZero, j = 0; i < coefficientsLength; i++, j++) {
- m_coefficients[j] = coefficients->operator[](i);
- }
+ m_coefficients.resize(coefficientsLength - firstNonZero);
+ for (size_t i = firstNonZero, j = 0; i < coefficientsLength; i++, j++)
+ m_coefficients[j] = (*coefficients)[i];
}
} else {
- m_coefficients.Copy(*coefficients);
+ m_coefficients = *coefficients;
}
}
-CFX_ArrayTemplate<int32_t>* CBC_ReedSolomonGF256Poly::GetCoefficients() {
+
+std::vector<int32_t>* CBC_ReedSolomonGF256Poly::GetCoefficients() {
return &m_coefficients;
}
+
int32_t CBC_ReedSolomonGF256Poly::GetDegree() {
- return m_coefficients.GetSize() - 1;
+ return pdfium::CollectionSize<int32_t>(m_coefficients) - 1;
}
+
bool CBC_ReedSolomonGF256Poly::IsZero() {
- return m_coefficients[0] == 0;
+ return m_coefficients.front() == 0;
}
+
int32_t CBC_ReedSolomonGF256Poly::GetCoefficients(int32_t degree) {
- return m_coefficients[m_coefficients.GetSize() - 1 - degree];
+ return m_coefficients[m_coefficients.size() - 1 - degree];
}
+
int32_t CBC_ReedSolomonGF256Poly::EvaluateAt(int32_t a) {
if (a == 0) {
return GetCoefficients(0);
}
- int32_t size = m_coefficients.GetSize();
+ size_t size = m_coefficients.size();
if (a == 1) {
int32_t result = 0;
- for (int32_t i = 0; i < size; i++) {
+ for (size_t i = 0; i < size; i++)
result = CBC_ReedSolomonGF256::AddOrSubtract(result, m_coefficients[i]);
- }
return result;
}
int32_t result = m_coefficients[0];
- for (int32_t j = 1; j < size; j++) {
+ for (size_t j = 1; j < size; j++) {
result = CBC_ReedSolomonGF256::AddOrSubtract(m_field->Multiply(a, result),
m_coefficients[j]);
}
return result;
}
+
CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Clone(int32_t& e) {
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
temp->Init(m_field, &m_coefficients, e);
@@ -110,26 +118,19 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::AddOrSubtract(
if (other->IsZero())
return Clone(e);
- CFX_ArrayTemplate<int32_t> smallerCoefficients;
- smallerCoefficients.Copy(m_coefficients);
- CFX_ArrayTemplate<int32_t> largerCoefficients;
- largerCoefficients.Copy(*(other->GetCoefficients()));
- if (smallerCoefficients.GetSize() > largerCoefficients.GetSize()) {
- CFX_ArrayTemplate<int32_t> temp;
- temp.Copy(smallerCoefficients);
- smallerCoefficients.Copy(largerCoefficients);
- largerCoefficients.Copy(temp);
+ std::vector<int32_t> smallerCoefficients = m_coefficients;
+ std::vector<int32_t> largerCoefficients = *(other->GetCoefficients());
+ if (smallerCoefficients.size() > largerCoefficients.size()) {
+ std::swap(smallerCoefficients, largerCoefficients);
}
- CFX_ArrayTemplate<int32_t> sumDiff;
- sumDiff.SetSize(largerCoefficients.GetSize());
- int32_t lengthDiff =
- largerCoefficients.GetSize() - smallerCoefficients.GetSize();
- for (int32_t i = 0; i < lengthDiff; i++) {
+ std::vector<int32_t> sumDiff(largerCoefficients.size());
+ size_t lengthDiff = largerCoefficients.size() - smallerCoefficients.size();
+ for (size_t i = 0; i < lengthDiff; i++) {
sumDiff[i] = largerCoefficients[i];
}
- for (int32_t j = lengthDiff; j < largerCoefficients.GetSize(); j++) {
- sumDiff[j] = (CBC_ReedSolomonGF256::AddOrSubtract(
- smallerCoefficients[j - lengthDiff], largerCoefficients[j]));
+ for (size_t j = lengthDiff; j < largerCoefficients.size(); j++) {
+ sumDiff[j] = CBC_ReedSolomonGF256::AddOrSubtract(
+ smallerCoefficients[j - lengthDiff], largerCoefficients[j]);
}
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
temp->Init(m_field, &sumDiff, e);
@@ -143,20 +144,17 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(
if (IsZero() || other->IsZero())
return m_field->GetZero()->Clone(e);
- CFX_ArrayTemplate<int32_t> aCoefficients;
- aCoefficients.Copy(m_coefficients);
- int32_t aLength = m_coefficients.GetSize();
- CFX_ArrayTemplate<int32_t> bCoefficients;
- bCoefficients.Copy(*(other->GetCoefficients()));
- int32_t bLength = other->GetCoefficients()->GetSize();
- CFX_ArrayTemplate<int32_t> product;
- product.SetSize(aLength + bLength - 1);
- for (int32_t i = 0; i < aLength; i++) {
+ std::vector<int32_t> aCoefficients = m_coefficients;
+ std::vector<int32_t> bCoefficients = *(other->GetCoefficients());
+ size_t aLength = aCoefficients.size();
+ size_t bLength = bCoefficients.size();
+ std::vector<int32_t> product(aLength + bLength - 1);
+ for (size_t i = 0; i < aLength; i++) {
int32_t aCoeff = m_coefficients[i];
- for (int32_t j = 0; j < bLength; j++) {
+ for (size_t j = 0; j < bLength; j++) {
product[i + j] = CBC_ReedSolomonGF256::AddOrSubtract(
product[i + j],
- m_field->Multiply(aCoeff, other->GetCoefficients()->operator[](j)));
+ m_field->Multiply(aCoeff, (*other->GetCoefficients())[j]));
}
}
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
@@ -172,10 +170,9 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::Multiply(int32_t scalar,
if (scalar == 1)
return Clone(e);
- int32_t size = m_coefficients.GetSize();
- CFX_ArrayTemplate<int32_t> product;
- product.SetSize(size);
- for (int32_t i = 0; i < size; i++) {
+ size_t size = m_coefficients.size();
+ std::vector<int32_t> product(size);
+ for (size_t i = 0; i < size; i++) {
product[i] = m_field->Multiply(m_coefficients[i], scalar);
}
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
@@ -195,11 +192,10 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial(
if (coefficient == 0)
return m_field->GetZero()->Clone(e);
- int32_t size = m_coefficients.GetSize();
- CFX_ArrayTemplate<int32_t> product;
- product.SetSize(size + degree);
- for (int32_t i = 0; i < size; i++) {
- product[i] = (m_field->Multiply(m_coefficients[i], coefficient));
+ size_t size = m_coefficients.size();
+ std::vector<int32_t> product(size + degree);
+ for (size_t i = 0; i < size; i++) {
+ product[i] = m_field->Multiply(m_coefficients[i], coefficient);
}
CBC_ReedSolomonGF256Poly* temp = new CBC_ReedSolomonGF256Poly();
temp->Init(m_field, &product, e);
@@ -208,7 +204,7 @@ CBC_ReedSolomonGF256Poly* CBC_ReedSolomonGF256Poly::MultiplyByMonomial(
return temp;
}
-CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* CBC_ReedSolomonGF256Poly::Divide(
+std::vector<CBC_ReedSolomonGF256Poly*>* CBC_ReedSolomonGF256Poly::Divide(
CBC_ReedSolomonGF256Poly* other,
int32_t& e) {
if (other->IsZero()) {
@@ -247,13 +243,11 @@ CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* CBC_ReedSolomonGF256Poly::Divide(
if (e != BCExceptionNO)
return nullptr;
}
- CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* tempPtrA =
- new CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>();
- tempPtrA->Add(quotient.release());
- tempPtrA->Add(remainder.release());
+ std::vector<CBC_ReedSolomonGF256Poly*>* tempPtrA =
+ new std::vector<CBC_ReedSolomonGF256Poly*>();
+ tempPtrA->push_back(quotient.release());
+ tempPtrA->push_back(remainder.release());
return tempPtrA;
}
-CBC_ReedSolomonGF256Poly::~CBC_ReedSolomonGF256Poly() {
- m_coefficients.RemoveAll();
-}
+CBC_ReedSolomonGF256Poly::~CBC_ReedSolomonGF256Poly() {}
diff --git a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h
index ff93264e00..6fc7509399 100644
--- a/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h
+++ b/xfa/fxbarcode/common/reedsolomon/BC_ReedSolomonGF256Poly.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
#define XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
class CBC_ReedSolomonGF256;
@@ -17,11 +19,11 @@ class CBC_ReedSolomonGF256Poly final {
CBC_ReedSolomonGF256Poly();
~CBC_ReedSolomonGF256Poly();
void Init(CBC_ReedSolomonGF256* field,
- CFX_ArrayTemplate<int32_t>* coefficients,
+ std::vector<int32_t>* coefficients,
int32_t& e);
int32_t GetCoefficients(int32_t degree);
- CFX_ArrayTemplate<int32_t>* GetCoefficients();
+ std::vector<int32_t>* GetCoefficients();
int32_t GetDegree();
bool IsZero();
int32_t EvaluateAt(int32_t a);
@@ -33,7 +35,7 @@ class CBC_ReedSolomonGF256Poly final {
CBC_ReedSolomonGF256Poly* MultiplyByMonomial(int32_t degree,
int32_t coefficient,
int32_t& e);
- CFX_ArrayTemplate<CBC_ReedSolomonGF256Poly*>* Divide(
+ std::vector<CBC_ReedSolomonGF256Poly*>* Divide(
CBC_ReedSolomonGF256Poly* other,
int32_t& e);
@@ -41,7 +43,7 @@ class CBC_ReedSolomonGF256Poly final {
private:
CBC_ReedSolomonGF256* m_field;
- CFX_ArrayTemplate<int32_t> m_coefficients;
+ std::vector<int32_t> m_coefficients;
};
#endif // XFA_FXBARCODE_COMMON_REEDSOLOMON_BC_REEDSOLOMONGF256POLY_H_
diff --git a/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp b/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp
index e7eef07b47..f027486ee3 100644
--- a/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.cpp
@@ -29,21 +29,20 @@ CBC_DefaultPlacement::CBC_DefaultPlacement(CFX_WideString codewords,
m_codewords = codewords;
m_numcols = numcols;
m_numrows = numrows;
- m_bits.SetSize(numcols * numrows);
+ m_bits.resize(numcols * numrows);
for (int32_t i = 0; i < numcols * numrows; i++) {
m_bits[i] = (uint8_t)2;
}
}
-CBC_DefaultPlacement::~CBC_DefaultPlacement() {
- m_bits.RemoveAll();
-}
+CBC_DefaultPlacement::~CBC_DefaultPlacement() {}
+
int32_t CBC_DefaultPlacement::getNumrows() {
return m_numrows;
}
int32_t CBC_DefaultPlacement::getNumcols() {
return m_numcols;
}
-CFX_ArrayTemplate<uint8_t>& CBC_DefaultPlacement::getBits() {
+std::vector<uint8_t>& CBC_DefaultPlacement::getBits() {
return m_bits;
}
bool CBC_DefaultPlacement::getBit(int32_t col, int32_t row) {
diff --git a/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h b/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h
index 36a7ab2615..d3c38ca13d 100644
--- a/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h
+++ b/xfa/fxbarcode/datamatrix/BC_DefaultPlacement.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_DATAMATRIX_BC_DEFAULTPLACEMENT_H_
#define XFA_FXBARCODE_DATAMATRIX_BC_DEFAULTPLACEMENT_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
class CBC_DefaultPlacement {
@@ -18,7 +20,7 @@ class CBC_DefaultPlacement {
int32_t getNumrows();
int32_t getNumcols();
- CFX_ArrayTemplate<uint8_t>& getBits();
+ std::vector<uint8_t>& getBits();
bool getBit(int32_t col, int32_t row);
void setBit(int32_t col, int32_t row, bool bit);
bool hasBit(int32_t col, int32_t row);
@@ -28,7 +30,7 @@ class CBC_DefaultPlacement {
CFX_WideString m_codewords;
int32_t m_numrows;
int32_t m_numcols;
- CFX_ArrayTemplate<uint8_t> m_bits;
+ std::vector<uint8_t> m_bits;
void module(int32_t row, int32_t col, int32_t pos, int32_t bit);
void utah(int32_t row, int32_t col, int32_t pos);
void corner1(int32_t pos);
diff --git a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
index ffdd308d54..0af52faedd 100644
--- a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
@@ -20,6 +20,8 @@
* limitations under the License.
*/
+#include <vector>
+
#include "xfa/fxbarcode/datamatrix/BC_Encoder.h"
#include "xfa/fxbarcode/datamatrix/BC_ErrorCorrection.h"
#include "xfa/fxbarcode/datamatrix/BC_SymbolInfo.h"
@@ -133,12 +135,9 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords,
return CFX_WideString();
sb += ecc;
} else {
- CFX_ArrayTemplate<int32_t> dataSizes;
- dataSizes.SetSize(blockCount);
- CFX_ArrayTemplate<int32_t> errorSizes;
- errorSizes.SetSize(blockCount);
- CFX_ArrayTemplate<int32_t> startPos;
- startPos.SetSize(blockCount);
+ std::vector<int32_t> dataSizes(blockCount);
+ std::vector<int32_t> errorSizes(blockCount);
+ std::vector<int32_t> startPos(blockCount);
for (int32_t i = 0; i < blockCount; i++) {
dataSizes[i] = symbolInfo->getDataLengthForInterleavedBlock(i + 1);
errorSizes[i] = symbolInfo->getErrorLengthForInterleavedBlock(i + 1);
diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
index 90877c7ef3..3ece55f2e9 100644
--- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
@@ -58,13 +58,12 @@ const wchar_t CBC_HighLevelEncoder::MACRO_TRAILER = 0x0004;
CBC_HighLevelEncoder::CBC_HighLevelEncoder() {}
CBC_HighLevelEncoder::~CBC_HighLevelEncoder() {}
-CFX_ArrayTemplate<uint8_t>& CBC_HighLevelEncoder::getBytesForMessage(
+std::vector<uint8_t>& CBC_HighLevelEncoder::getBytesForMessage(
CFX_WideString msg) {
CFX_ByteString bytestr;
CBC_UtilCodingConvert::UnicodeToUTF8(msg, bytestr);
- for (int32_t i = 0; i < bytestr.GetLength(); i++) {
- m_bytearray.Add(bytestr.GetAt(i));
- }
+ for (int32_t i = 0; i < bytestr.GetLength(); i++)
+ m_bytearray.push_back(bytestr.GetAt(i));
return m_bytearray;
}
CFX_WideString CBC_HighLevelEncoder::encodeHighLevel(CFX_WideString msg,
@@ -161,10 +160,8 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg,
while (true) {
if ((startpos + charsProcessed) == msg.GetLength()) {
int32_t min = std::numeric_limits<int32_t>::max();
- CFX_ArrayTemplate<uint8_t> mins;
- mins.SetSize(6);
- CFX_ArrayTemplate<int32_t> intCharCounts;
- intCharCounts.SetSize(6);
+ std::vector<uint8_t> mins(6);
+ std::vector<int32_t> intCharCounts(6);
min = findMinimums(charCounts, intCharCounts, min, mins);
int32_t minCount = getMinimumCount(mins);
if (intCharCounts[ASCII_ENCODATION] == min) {
@@ -229,10 +226,8 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg,
charCounts[BASE256_ENCODATION]++;
}
if (charsProcessed >= 4) {
- CFX_ArrayTemplate<int32_t> intCharCounts;
- intCharCounts.SetSize(6);
- CFX_ArrayTemplate<uint8_t> mins;
- mins.SetSize(6);
+ std::vector<int32_t> intCharCounts(6);
+ std::vector<uint8_t> mins(6);
findMinimums(charCounts, intCharCounts,
std::numeric_limits<int32_t>::max(), mins);
int32_t minCount = getMinimumCount(mins);
@@ -317,31 +312,27 @@ wchar_t CBC_HighLevelEncoder::randomize253State(wchar_t ch,
return tempVariable <= 254 ? (wchar_t)tempVariable
: (wchar_t)(tempVariable - 254);
}
-int32_t CBC_HighLevelEncoder::findMinimums(
- std::vector<float>& charCounts,
- CFX_ArrayTemplate<int32_t>& intCharCounts,
- int32_t min,
- CFX_ArrayTemplate<uint8_t>& mins) {
- for (int32_t l = 0; l < mins.GetSize(); l++) {
- mins[l] = (uint8_t)0;
- }
- for (int32_t i = 0; i < 6; i++) {
- intCharCounts[i] = (int32_t)ceil(charCounts[i]);
+int32_t CBC_HighLevelEncoder::findMinimums(std::vector<float>& charCounts,
+ std::vector<int32_t>& intCharCounts,
+ int32_t min,
+ std::vector<uint8_t>& mins) {
+ for (size_t l = 0; l < mins.size(); l++)
+ mins[l] = 0;
+
+ for (size_t i = 0; i < 6; i++) {
+ intCharCounts[i] = static_cast<int32_t>(ceil(charCounts[i]));
int32_t current = intCharCounts[i];
if (min > current) {
min = current;
- for (int32_t j = 0; j < mins.GetSize(); j++) {
- mins[j] = (uint8_t)0;
- }
+ for (size_t j = 0; j < mins.size(); j++)
+ mins[j] = 0;
}
- if (min == current) {
+ if (min == current)
mins[i]++;
- }
}
return min;
}
-int32_t CBC_HighLevelEncoder::getMinimumCount(
- CFX_ArrayTemplate<uint8_t>& mins) {
+int32_t CBC_HighLevelEncoder::getMinimumCount(std::vector<uint8_t>& mins) {
int32_t minCount = 0;
for (int32_t i = 0; i < 6; i++) {
minCount += mins[i];
diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h
index 821dedd29f..6819e29163 100644
--- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h
+++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.h
@@ -23,7 +23,7 @@ class CBC_HighLevelEncoder : public CBC_SymbolShapeHint {
CBC_HighLevelEncoder();
~CBC_HighLevelEncoder() override;
- CFX_ArrayTemplate<uint8_t>& getBytesForMessage(CFX_WideString msg);
+ std::vector<uint8_t>& getBytesForMessage(CFX_WideString msg);
static CFX_WideString encodeHighLevel(CFX_WideString msg,
CFX_WideString ecLevel,
int32_t& e);
@@ -59,15 +59,15 @@ class CBC_HighLevelEncoder : public CBC_SymbolShapeHint {
static const wchar_t* MACRO_05_HEADER;
static const wchar_t* MACRO_06_HEADER;
static const wchar_t MACRO_TRAILER;
- CFX_ArrayTemplate<uint8_t> m_bytearray;
+ std::vector<uint8_t> m_bytearray;
private:
static wchar_t randomize253State(wchar_t ch, int32_t codewordPosition);
static int32_t findMinimums(std::vector<float>& charCounts,
- CFX_ArrayTemplate<int32_t>& intCharCounts,
+ std::vector<int32_t>& intCharCounts,
int32_t min,
- CFX_ArrayTemplate<uint8_t>& mins);
- static int32_t getMinimumCount(CFX_ArrayTemplate<uint8_t>& mins);
+ std::vector<uint8_t>& mins);
+ static int32_t getMinimumCount(std::vector<uint8_t>& mins);
static bool isNativeC40(wchar_t ch);
static bool isNativeText(wchar_t ch);
static bool isNativeX12(wchar_t ch);
diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp
index c1e28a50c1..7adbb1f55c 100644
--- a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp
+++ b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp
@@ -187,7 +187,7 @@ uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents,
e = BCExceptionContentsLengthShouldBetween1and80;
return nullptr;
}
- CFX_ArrayTemplate<const int32_t*> patterns;
+ std::vector<const int32_t*> patterns;
int32_t checkSum = 0;
if (m_codeFormat == BC_CODE128_B) {
checkSum = Encode128B(contents, &patterns);
@@ -198,20 +198,20 @@ uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents,
return nullptr;
}
checkSum %= 103;
- patterns.Add(CODE_PATTERNS[checkSum]);
- patterns.Add(CODE_PATTERNS[CODE_STOP]);
+ patterns.push_back(CODE_PATTERNS[checkSum]);
+ patterns.push_back(CODE_PATTERNS[CODE_STOP]);
m_iContentLen = contents.GetLength() + 3;
int32_t codeWidth = 0;
- for (int32_t k = 0; k < patterns.GetSize(); k++) {
+ for (size_t k = 0; k < patterns.size(); k++) {
const int32_t* pattern = patterns[k];
- for (int32_t j = 0; j < 7; j++) {
+ for (size_t j = 0; j < 7; j++) {
codeWidth += pattern[j];
}
}
outLength = codeWidth;
uint8_t* result = FX_Alloc(uint8_t, outLength);
int32_t pos = 0;
- for (int32_t j = 0; j < patterns.GetSize(); j++) {
+ for (size_t j = 0; j < patterns.size(); j++) {
const int32_t* pattern = patterns[j];
pos += AppendPattern(result, pos, pattern, 7, 1, e);
if (e != BCExceptionNO) {
@@ -224,17 +224,17 @@ uint8_t* CBC_OnedCode128Writer::Encode(const CFX_ByteString& contents,
int32_t CBC_OnedCode128Writer::Encode128B(
const CFX_ByteString& contents,
- CFX_ArrayTemplate<const int32_t*>* patterns) {
+ std::vector<const int32_t*>* patterns) {
int32_t checkSum = 0;
int32_t checkWeight = 1;
int32_t position = 0;
- patterns->Add(CODE_PATTERNS[CODE_START_B]);
+ patterns->push_back(CODE_PATTERNS[CODE_START_B]);
checkSum += CODE_START_B * checkWeight;
while (position < contents.GetLength()) {
int32_t patternIndex = 0;
patternIndex = contents[position] - ' ';
position += 1;
- patterns->Add(CODE_PATTERNS[patternIndex]);
+ patterns->push_back(CODE_PATTERNS[patternIndex]);
checkSum += patternIndex * checkWeight;
if (position != 0) {
checkWeight++;
@@ -245,11 +245,11 @@ int32_t CBC_OnedCode128Writer::Encode128B(
int32_t CBC_OnedCode128Writer::Encode128C(
const CFX_ByteString& contents,
- CFX_ArrayTemplate<const int32_t*>* patterns) {
+ std::vector<const int32_t*>* patterns) {
int32_t checkSum = 0;
int32_t checkWeight = 1;
int32_t position = 0;
- patterns->Add(CODE_PATTERNS[CODE_START_C]);
+ patterns->push_back(CODE_PATTERNS[CODE_START_C]);
checkSum += CODE_START_C * checkWeight;
while (position < contents.GetLength()) {
int32_t patternIndex = 0;
@@ -266,7 +266,7 @@ int32_t CBC_OnedCode128Writer::Encode128C(
position += 2;
}
}
- patterns->Add(CODE_PATTERNS[patternIndex]);
+ patterns->push_back(CODE_PATTERNS[patternIndex]);
checkSum += patternIndex * checkWeight;
if (position != 0) {
checkWeight++;
diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Writer.h b/xfa/fxbarcode/oned/BC_OnedCode128Writer.h
index 60a2f03acc..ff6e4d0fa5 100644
--- a/xfa/fxbarcode/oned/BC_OnedCode128Writer.h
+++ b/xfa/fxbarcode/oned/BC_OnedCode128Writer.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
#define XFA_FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
+#include <vector>
+
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "xfa/fxbarcode/oned/BC_OneDimWriter.h"
@@ -43,9 +45,9 @@ class CBC_OnedCode128Writer : public CBC_OneDimWriter {
private:
bool IsDigits(const CFX_ByteString& contents, int32_t start, int32_t length);
int32_t Encode128B(const CFX_ByteString& contents,
- CFX_ArrayTemplate<const int32_t*>* patterns);
+ std::vector<const int32_t*>* patterns);
int32_t Encode128C(const CFX_ByteString& contents,
- CFX_ArrayTemplate<const int32_t*>* patterns);
+ std::vector<const int32_t*>* patterns);
BC_TYPE m_codeFormat;
};
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417.cpp b/xfa/fxbarcode/pdf417/BC_PDF417.cpp
index f7aad69953..0bc6680108 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417.cpp
@@ -412,12 +412,12 @@ void CBC_PDF417::generateBarcodeLogic(CFX_WideString msg,
if (e != BCExceptionNO)
return;
int32_t sourceCodeWords = highLevel.GetLength();
- CFX_ArrayTemplate<int32_t>* dimension =
+ std::vector<int32_t>* dimension =
determineDimensions(sourceCodeWords, errorCorrectionCodeWords, e);
if (e != BCExceptionNO)
return;
- int32_t cols = dimension->GetAt(0);
- int32_t rows = dimension->GetAt(1);
+ int32_t cols = (*dimension)[0];
+ int32_t rows = (*dimension)[1];
delete dimension;
int32_t pad = getNumberOfPadCodewords(sourceCodeWords,
errorCorrectionCodeWords, cols, rows);
@@ -536,12 +536,12 @@ void CBC_PDF417::encodeLowLevel(CFX_WideString fullCodewords,
}
}
-CFX_ArrayTemplate<int32_t>* CBC_PDF417::determineDimensions(
+std::vector<int32_t>* CBC_PDF417::determineDimensions(
int32_t sourceCodeWords,
int32_t errorCorrectionCodeWords,
int32_t& e) {
float ratio = 0.0f;
- CFX_ArrayTemplate<int32_t>* dimension = nullptr;
+ std::vector<int32_t>* dimension = nullptr;
for (int32_t cols = m_minCols; cols <= m_maxCols; cols++) {
int32_t rows =
calculateNumberOfRows(sourceCodeWords, errorCorrectionCodeWords, cols);
@@ -559,21 +559,21 @@ CFX_ArrayTemplate<int32_t>* CBC_PDF417::determineDimensions(
}
ratio = newRatio;
delete dimension;
- dimension = new CFX_ArrayTemplate<int32_t>;
- dimension->Add(cols);
- dimension->Add(rows);
+ dimension = new std::vector<int32_t>;
+ dimension->push_back(cols);
+ dimension->push_back(rows);
}
if (!dimension) {
int32_t rows = calculateNumberOfRows(sourceCodeWords,
errorCorrectionCodeWords, m_minCols);
if (rows < m_minRows) {
- dimension = new CFX_ArrayTemplate<int32_t>;
- dimension->Add(m_minCols);
- dimension->Add(m_minRows);
+ dimension = new std::vector<int32_t>;
+ dimension->push_back(m_minCols);
+ dimension->push_back(m_minRows);
} else if (rows >= 3 && rows <= 90) {
- dimension = new CFX_ArrayTemplate<int32_t>;
- dimension->Add(m_minCols);
- dimension->Add(rows);
+ dimension = new std::vector<int32_t>;
+ dimension->push_back(m_minCols);
+ dimension->push_back(rows);
}
}
if (!dimension) {
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417.h b/xfa/fxbarcode/pdf417/BC_PDF417.h
index b382e5d26e..0d8fbfaf5f 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417.h
@@ -8,6 +8,7 @@
#define XFA_FXBARCODE_PDF417_BC_PDF417_H_
#include <memory>
+#include <vector>
#include "core/fxcrt/fx_basic.h"
#include "xfa/fxbarcode/pdf417/BC_PDF417Compaction.h"
@@ -51,10 +52,9 @@ class CBC_PDF417 {
int32_t r,
int32_t errorCorrectionLevel,
CBC_BarcodeMatrix* logic);
- CFX_ArrayTemplate<int32_t>* determineDimensions(
- int32_t sourceCodeWords,
- int32_t errorCorrectionCodeWords,
- int32_t& e);
+ std::vector<int32_t>* determineDimensions(int32_t sourceCodeWords,
+ int32_t errorCorrectionCodeWords,
+ int32_t& e);
std::unique_ptr<CBC_BarcodeMatrix> m_barcodeMatrix;
bool m_compact;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
index c1f4da1e3b..68bc799ec0 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.cpp
@@ -24,23 +24,22 @@
#include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h"
CBC_BarcodeMatrix::CBC_BarcodeMatrix(int32_t height, int32_t width) {
- m_matrix.SetSize(height + 2);
- for (int32_t i = 0, matrixLength = m_matrix.GetSize(); i < matrixLength;
- i++) {
+ m_matrix.resize(height + 2);
+ for (size_t i = 0, matrixLength = m_matrix.size(); i < matrixLength; ++i)
m_matrix[i] = new CBC_BarcodeRow((width + 4) * 17 + 1);
- }
+
m_width = width * 17;
m_height = height + 2;
m_currentRow = 0;
m_outHeight = 0;
m_outWidth = 0;
}
-CBC_BarcodeMatrix::~CBC_BarcodeMatrix() {
- for (int32_t i = 0; i < m_matrix.GetSize(); i++)
- delete m_matrix.GetAt(i);
- m_matrixOut.RemoveAll();
+CBC_BarcodeMatrix::~CBC_BarcodeMatrix() {
+ for (size_t i = 0; i < m_matrix.size(); i++)
+ delete m_matrix[i];
}
+
void CBC_BarcodeMatrix::set(int32_t x, int32_t y, uint8_t value) {
m_matrix[y]->set(x, value);
}
@@ -59,30 +58,27 @@ int32_t CBC_BarcodeMatrix::getWidth() {
int32_t CBC_BarcodeMatrix::getHeight() {
return m_outHeight;
}
-CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getMatrix() {
+std::vector<uint8_t>& CBC_BarcodeMatrix::getMatrix() {
return getScaledMatrix(1, 1);
}
-CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t scale) {
+std::vector<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t scale) {
return getScaledMatrix(scale, scale);
}
-CFX_ArrayTemplate<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t xScale,
- int32_t yScale) {
- int32_t yMax = m_height * yScale;
- CFX_ArrayTemplate<uint8_t> bytearray;
- bytearray.Copy(m_matrix[0]->getScaledRow(xScale));
- int32_t xMax = bytearray.GetSize();
- m_matrixOut.SetSize(xMax * yMax);
+std::vector<uint8_t>& CBC_BarcodeMatrix::getScaledMatrix(int32_t xScale,
+ int32_t yScale) {
+ size_t yMax = m_height * yScale;
+ std::vector<uint8_t> bytearray = m_matrix[0]->getScaledRow(xScale);
+ size_t xMax = bytearray.size();
+ m_matrixOut.resize(xMax * yMax);
m_outWidth = xMax;
m_outHeight = yMax;
int32_t k = 0;
- for (int32_t i = 0; i < yMax; i++) {
- if (i != 0) {
- bytearray.Copy(m_matrix[i / yScale]->getScaledRow(xScale));
- }
+ for (size_t i = 0; i < yMax; i++) {
+ if (i != 0)
+ bytearray = m_matrix[i / yScale]->getScaledRow(xScale);
k = i * xMax;
- for (int32_t l = 0; l < xMax; l++) {
- m_matrixOut[k + l] = bytearray.GetAt(l);
- }
+ for (size_t l = 0; l < xMax; l++)
+ m_matrixOut[k + l] = bytearray[l];
}
return m_matrixOut;
}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h
index 95ab547c90..bf86b7b55a 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeMatrix.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_PDF417_BC_PDF417BARCODEMATRIX_H_
#define XFA_FXBARCODE_PDF417_BC_PDF417BARCODEMATRIX_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
class CBC_BarcodeRow;
@@ -21,15 +23,15 @@ class CBC_BarcodeMatrix {
void setMatrix(int32_t x, int32_t y, bool black);
void startRow();
CBC_BarcodeRow* getCurrentRow();
- CFX_ArrayTemplate<uint8_t>& getMatrix();
- CFX_ArrayTemplate<uint8_t>& getScaledMatrix(int32_t scale);
- CFX_ArrayTemplate<uint8_t>& getScaledMatrix(int32_t xScale, int32_t yScale);
+ std::vector<uint8_t>& getMatrix();
+ std::vector<uint8_t>& getScaledMatrix(int32_t scale);
+ std::vector<uint8_t>& getScaledMatrix(int32_t xScale, int32_t yScale);
int32_t getWidth();
int32_t getHeight();
private:
- CFX_ArrayTemplate<CBC_BarcodeRow*> m_matrix;
- CFX_ArrayTemplate<uint8_t> m_matrixOut;
+ std::vector<CBC_BarcodeRow*> m_matrix;
+ std::vector<uint8_t> m_matrixOut;
int32_t m_currentRow;
int32_t m_height;
int32_t m_width;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
index 243af70d94..427da9d588 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.cpp
@@ -22,32 +22,31 @@
#include "xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h"
-CBC_BarcodeRow::CBC_BarcodeRow(int32_t width) {
- m_row.SetSize(width);
- m_currentLocation = 0;
-}
-CBC_BarcodeRow::~CBC_BarcodeRow() {
- m_output.RemoveAll();
- m_row.RemoveAll();
-}
+CBC_BarcodeRow::CBC_BarcodeRow(size_t width)
+ : m_row(width), m_currentLocation(0) {}
+
+CBC_BarcodeRow::~CBC_BarcodeRow() {}
+
void CBC_BarcodeRow::set(int32_t x, uint8_t value) {
- m_row.SetAt(x, value);
+ m_row[x] = value;
}
+
void CBC_BarcodeRow::set(int32_t x, bool black) {
- m_row.SetAt(x, (uint8_t)(black ? 1 : 0));
+ m_row[x] = black ? 1 : 0;
}
+
void CBC_BarcodeRow::addBar(bool black, int32_t width) {
- for (int32_t ii = 0; ii < width; ii++) {
+ for (int32_t ii = 0; ii < width; ii++)
set(m_currentLocation++, black);
- }
}
-CFX_ArrayTemplate<uint8_t>& CBC_BarcodeRow::getRow() {
+
+std::vector<uint8_t>& CBC_BarcodeRow::getRow() {
return m_row;
}
-CFX_ArrayTemplate<uint8_t>& CBC_BarcodeRow::getScaledRow(int32_t scale) {
- m_output.SetSize(m_row.GetSize() * scale);
- for (int32_t i = 0; i < m_output.GetSize(); i++) {
- m_output[i] = (m_row[i / scale]);
- }
+
+std::vector<uint8_t>& CBC_BarcodeRow::getScaledRow(int32_t scale) {
+ m_output.resize(m_row.size() * scale);
+ for (size_t i = 0; i < m_output.size(); i++)
+ m_output[i] = m_row[i / scale];
return m_output;
}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
index 7d9d19cb56..9130a0c38f 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417BarcodeRow.h
@@ -7,22 +7,24 @@
#ifndef XFA_FXBARCODE_PDF417_BC_PDF417BARCODEROW_H_
#define XFA_FXBARCODE_PDF417_BC_PDF417BARCODEROW_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
class CBC_BarcodeRow {
public:
- explicit CBC_BarcodeRow(int32_t width);
+ explicit CBC_BarcodeRow(size_t width);
virtual ~CBC_BarcodeRow();
void set(int32_t x, uint8_t value);
void set(int32_t x, bool black);
void addBar(bool black, int32_t width);
- CFX_ArrayTemplate<uint8_t>& getRow();
- CFX_ArrayTemplate<uint8_t>& getScaledRow(int32_t scale);
+ std::vector<uint8_t>& getRow();
+ std::vector<uint8_t>& getScaledRow(int32_t scale);
private:
- CFX_ArrayTemplate<uint8_t> m_row;
- CFX_ArrayTemplate<uint8_t> m_output;
+ std::vector<uint8_t> m_row;
+ std::vector<uint8_t> m_output;
int32_t m_currentLocation;
};
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
index 0d9c7cfbd0..5402f3d7f7 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp
@@ -71,9 +71,9 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(
}
msg += ch;
}
- CFX_ArrayTemplate<uint8_t> byteArr;
+ std::vector<uint8_t> byteArr;
for (int32_t k = 0; k < bytes.GetLength(); k++) {
- byteArr.Add(bytes.GetAt(k));
+ byteArr.push_back(bytes.GetAt(k));
}
CFX_WideString sb;
len = msg.GetLength();
@@ -82,7 +82,7 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel(
if (compaction == TEXT) {
encodeText(msg, p, len, sb, textSubMode);
} else if (compaction == BYTES) {
- encodeBinary(&byteArr, p, byteArr.GetSize(), BYTE_COMPACTION, sb);
+ encodeBinary(&byteArr, p, byteArr.size(), BYTE_COMPACTION, sb);
} else if (compaction == NUMERIC) {
sb += (wchar_t)LATCH_TO_NUMERIC;
encodeNumeric(msg, p, len, sb);
@@ -261,7 +261,7 @@ int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg,
}
return submode;
}
-void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes,
+void CBC_PDF417HighLevelEncoder::encodeBinary(std::vector<uint8_t>* bytes,
int32_t startpos,
int32_t count,
int32_t startmode,
@@ -278,7 +278,7 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes,
int64_t t = 0;
for (i = 0; i < 6; i++) {
t <<= 8;
- t += bytes->GetAt(idx + i) & 0xff;
+ t += (*bytes)[idx + i] & 0xff;
}
for (i = 0; i < 5; i++) {
chars[i] = (wchar_t)(t % 900);
@@ -294,7 +294,7 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes,
sb += (wchar_t)LATCH_TO_BYTE_PADDED;
}
for (i = idx; i < startpos + count; i++) {
- int32_t ch = bytes->GetAt(i) & 0xff;
+ int32_t ch = (*bytes)[i] & 0xff;
sb += (wchar_t)ch;
}
}
@@ -388,7 +388,7 @@ int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveTextCount(
}
int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount(
CFX_WideString msg,
- CFX_ArrayTemplate<uint8_t>* bytes,
+ std::vector<uint8_t>* bytes,
int32_t startpos,
int32_t& e) {
int32_t len = msg.GetLength();
@@ -420,7 +420,7 @@ int32_t CBC_PDF417HighLevelEncoder::determineConsecutiveBinaryCount(
return idx - startpos;
}
ch = msg.GetAt(idx);
- if (bytes->GetAt(idx) == 63 && ch != '?') {
+ if ((*bytes)[idx] == 63 && ch != '?') {
e = BCExceptionNonEncodableCharacterDetected;
return -1;
}
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
index 01c2be02f8..48b8d009fc 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_PDF417_BC_PDF417HIGHLEVELENCODER_H_
#define XFA_FXBARCODE_PDF417_BC_PDF417HIGHLEVELENCODER_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_string.h"
#include "xfa/fxbarcode/pdf417/BC_PDF417Compaction.h"
@@ -39,7 +41,7 @@ class CBC_PDF417HighLevelEncoder {
int32_t count,
CFX_WideString& sb,
int32_t initialSubmode);
- static void encodeBinary(CFX_ArrayTemplate<uint8_t>* bytes,
+ static void encodeBinary(std::vector<uint8_t>* bytes,
int32_t startpos,
int32_t count,
int32_t startmode,
@@ -58,11 +60,10 @@ class CBC_PDF417HighLevelEncoder {
int32_t startpos);
static int32_t determineConsecutiveTextCount(CFX_WideString msg,
int32_t startpos);
- static int32_t determineConsecutiveBinaryCount(
- CFX_WideString msg,
- CFX_ArrayTemplate<uint8_t>* bytes,
- int32_t startpos,
- int32_t& e);
+ static int32_t determineConsecutiveBinaryCount(CFX_WideString msg,
+ std::vector<uint8_t>* bytes,
+ int32_t startpos,
+ int32_t& e);
friend class PDF417HighLevelEncoder_EncodeNumeric_Test;
friend class PDF417HighLevelEncoder_EncodeBinary_Test;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
index 2cd60fef41..a1f3283dd8 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417HighLevelEncoder_unittest.cpp
@@ -43,11 +43,11 @@ TEST(PDF417HighLevelEncoder, EncodeBinary) {
CBC_PDF417HighLevelEncoder::Initialize();
for (size_t i = 0; i < FX_ArraySize(encode_binary_cases); ++i) {
EncodeBinaryCase* ptr = &encode_binary_cases[i];
- CFX_ArrayTemplate<uint8_t> input_array;
+ std::vector<uint8_t> input_array;
size_t input_length = strlen(ptr->input);
- input_array.SetSize(input_length);
+ input_array.resize(input_length);
for (size_t j = 0; j < input_length; ++j) {
- input_array.SetAt(j, ptr->input[j]);
+ input_array[j] = ptr->input[j];
}
CFX_WideString expected(ptr->expected, ptr->expected_length);
CFX_WideString result;
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp b/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp
index 2c75a14a80..ddd740d12e 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp
+++ b/xfa/fxbarcode/pdf417/BC_PDF417Writer.cpp
@@ -64,9 +64,8 @@ uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents,
int32_t lineThickness = 2;
int32_t aspectRatio = 4;
CBC_BarcodeMatrix* barcodeMatrix = encoder.getBarcodeMatrix();
- CFX_ArrayTemplate<uint8_t> originalScale;
- originalScale.Copy(barcodeMatrix->getScaledMatrix(
- lineThickness, aspectRatio * lineThickness));
+ std::vector<uint8_t> originalScale = barcodeMatrix->getScaledMatrix(
+ lineThickness, aspectRatio * lineThickness);
int32_t width = outWidth;
int32_t height = outHeight;
outWidth = barcodeMatrix->getWidth();
@@ -88,9 +87,8 @@ uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents,
scale = scaleY;
}
if (scale > 1) {
- originalScale.RemoveAll();
- originalScale.Copy(barcodeMatrix->getScaledMatrix(
- scale * lineThickness, scale * aspectRatio * lineThickness));
+ originalScale = barcodeMatrix->getScaledMatrix(
+ scale * lineThickness, scale * aspectRatio * lineThickness);
if (rotated) {
rotateArray(originalScale, outHeight, outWidth);
int32_t temp = outHeight;
@@ -99,14 +97,13 @@ uint8_t* CBC_PDF417Writer::Encode(const CFX_WideString& contents,
}
}
uint8_t* result = FX_Alloc2D(uint8_t, outHeight, outWidth);
- FXSYS_memcpy(result, originalScale.GetData(), outHeight * outWidth);
+ FXSYS_memcpy(result, originalScale.data(), outHeight * outWidth);
return result;
}
-void CBC_PDF417Writer::rotateArray(CFX_ArrayTemplate<uint8_t>& bitarray,
+void CBC_PDF417Writer::rotateArray(std::vector<uint8_t>& bitarray,
int32_t height,
int32_t width) {
- CFX_ArrayTemplate<uint8_t> temp;
- temp.Copy(bitarray);
+ std::vector<uint8_t> temp = bitarray;
for (int32_t ii = 0; ii < height; ii++) {
int32_t inverseii = height - ii - 1;
for (int32_t jj = 0; jj < width; jj++) {
diff --git a/xfa/fxbarcode/pdf417/BC_PDF417Writer.h b/xfa/fxbarcode/pdf417/BC_PDF417Writer.h
index 420c441bc9..564f80849c 100644
--- a/xfa/fxbarcode/pdf417/BC_PDF417Writer.h
+++ b/xfa/fxbarcode/pdf417/BC_PDF417Writer.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_PDF417_BC_PDF417WRITER_H_
#define XFA_FXBARCODE_PDF417_BC_PDF417WRITER_H_
+#include <vector>
+
#include "core/fxcrt/fx_string.h"
#include "core/fxcrt/fx_system.h"
#include "xfa/fxbarcode/BC_TwoDimWriter.h"
@@ -27,7 +29,7 @@ class CBC_PDF417Writer : public CBC_TwoDimWriter {
void SetTruncated(bool truncated);
private:
- void rotateArray(CFX_ArrayTemplate<uint8_t>& bitarray,
+ void rotateArray(std::vector<uint8_t>& bitarray,
int32_t width,
int32_t height);
bool m_bTruncated;
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
index 507c91878e..8894695e95 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.cpp
@@ -26,19 +26,19 @@
CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock,
CBC_QRCoderECB* ecBlocks)
: m_ecCodeWordsPerBlock(ecCodeWordsPerBlock) {
- m_ecBlocksArray.Add(ecBlocks);
+ m_ecBlocksArray.push_back(ecBlocks);
}
CBC_QRCoderECBlocks::CBC_QRCoderECBlocks(int32_t ecCodeWordsPerBlock,
CBC_QRCoderECB* ecBlocks1,
CBC_QRCoderECB* ecBlocks2)
: m_ecCodeWordsPerBlock(ecCodeWordsPerBlock) {
- m_ecBlocksArray.Add(ecBlocks1);
- m_ecBlocksArray.Add(ecBlocks2);
+ m_ecBlocksArray.push_back(ecBlocks1);
+ m_ecBlocksArray.push_back(ecBlocks2);
}
CBC_QRCoderECBlocks::~CBC_QRCoderECBlocks() {
- for (int32_t i = 0; i < m_ecBlocksArray.GetSize(); i++)
+ for (size_t i = 0; i < m_ecBlocksArray.size(); i++)
delete m_ecBlocksArray[i];
}
@@ -48,7 +48,7 @@ int32_t CBC_QRCoderECBlocks::GetECCodeWordsPerBlock() const {
int32_t CBC_QRCoderECBlocks::GetNumBlocks() const {
int32_t total = 0;
- for (int32_t i = 0; i < m_ecBlocksArray.GetSize(); i++)
+ for (size_t i = 0; i < m_ecBlocksArray.size(); i++)
total += m_ecBlocksArray[i]->GetCount();
return total;
@@ -58,6 +58,6 @@ int32_t CBC_QRCoderECBlocks::GetTotalECCodeWords() const {
return m_ecCodeWordsPerBlock * GetNumBlocks();
}
-CFX_ArrayTemplate<CBC_QRCoderECB*>* CBC_QRCoderECBlocks::GetECBlocks() {
+std::vector<CBC_QRCoderECB*>* CBC_QRCoderECBlocks::GetECBlocks() {
return &m_ecBlocksArray;
}
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h b/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h
index a428f06355..816a983ce5 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderECBlocks.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_QRCODE_BC_QRCODERECBLOCKS_H_
#define XFA_FXBARCODE_QRCODE_BC_QRCODERECBLOCKS_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
class CBC_QRCoderECB;
@@ -22,11 +24,11 @@ class CBC_QRCoderECBlocks {
int32_t GetECCodeWordsPerBlock() const;
int32_t GetNumBlocks() const;
int32_t GetTotalECCodeWords() const;
- CFX_ArrayTemplate<CBC_QRCoderECB*>* GetECBlocks();
+ std::vector<CBC_QRCoderECB*>* GetECBlocks();
private:
int32_t m_ecCodeWordsPerBlock;
- CFX_ArrayTemplate<CBC_QRCoderECB*> m_ecBlocksArray;
+ std::vector<CBC_QRCoderECB*> m_ecBlocksArray;
};
#endif // XFA_FXBARCODE_QRCODE_BC_QRCODERECBLOCKS_H_
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
index 3a442bedbb..2534675877 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.cpp
@@ -101,12 +101,12 @@ void CBC_QRCoderEncoder::AppendDataModeLenghInfo(
if (e != BCExceptionNO)
return;
} else if (tempMode == CBC_QRCoderMode::sBYTE) {
- CFX_ArrayTemplate<uint8_t> bytes;
+ std::vector<uint8_t> bytes;
CBC_UtilCodingConvert::LocaleToUtf8(splitResult.second, bytes);
AppendModeInfo(tempMode, &headerAndDataBits, e);
if (e != BCExceptionNO)
return;
- AppendLengthInfo(bytes.GetSize(), qrCode->GetVersion(), tempMode,
+ AppendLengthInfo(bytes.size(), qrCode->GetVersion(), tempMode,
&headerAndDataBits, e);
if (e != BCExceptionNO)
return;
@@ -765,10 +765,10 @@ void CBC_QRCoderEncoder::Append8BitBytes(const CFX_ByteString& content,
}
}
-void CBC_QRCoderEncoder::Append8BitBytes(CFX_ArrayTemplate<uint8_t>& bytes,
+void CBC_QRCoderEncoder::Append8BitBytes(std::vector<uint8_t>& bytes,
CBC_QRCoderBitVector* bits,
int32_t& e) {
- for (int32_t i = 0; i < bytes.GetSize(); i++) {
+ for (size_t i = 0; i < bytes.size(); i++) {
bits->AppendBits(bytes[i], 8, e);
if (e != BCExceptionNO)
return;
@@ -778,9 +778,9 @@ void CBC_QRCoderEncoder::Append8BitBytes(CFX_ArrayTemplate<uint8_t>& bytes,
void CBC_QRCoderEncoder::AppendKanjiBytes(const CFX_ByteString& content,
CBC_QRCoderBitVector* bits,
int32_t& e) {
- CFX_ArrayTemplate<uint8_t> bytes;
+ std::vector<uint8_t> bytes;
uint32_t value = 0;
- for (int32_t i = 0; i < bytes.GetSize(); i += 2) {
+ for (size_t i = 0; i < bytes.size(); i += 2) {
value = (uint32_t)((uint8_t)(content[i] << 8) | (uint8_t)content[i + 1]);
if (value <= 0x9ffc && value >= 0x8140) {
value -= 0x8140;
@@ -870,7 +870,7 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
int32_t dataBytesOffset = 0;
int32_t maxNumDataBytes = 0;
int32_t maxNumEcBytes = 0;
- CFX_ArrayTemplate<CBC_QRCoderBlockPair*> blocks;
+ std::vector<CBC_QRCoderBlockPair*> blocks;
int32_t i;
for (i = 0; i < numRSBlocks; i++) {
int32_t numDataBytesInBlock;
@@ -886,7 +886,7 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
return;
maxNumDataBytes = std::max(maxNumDataBytes, dataBytes->Size());
maxNumEcBytes = std::max(maxNumEcBytes, ecBytes->Size());
- blocks.Add(
+ blocks.push_back(
new CBC_QRCoderBlockPair(std::move(dataBytes), std::move(ecBytes)));
dataBytesOffset += numDataBytesInBlock;
}
@@ -895,7 +895,7 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
return;
}
for (int32_t x = 0; x < maxNumDataBytes; x++) {
- for (int32_t j = 0; j < blocks.GetSize(); j++) {
+ for (size_t j = 0; j < blocks.size(); j++) {
const CBC_CommonByteArray* dataBytes = blocks[j]->GetDataBytes();
if (x < dataBytes->Size()) {
result->AppendBits(dataBytes->At(x), 8, e);
@@ -905,7 +905,7 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
}
}
for (int32_t y = 0; y < maxNumEcBytes; y++) {
- for (int32_t l = 0; l < blocks.GetSize(); l++) {
+ for (size_t l = 0; l < blocks.size(); l++) {
const CBC_CommonByteArray* ecBytes = blocks[l]->GetErrorCorrectionBytes();
if (y < ecBytes->Size()) {
result->AppendBits(ecBytes->At(y), 8, e);
@@ -914,7 +914,7 @@ void CBC_QRCoderEncoder::InterleaveWithECBytes(CBC_QRCoderBitVector* bits,
}
}
}
- for (int32_t k = 0; k < blocks.GetSize(); k++) {
+ for (size_t k = 0; k < blocks.size(); k++) {
delete blocks[k];
}
if (numTotalBytes != result->sizeInBytes())
@@ -953,8 +953,7 @@ CBC_CommonByteArray* CBC_QRCoderEncoder::GenerateECBytes(
int32_t numEcBytesInBlock,
int32_t& e) {
int32_t numDataBytes = dataBytes->Size();
- CFX_ArrayTemplate<int32_t> toEncode;
- toEncode.SetSize(numDataBytes + numEcBytesInBlock);
+ std::vector<int32_t> toEncode(numDataBytes + numEcBytesInBlock);
for (int32_t i = 0; i < numDataBytes; i++) {
toEncode[i] = (dataBytes->At(i));
}
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h
index a1b078f24c..77de6e5e40 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderEncoder.h
@@ -62,7 +62,7 @@ class CBC_QRCoderEncoder {
CBC_QRCoderBitVector* bits,
CFX_ByteString encoding,
int32_t& e);
- static void Append8BitBytes(CFX_ArrayTemplate<uint8_t>& bytes,
+ static void Append8BitBytes(std::vector<uint8_t>& bytes,
CBC_QRCoderBitVector* bits,
int32_t& e);
static void AppendKanjiBytes(const CFX_ByteString& content,
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
index befdc17a98..da13700ae2 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.cpp
@@ -54,14 +54,14 @@ const int32_t CBC_QRCoderVersion::VERSION_DECODE_INFO[] = {
0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA,
0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69};
-CFX_ArrayTemplate<CBC_QRCoderVersion*>* CBC_QRCoderVersion::VERSION = nullptr;
+std::vector<CBC_QRCoderVersion*>* CBC_QRCoderVersion::VERSION = nullptr;
void CBC_QRCoderVersion::Initialize() {
- VERSION = new CFX_ArrayTemplate<CBC_QRCoderVersion*>();
+ VERSION = new std::vector<CBC_QRCoderVersion*>();
}
void CBC_QRCoderVersion::Finalize() {
- for (int32_t i = 0; i < VERSION->GetSize(); i++)
- delete VERSION->GetAt(i);
+ for (size_t i = 0; i < VERSION->size(); i++)
+ delete (*VERSION)[i];
delete VERSION;
VERSION = nullptr;
@@ -72,14 +72,14 @@ CBC_QRCoderVersion::CBC_QRCoderVersion(int32_t versionNumber,
CBC_QRCoderECBlocks* ecBlocks3,
CBC_QRCoderECBlocks* ecBlocks4) {
m_versionNumber = versionNumber;
- m_ecBlocksArray.Add(ecBlocks1);
- m_ecBlocksArray.Add(ecBlocks2);
- m_ecBlocksArray.Add(ecBlocks3);
- m_ecBlocksArray.Add(ecBlocks4);
+ m_ecBlocksArray.push_back(ecBlocks1);
+ m_ecBlocksArray.push_back(ecBlocks2);
+ m_ecBlocksArray.push_back(ecBlocks3);
+ m_ecBlocksArray.push_back(ecBlocks4);
int32_t total = 0;
int32_t ecCodeWords = ecBlocks1->GetECCodeWordsPerBlock();
- CFX_ArrayTemplate<CBC_QRCoderECB*>* ecbArray = ecBlocks1->GetECBlocks();
- for (int32_t i = 0; i < ecbArray->GetSize(); i++) {
+ std::vector<CBC_QRCoderECB*>* ecbArray = ecBlocks1->GetECBlocks();
+ for (size_t i = 0; i < ecbArray->size(); i++) {
CBC_QRCoderECB* ecBlock = (*ecbArray)[i];
total += ecBlock->GetCount() * (ecBlock->GetDataCodeWords() + ecCodeWords);
}
@@ -88,273 +88,273 @@ CBC_QRCoderVersion::CBC_QRCoderVersion(int32_t versionNumber,
case 1:
break;
case 2:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(18);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(18);
break;
case 3:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(22);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(22);
break;
case 4:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(26);
break;
case 5:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(30);
break;
case 6:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(34);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(34);
break;
case 7:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(22);
- m_alignmentPatternCenters.Add(38);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(22);
+ m_alignmentPatternCenters.push_back(38);
break;
case 8:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(24);
- m_alignmentPatternCenters.Add(42);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(24);
+ m_alignmentPatternCenters.push_back(42);
break;
case 9:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(46);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(26);
+ m_alignmentPatternCenters.push_back(46);
break;
case 10:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(28);
- m_alignmentPatternCenters.Add(50);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(28);
+ m_alignmentPatternCenters.push_back(50);
break;
case 11:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(54);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(30);
+ m_alignmentPatternCenters.push_back(54);
break;
case 12:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(32);
- m_alignmentPatternCenters.Add(58);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(32);
+ m_alignmentPatternCenters.push_back(58);
break;
case 13:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(34);
- m_alignmentPatternCenters.Add(62);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(34);
+ m_alignmentPatternCenters.push_back(62);
break;
case 14:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(46);
- m_alignmentPatternCenters.Add(66);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(26);
+ m_alignmentPatternCenters.push_back(46);
+ m_alignmentPatternCenters.push_back(66);
break;
case 15:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(48);
- m_alignmentPatternCenters.Add(70);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(26);
+ m_alignmentPatternCenters.push_back(48);
+ m_alignmentPatternCenters.push_back(70);
break;
case 16:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(50);
- m_alignmentPatternCenters.Add(74);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(26);
+ m_alignmentPatternCenters.push_back(50);
+ m_alignmentPatternCenters.push_back(74);
break;
case 17:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(78);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(30);
+ m_alignmentPatternCenters.push_back(54);
+ m_alignmentPatternCenters.push_back(78);
break;
case 18:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(56);
- m_alignmentPatternCenters.Add(82);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(30);
+ m_alignmentPatternCenters.push_back(56);
+ m_alignmentPatternCenters.push_back(82);
break;
case 19:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(58);
- m_alignmentPatternCenters.Add(86);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(30);
+ m_alignmentPatternCenters.push_back(58);
+ m_alignmentPatternCenters.push_back(86);
break;
case 20:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(34);
- m_alignmentPatternCenters.Add(62);
- m_alignmentPatternCenters.Add(90);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(34);
+ m_alignmentPatternCenters.push_back(62);
+ m_alignmentPatternCenters.push_back(90);
break;
case 21:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(28);
- m_alignmentPatternCenters.Add(50);
- m_alignmentPatternCenters.Add(72);
- m_alignmentPatternCenters.Add(94);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(28);
+ m_alignmentPatternCenters.push_back(50);
+ m_alignmentPatternCenters.push_back(72);
+ m_alignmentPatternCenters.push_back(94);
break;
case 22:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(50);
- m_alignmentPatternCenters.Add(74);
- m_alignmentPatternCenters.Add(98);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(26);
+ m_alignmentPatternCenters.push_back(50);
+ m_alignmentPatternCenters.push_back(74);
+ m_alignmentPatternCenters.push_back(98);
break;
case 23:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(74);
- m_alignmentPatternCenters.Add(102);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(30);
+ m_alignmentPatternCenters.push_back(54);
+ m_alignmentPatternCenters.push_back(74);
+ m_alignmentPatternCenters.push_back(102);
break;
case 24:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(28);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(80);
- m_alignmentPatternCenters.Add(106);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(28);
+ m_alignmentPatternCenters.push_back(54);
+ m_alignmentPatternCenters.push_back(80);
+ m_alignmentPatternCenters.push_back(106);
break;
case 25:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(32);
- m_alignmentPatternCenters.Add(58);
- m_alignmentPatternCenters.Add(84);
- m_alignmentPatternCenters.Add(110);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(32);
+ m_alignmentPatternCenters.push_back(58);
+ m_alignmentPatternCenters.push_back(84);
+ m_alignmentPatternCenters.push_back(110);
break;
case 26:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(58);
- m_alignmentPatternCenters.Add(86);
- m_alignmentPatternCenters.Add(114);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(30);
+ m_alignmentPatternCenters.push_back(58);
+ m_alignmentPatternCenters.push_back(86);
+ m_alignmentPatternCenters.push_back(114);
break;
case 27:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(34);
- m_alignmentPatternCenters.Add(62);
- m_alignmentPatternCenters.Add(90);
- m_alignmentPatternCenters.Add(118);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(34);
+ m_alignmentPatternCenters.push_back(62);
+ m_alignmentPatternCenters.push_back(90);
+ m_alignmentPatternCenters.push_back(118);
break;
case 28:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(50);
- m_alignmentPatternCenters.Add(74);
- m_alignmentPatternCenters.Add(98);
- m_alignmentPatternCenters.Add(122);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(26);
+ m_alignmentPatternCenters.push_back(50);
+ m_alignmentPatternCenters.push_back(74);
+ m_alignmentPatternCenters.push_back(98);
+ m_alignmentPatternCenters.push_back(122);
break;
case 29:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(78);
- m_alignmentPatternCenters.Add(102);
- m_alignmentPatternCenters.Add(126);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(30);
+ m_alignmentPatternCenters.push_back(54);
+ m_alignmentPatternCenters.push_back(78);
+ m_alignmentPatternCenters.push_back(102);
+ m_alignmentPatternCenters.push_back(126);
break;
case 30:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(52);
- m_alignmentPatternCenters.Add(78);
- m_alignmentPatternCenters.Add(104);
- m_alignmentPatternCenters.Add(130);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(26);
+ m_alignmentPatternCenters.push_back(52);
+ m_alignmentPatternCenters.push_back(78);
+ m_alignmentPatternCenters.push_back(104);
+ m_alignmentPatternCenters.push_back(130);
break;
case 31:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(56);
- m_alignmentPatternCenters.Add(82);
- m_alignmentPatternCenters.Add(108);
- m_alignmentPatternCenters.Add(134);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(30);
+ m_alignmentPatternCenters.push_back(56);
+ m_alignmentPatternCenters.push_back(82);
+ m_alignmentPatternCenters.push_back(108);
+ m_alignmentPatternCenters.push_back(134);
break;
case 32:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(34);
- m_alignmentPatternCenters.Add(60);
- m_alignmentPatternCenters.Add(86);
- m_alignmentPatternCenters.Add(112);
- m_alignmentPatternCenters.Add(138);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(34);
+ m_alignmentPatternCenters.push_back(60);
+ m_alignmentPatternCenters.push_back(86);
+ m_alignmentPatternCenters.push_back(112);
+ m_alignmentPatternCenters.push_back(138);
break;
case 33:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(58);
- m_alignmentPatternCenters.Add(86);
- m_alignmentPatternCenters.Add(114);
- m_alignmentPatternCenters.Add(142);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(30);
+ m_alignmentPatternCenters.push_back(58);
+ m_alignmentPatternCenters.push_back(86);
+ m_alignmentPatternCenters.push_back(114);
+ m_alignmentPatternCenters.push_back(142);
break;
case 34:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(34);
- m_alignmentPatternCenters.Add(62);
- m_alignmentPatternCenters.Add(90);
- m_alignmentPatternCenters.Add(118);
- m_alignmentPatternCenters.Add(146);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(34);
+ m_alignmentPatternCenters.push_back(62);
+ m_alignmentPatternCenters.push_back(90);
+ m_alignmentPatternCenters.push_back(118);
+ m_alignmentPatternCenters.push_back(146);
break;
case 35:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(78);
- m_alignmentPatternCenters.Add(102);
- m_alignmentPatternCenters.Add(126);
- m_alignmentPatternCenters.Add(150);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(30);
+ m_alignmentPatternCenters.push_back(54);
+ m_alignmentPatternCenters.push_back(78);
+ m_alignmentPatternCenters.push_back(102);
+ m_alignmentPatternCenters.push_back(126);
+ m_alignmentPatternCenters.push_back(150);
break;
case 36:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(24);
- m_alignmentPatternCenters.Add(50);
- m_alignmentPatternCenters.Add(76);
- m_alignmentPatternCenters.Add(102);
- m_alignmentPatternCenters.Add(128);
- m_alignmentPatternCenters.Add(154);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(24);
+ m_alignmentPatternCenters.push_back(50);
+ m_alignmentPatternCenters.push_back(76);
+ m_alignmentPatternCenters.push_back(102);
+ m_alignmentPatternCenters.push_back(128);
+ m_alignmentPatternCenters.push_back(154);
break;
case 37:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(28);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(80);
- m_alignmentPatternCenters.Add(106);
- m_alignmentPatternCenters.Add(132);
- m_alignmentPatternCenters.Add(158);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(28);
+ m_alignmentPatternCenters.push_back(54);
+ m_alignmentPatternCenters.push_back(80);
+ m_alignmentPatternCenters.push_back(106);
+ m_alignmentPatternCenters.push_back(132);
+ m_alignmentPatternCenters.push_back(158);
break;
case 38:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(32);
- m_alignmentPatternCenters.Add(58);
- m_alignmentPatternCenters.Add(84);
- m_alignmentPatternCenters.Add(110);
- m_alignmentPatternCenters.Add(136);
- m_alignmentPatternCenters.Add(162);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(32);
+ m_alignmentPatternCenters.push_back(58);
+ m_alignmentPatternCenters.push_back(84);
+ m_alignmentPatternCenters.push_back(110);
+ m_alignmentPatternCenters.push_back(136);
+ m_alignmentPatternCenters.push_back(162);
break;
case 39:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(26);
- m_alignmentPatternCenters.Add(54);
- m_alignmentPatternCenters.Add(82);
- m_alignmentPatternCenters.Add(110);
- m_alignmentPatternCenters.Add(138);
- m_alignmentPatternCenters.Add(166);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(26);
+ m_alignmentPatternCenters.push_back(54);
+ m_alignmentPatternCenters.push_back(82);
+ m_alignmentPatternCenters.push_back(110);
+ m_alignmentPatternCenters.push_back(138);
+ m_alignmentPatternCenters.push_back(166);
break;
case 40:
- m_alignmentPatternCenters.Add(6);
- m_alignmentPatternCenters.Add(30);
- m_alignmentPatternCenters.Add(58);
- m_alignmentPatternCenters.Add(86);
- m_alignmentPatternCenters.Add(114);
- m_alignmentPatternCenters.Add(142);
- m_alignmentPatternCenters.Add(170);
+ m_alignmentPatternCenters.push_back(6);
+ m_alignmentPatternCenters.push_back(30);
+ m_alignmentPatternCenters.push_back(58);
+ m_alignmentPatternCenters.push_back(86);
+ m_alignmentPatternCenters.push_back(114);
+ m_alignmentPatternCenters.push_back(142);
+ m_alignmentPatternCenters.push_back(170);
break;
}
}
CBC_QRCoderVersion::~CBC_QRCoderVersion() {
- for (int32_t i = 0; i < m_ecBlocksArray.GetSize(); ++i)
+ for (size_t i = 0; i < m_ecBlocksArray.size(); ++i)
delete m_ecBlocksArray[i];
}
int32_t CBC_QRCoderVersion::GetVersionNumber() {
return m_versionNumber;
}
-CFX_ArrayTemplate<int32_t>* CBC_QRCoderVersion::GetAlignmentPatternCenters() {
+std::vector<int32_t>* CBC_QRCoderVersion::GetAlignmentPatternCenters() {
return &m_alignmentPatternCenters;
}
int32_t CBC_QRCoderVersion::GetTotalCodeWords() {
@@ -419,10 +419,10 @@ CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(int32_t& e) {
bitMatrix->SetRegion(0, dimension - 8, 9, 8, e);
if (e != BCExceptionNO)
return nullptr;
- int32_t max = m_alignmentPatternCenters.GetSize();
- for (int32_t x = 0; x < max; x++) {
+ size_t max = m_alignmentPatternCenters.size();
+ for (size_t x = 0; x < max; x++) {
int32_t i = m_alignmentPatternCenters[x] - 2;
- for (int32_t y = 0; y < max; y++) {
+ for (size_t y = 0; y < max; y++) {
if ((x == 0 && (y == 0 || y == max - 1)) || (x == max - 1 && y == 0)) {
continue;
}
@@ -450,47 +450,47 @@ CBC_CommonBitMatrix* CBC_QRCoderVersion::BuildFunctionPattern(int32_t& e) {
CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
int32_t versionNumber,
int32_t& e) {
- if (VERSION->GetSize() == 0) {
- VERSION->Add(new CBC_QRCoderVersion(
+ if (VERSION->empty()) {
+ VERSION->push_back(new CBC_QRCoderVersion(
1, new CBC_QRCoderECBlocks(7, new CBC_QRCoderECB(1, 19)),
new CBC_QRCoderECBlocks(10, new CBC_QRCoderECB(1, 16)),
new CBC_QRCoderECBlocks(13, new CBC_QRCoderECB(1, 13)),
new CBC_QRCoderECBlocks(17, new CBC_QRCoderECB(1, 9))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
2, new CBC_QRCoderECBlocks(10, new CBC_QRCoderECB(1, 34)),
new CBC_QRCoderECBlocks(16, new CBC_QRCoderECB(1, 28)),
new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(1, 22)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(1, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
3, new CBC_QRCoderECBlocks(15, new CBC_QRCoderECB(1, 55)),
new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(1, 44)),
new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 17)),
new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(2, 13))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
4, new CBC_QRCoderECBlocks(20, new CBC_QRCoderECB(1, 80)),
new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 32)),
new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(2, 24)),
new CBC_QRCoderECBlocks(16, new CBC_QRCoderECB(4, 9))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
5, new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(1, 108)),
new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(2, 43)),
new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 15),
new CBC_QRCoderECB(2, 16)),
new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(2, 11),
new CBC_QRCoderECB(2, 12))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
6, new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 68)),
new CBC_QRCoderECBlocks(16, new CBC_QRCoderECB(4, 27)),
new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(4, 19)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(4, 15))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
7, new CBC_QRCoderECBlocks(20, new CBC_QRCoderECB(2, 78)),
new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(4, 31)),
new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 14),
new CBC_QRCoderECB(4, 15)),
new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 13),
new CBC_QRCoderECB(1, 14))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
8, new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(2, 97)),
new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(2, 38),
new CBC_QRCoderECB(2, 39)),
@@ -498,7 +498,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(2, 19)),
new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 14),
new CBC_QRCoderECB(2, 15))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
9, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(2, 116)),
new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(3, 36),
new CBC_QRCoderECB(2, 37)),
@@ -506,7 +506,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(4, 17)),
new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(4, 12),
new CBC_QRCoderECB(4, 13))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
10, new CBC_QRCoderECBlocks(18, new CBC_QRCoderECB(2, 68),
new CBC_QRCoderECB(2, 69)),
new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 43),
@@ -515,7 +515,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(2, 20)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(6, 15),
new CBC_QRCoderECB(2, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
11, new CBC_QRCoderECBlocks(20, new CBC_QRCoderECB(4, 81)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(1, 50),
new CBC_QRCoderECB(4, 51)),
@@ -523,7 +523,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(4, 23)),
new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(3, 12),
new CBC_QRCoderECB(8, 13))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
12, new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(2, 92),
new CBC_QRCoderECB(2, 93)),
new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(6, 36),
@@ -532,7 +532,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(6, 21)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(7, 14),
new CBC_QRCoderECB(4, 15))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
13, new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(4, 107)),
new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(8, 37),
new CBC_QRCoderECB(1, 38)),
@@ -540,7 +540,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(4, 21)),
new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(12, 11),
new CBC_QRCoderECB(4, 12))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
14, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(3, 115),
new CBC_QRCoderECB(1, 116)),
new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(4, 40),
@@ -549,7 +549,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(5, 17)),
new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(11, 12),
new CBC_QRCoderECB(5, 13))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
15, new CBC_QRCoderECBlocks(22, new CBC_QRCoderECB(5, 87),
new CBC_QRCoderECB(1, 88)),
new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(5, 41),
@@ -558,7 +558,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(7, 25)),
new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(11, 12),
new CBC_QRCoderECB(7, 13))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
16, new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(5, 98),
new CBC_QRCoderECB(1, 99)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(7, 45),
@@ -567,7 +567,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(2, 20)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(3, 15),
new CBC_QRCoderECB(13, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
17, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(1, 107),
new CBC_QRCoderECB(5, 108)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(10, 46),
@@ -576,7 +576,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(15, 23)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(2, 14),
new CBC_QRCoderECB(17, 15))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
18, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(5, 120),
new CBC_QRCoderECB(1, 121)),
new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(9, 43),
@@ -585,7 +585,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(1, 23)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(2, 14),
new CBC_QRCoderECB(19, 15))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
19, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(3, 113),
new CBC_QRCoderECB(4, 114)),
new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(3, 44),
@@ -594,7 +594,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(4, 22)),
new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(9, 13),
new CBC_QRCoderECB(16, 14))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
20, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(3, 107),
new CBC_QRCoderECB(5, 108)),
new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(3, 41),
@@ -603,7 +603,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(5, 25)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(15, 15),
new CBC_QRCoderECB(10, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
21, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(4, 116),
new CBC_QRCoderECB(4, 117)),
new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(17, 42)),
@@ -611,14 +611,14 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(6, 23)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(19, 16),
new CBC_QRCoderECB(6, 17))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
22, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(2, 111),
new CBC_QRCoderECB(7, 112)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(17, 46)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(7, 24),
new CBC_QRCoderECB(16, 25)),
new CBC_QRCoderECBlocks(24, new CBC_QRCoderECB(34, 13))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
23, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(4, 121),
new CBC_QRCoderECB(5, 122)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(4, 47),
@@ -627,7 +627,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(14, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(16, 15),
new CBC_QRCoderECB(14, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
24, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(6, 117),
new CBC_QRCoderECB(4, 118)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(6, 45),
@@ -636,7 +636,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(16, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(30, 16),
new CBC_QRCoderECB(2, 17))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
25, new CBC_QRCoderECBlocks(26, new CBC_QRCoderECB(8, 106),
new CBC_QRCoderECB(4, 107)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(8, 47),
@@ -645,7 +645,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(22, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(22, 15),
new CBC_QRCoderECB(13, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
26, new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(10, 114),
new CBC_QRCoderECB(2, 115)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(19, 46),
@@ -654,7 +654,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(6, 23)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(33, 16),
new CBC_QRCoderECB(4, 17))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
27, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(8, 122),
new CBC_QRCoderECB(4, 123)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(22, 45),
@@ -663,7 +663,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(26, 24)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(12, 15),
new CBC_QRCoderECB(28, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
28, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(3, 117),
new CBC_QRCoderECB(10, 118)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(3, 45),
@@ -672,7 +672,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(31, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(11, 15),
new CBC_QRCoderECB(31, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
29, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(7, 116),
new CBC_QRCoderECB(7, 117)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(21, 45),
@@ -681,7 +681,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(37, 24)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(19, 15),
new CBC_QRCoderECB(26, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
30, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(5, 115),
new CBC_QRCoderECB(10, 116)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(19, 47),
@@ -690,7 +690,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(25, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(23, 15),
new CBC_QRCoderECB(25, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
31, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(13, 115),
new CBC_QRCoderECB(3, 116)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(2, 46),
@@ -699,7 +699,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(1, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(23, 15),
new CBC_QRCoderECB(28, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
32, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(17, 115)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(10, 46),
new CBC_QRCoderECB(23, 47)),
@@ -707,7 +707,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(35, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(19, 15),
new CBC_QRCoderECB(35, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
33, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(17, 115),
new CBC_QRCoderECB(1, 116)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(14, 46),
@@ -716,7 +716,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(19, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(11, 15),
new CBC_QRCoderECB(46, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
34, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(13, 115),
new CBC_QRCoderECB(6, 116)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(14, 46),
@@ -725,7 +725,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(7, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(59, 16),
new CBC_QRCoderECB(1, 17))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
35, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(12, 121),
new CBC_QRCoderECB(7, 122)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(12, 47),
@@ -734,7 +734,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(14, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(22, 15),
new CBC_QRCoderECB(41, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
36, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(6, 121),
new CBC_QRCoderECB(14, 122)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(6, 47),
@@ -743,7 +743,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(10, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(2, 15),
new CBC_QRCoderECB(64, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
37, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(17, 122),
new CBC_QRCoderECB(4, 123)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(29, 46),
@@ -752,7 +752,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(10, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(24, 15),
new CBC_QRCoderECB(46, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
38, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(4, 122),
new CBC_QRCoderECB(18, 123)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(13, 46),
@@ -761,7 +761,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(14, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(42, 15),
new CBC_QRCoderECB(32, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
39, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(20, 117),
new CBC_QRCoderECB(4, 118)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(40, 47),
@@ -770,7 +770,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
new CBC_QRCoderECB(22, 25)),
new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(10, 15),
new CBC_QRCoderECB(67, 16))));
- VERSION->Add(new CBC_QRCoderVersion(
+ VERSION->push_back(new CBC_QRCoderVersion(
40, new CBC_QRCoderECBlocks(30, new CBC_QRCoderECB(19, 118),
new CBC_QRCoderECB(6, 119)),
new CBC_QRCoderECBlocks(28, new CBC_QRCoderECB(18, 47),
@@ -788,7 +788,7 @@ CBC_QRCoderVersion* CBC_QRCoderVersion::GetVersionForNumber(
}
void CBC_QRCoderVersion::Destroy() {
- for (int32_t i = 0; i < VERSION->GetSize(); i++)
+ for (size_t i = 0; i < VERSION->size(); i++)
delete (*VERSION)[i];
- VERSION->RemoveAll();
+ VERSION->clear();
}
diff --git a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.h b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.h
index 030dd512a0..853a93ed0c 100644
--- a/xfa/fxbarcode/qrcode/BC_QRCoderVersion.h
+++ b/xfa/fxbarcode/qrcode/BC_QRCoderVersion.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_QRCODE_BC_QRCODERVERSION_H_
#define XFA_FXBARCODE_QRCODE_BC_QRCODERVERSION_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
class CBC_CommonBitMatrix;
@@ -23,7 +25,7 @@ class CBC_QRCoderVersion {
int32_t GetTotalCodeWords();
int32_t GetDimensionForVersion();
CBC_CommonBitMatrix* BuildFunctionPattern(int32_t& e);
- CFX_ArrayTemplate<int32_t>* GetAlignmentPatternCenters();
+ std::vector<int32_t>* GetAlignmentPatternCenters();
CBC_QRCoderECBlocks* GetECBlocksForLevel(
CBC_QRCoderErrorCorrectionLevel* ecLevel);
static CBC_QRCoderVersion* GetVersionForNumber(int32_t versionNumber,
@@ -44,12 +46,12 @@ class CBC_QRCoderVersion {
CBC_QRCoderECBlocks* ecBlocks4);
static const int32_t VERSION_DECODE_INFO[34];
- static CFX_ArrayTemplate<CBC_QRCoderVersion*>* VERSION;
+ static std::vector<CBC_QRCoderVersion*>* VERSION;
int32_t m_versionNumber;
int32_t m_totalCodeWords;
- CFX_ArrayTemplate<int32_t> m_alignmentPatternCenters;
- CFX_ArrayTemplate<CBC_QRCoderECBlocks*> m_ecBlocksArray;
+ std::vector<int32_t> m_alignmentPatternCenters;
+ std::vector<CBC_QRCoderECBlocks*> m_ecBlocksArray;
};
#endif // XFA_FXBARCODE_QRCODE_BC_QRCODERVERSION_H_
diff --git a/xfa/fxbarcode/utils.h b/xfa/fxbarcode/utils.h
index 21ef3830ef..93a3c576cb 100644
--- a/xfa/fxbarcode/utils.h
+++ b/xfa/fxbarcode/utils.h
@@ -7,6 +7,8 @@
#ifndef XFA_FXBARCODE_UTILS_H_
#define XFA_FXBARCODE_UTILS_H_
+#include <vector>
+
#include "core/fxcrt/fx_basic.h"
bool BC_FX_ByteString_Replace(CFX_ByteString& dst,
@@ -16,7 +18,7 @@ bool BC_FX_ByteString_Replace(CFX_ByteString& dst,
char c);
void BC_FX_ByteString_Append(CFX_ByteString& dst, int32_t count, char c);
void BC_FX_ByteString_Append(CFX_ByteString& dst,
- const CFX_ArrayTemplate<uint8_t>& ba);
+ const std::vector<uint8_t>& ba);
#if (_FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_)
#include <limits>