summaryrefslogtreecommitdiff
path: root/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxbarcode/datamatrix/BC_ErrorCorrection.cpp')
-rw-r--r--fxbarcode/datamatrix/BC_ErrorCorrection.cpp41
1 files changed, 20 insertions, 21 deletions
diff --git a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
index c45eadcf9a..35077ee628 100644
--- a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
+++ b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
@@ -119,22 +119,21 @@ void CBC_ErrorCorrection::Initialize() {
void CBC_ErrorCorrection::Finalize() {}
CBC_ErrorCorrection::CBC_ErrorCorrection() {}
CBC_ErrorCorrection::~CBC_ErrorCorrection() {}
-CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords,
- CBC_SymbolInfo* symbolInfo,
- int32_t& e) {
+WideString CBC_ErrorCorrection::encodeECC200(WideString codewords,
+ CBC_SymbolInfo* symbolInfo,
+ int32_t& e) {
if (pdfium::base::checked_cast<int32_t>(codewords.GetLength()) !=
symbolInfo->dataCapacity()) {
e = BCExceptionIllegalArgument;
- return CFX_WideString();
+ return WideString();
}
- CFX_WideString sb;
+ WideString sb;
sb += codewords;
int32_t blockCount = symbolInfo->getInterleavedBlockCount();
if (blockCount == 1) {
- CFX_WideString ecc =
- createECCBlock(codewords, symbolInfo->errorCodewords(), e);
+ WideString ecc = createECCBlock(codewords, symbolInfo->errorCodewords(), e);
if (e != BCExceptionNO)
- return CFX_WideString();
+ return WideString();
sb += ecc;
} else {
std::vector<int32_t> dataSizes(blockCount);
@@ -149,13 +148,13 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords,
}
}
for (int32_t block = 0; block < blockCount; block++) {
- CFX_WideString temp;
+ WideString temp;
for (int32_t d = block; d < symbolInfo->dataCapacity(); d += blockCount) {
temp += (wchar_t)codewords[d];
}
- CFX_WideString ecc = createECCBlock(temp, errorSizes[block], e);
+ WideString ecc = createECCBlock(temp, errorSizes[block], e);
if (e != BCExceptionNO)
- return CFX_WideString();
+ return WideString();
int32_t pos = 0;
for (int32_t l = block; l < errorSizes[block] * blockCount;
l += blockCount) {
@@ -165,16 +164,16 @@ CFX_WideString CBC_ErrorCorrection::encodeECC200(CFX_WideString codewords,
}
return sb;
}
-CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
- int32_t numECWords,
- int32_t& e) {
+WideString CBC_ErrorCorrection::createECCBlock(WideString codewords,
+ int32_t numECWords,
+ int32_t& e) {
return createECCBlock(codewords, 0, codewords.GetLength(), numECWords, e);
}
-CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
- int32_t start,
- int32_t len,
- int32_t numECWords,
- int32_t& e) {
+WideString CBC_ErrorCorrection::createECCBlock(WideString codewords,
+ int32_t start,
+ int32_t len,
+ int32_t numECWords,
+ int32_t& e) {
static const size_t kFactorTableNum = sizeof(FACTOR_SETS) / sizeof(int32_t);
size_t table = 0;
while (table < kFactorTableNum && FACTOR_SETS[table] != numECWords)
@@ -182,7 +181,7 @@ CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
if (table >= kFactorTableNum) {
e = BCExceptionIllegalArgument;
- return CFX_WideString();
+ return WideString();
}
uint16_t* ecc = FX_Alloc(uint16_t, numECWords);
memset(ecc, 0, numECWords * sizeof(uint16_t));
@@ -202,7 +201,7 @@ CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
ecc[0] = 0;
}
}
- CFX_WideString strecc;
+ WideString strecc;
for (int32_t j = 0; j < numECWords; j++) {
strecc += (wchar_t)ecc[numECWords - j - 1];
}