summaryrefslogtreecommitdiff
path: root/xfa/fxbarcode/datamatrix
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxbarcode/datamatrix')
-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
5 files changed, 38 insertions, 47 deletions
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);