summaryrefslogtreecommitdiff
path: root/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp')
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp
index 5d94d7ac06..ca115391ef 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp
@@ -27,12 +27,12 @@
#include "../oned/BC_OnedCode39Reader.h"
#include "../oned/BC_OnedCodaBarReader.h"
FX_LPCSTR CBC_OnedCodaBarReader::ALPHABET_STRING = "0123456789-$:/.+ABCDTN";
-const FX_INT32 CBC_OnedCodaBarReader::CHARACTER_ENCODINGS[22] = {
+const int32_t CBC_OnedCodaBarReader::CHARACTER_ENCODINGS[22] = {
0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024, 0x030, 0x048,
0x00c, 0x018, 0x045, 0x051, 0x054, 0x015, 0x01A, 0x029, 0x00B, 0x00E,
0x01A, 0x029
};
-const FX_INT32 CBC_OnedCodaBarReader::minCharacterLength = 3;
+const int32_t CBC_OnedCodaBarReader::minCharacterLength = 3;
const FX_CHAR CBC_OnedCodaBarReader::STARTEND_ENCODING[8] = {'E', '*', 'A', 'B', 'C', 'D', 'T', 'N'};
CBC_OnedCodaBarReader::CBC_OnedCodaBarReader()
{
@@ -40,14 +40,14 @@ CBC_OnedCodaBarReader::CBC_OnedCodaBarReader()
CBC_OnedCodaBarReader::~CBC_OnedCodaBarReader()
{
}
-CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e)
{
CFX_Int32Array *int32Ptr = FindAsteriskPattern(row, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
CBC_AutoPtr<CFX_Int32Array> start(int32Ptr);
(*start)[1] = 0;
- FX_INT32 nextStart = (*start)[1];
- FX_INT32 end = row->GetSize();
+ int32_t nextStart = (*start)[1];
+ int32_t end = row->GetSize();
while (nextStart < end && !row->Get(nextStart)) {
nextStart++;
}
@@ -55,7 +55,7 @@ CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi
CFX_Int32Array counters;
counters.SetSize(7);
FX_CHAR decodedChar;
- FX_INT32 lastStart;
+ int32_t lastStart;
do {
RecordPattern(row, nextStart, &counters, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -66,18 +66,18 @@ CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi
}
result += decodedChar;
lastStart = nextStart;
- for (FX_INT32 i = 0; i < counters.GetSize(); i++) {
+ for (int32_t i = 0; i < counters.GetSize(); i++) {
nextStart += counters[i];
}
while (nextStart < end && !row->Get(nextStart)) {
nextStart++;
}
} while (nextStart < end);
- FX_INT32 lastPatternSize = 0;
- for (FX_INT32 j = 0; j < counters.GetSize(); j++) {
+ int32_t lastPatternSize = 0;
+ for (int32_t j = 0; j < counters.GetSize(); j++) {
lastPatternSize += counters[j];
}
- FX_INT32 whiteSpaceAfterEnd = nextStart - lastStart - lastPatternSize;
+ int32_t whiteSpaceAfterEnd = nextStart - lastStart - lastPatternSize;
if (nextStart != end && (whiteSpaceAfterEnd / 2 < lastPatternSize)) {
e = BCExceptionNotFound;
return "";
@@ -91,9 +91,9 @@ CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi
e = BCExceptionNotFound;
return "";
}
- FX_INT32 len = result.GetLength();
+ int32_t len = result.GetLength();
CFX_ByteString temp = result;
- for (FX_INT32 k = 1; k < result.GetLength(); k++) {
+ for (int32_t k = 1; k < result.GetLength(); k++) {
if (ArrayContains(STARTEND_ENCODING, result[k])) {
if ((k + 1) != result.GetLength()) {
result.Delete(1, k);
@@ -102,7 +102,7 @@ CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi
}
}
if (result.GetLength() < 5) {
- FX_INT32 index = temp.Find(result.Mid(1, result.GetLength() - 1));
+ int32_t index = temp.Find(result.Mid(1, result.GetLength() - 1));
if (index == len - (result.GetLength() - 1)) {
e = BCExceptionNotFound;
return "";
@@ -116,23 +116,23 @@ CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi
}
return result;
}
-CFX_Int32Array *CBC_OnedCodaBarReader::FindAsteriskPattern(CBC_CommonBitArray *row, FX_INT32 &e)
+CFX_Int32Array *CBC_OnedCodaBarReader::FindAsteriskPattern(CBC_CommonBitArray *row, int32_t &e)
{
- FX_INT32 width = row->GetSize();
- FX_INT32 rowOffset = 0;
+ int32_t width = row->GetSize();
+ int32_t rowOffset = 0;
while (rowOffset < width) {
if (row->Get(rowOffset)) {
break;
}
rowOffset++;
}
- FX_INT32 counterPosition = 0;
+ int32_t counterPosition = 0;
CFX_Int32Array counters;
counters.SetSize(7);
- FX_INT32 patternStart = rowOffset;
+ int32_t patternStart = rowOffset;
FX_BOOL isWhite = FALSE;
- FX_INT32 patternLength = counters.GetSize();
- for (FX_INT32 i = rowOffset; i < width; i++) {
+ int32_t patternLength = counters.GetSize();
+ for (int32_t i = rowOffset; i < width; i++) {
FX_BOOL pixel = row->Get(i);
if (pixel ^ isWhite) {
counters[counterPosition]++;
@@ -150,7 +150,7 @@ CFX_Int32Array *CBC_OnedCodaBarReader::FindAsteriskPattern(CBC_CommonBitArray *r
}
}
patternStart += counters[0] + counters[1];
- for (FX_INT32 y = 2; y < patternLength; y++) {
+ for (int32_t y = 2; y < patternLength; y++) {
counters[y - 2] = counters[y];
}
counters[patternLength - 2] = 0;
@@ -168,7 +168,7 @@ CFX_Int32Array *CBC_OnedCodaBarReader::FindAsteriskPattern(CBC_CommonBitArray *r
}
FX_BOOL CBC_OnedCodaBarReader::ArrayContains(const FX_CHAR array[], FX_CHAR key)
{
- for(FX_INT32 i = 0; i < 8; i++) {
+ for(int32_t i = 0; i < 8; i++) {
if(array[i] == key) {
return TRUE;
}
@@ -177,26 +177,26 @@ FX_BOOL CBC_OnedCodaBarReader::ArrayContains(const FX_CHAR array[], FX_CHAR key)
}
FX_CHAR CBC_OnedCodaBarReader::ToNarrowWidePattern(CFX_Int32Array *counter)
{
- FX_INT32 numCounters = counter->GetSize();
+ int32_t numCounters = counter->GetSize();
if (numCounters < 1) {
return '!';
}
- FX_INT32 averageCounter = 0;
- FX_INT32 totalCounters = 0;
- for (FX_INT32 i = 0; i < numCounters; i++) {
+ int32_t averageCounter = 0;
+ int32_t totalCounters = 0;
+ for (int32_t i = 0; i < numCounters; i++) {
totalCounters += (*counter)[i];
}
averageCounter = totalCounters / numCounters;
- FX_INT32 pattern = 0;
- FX_INT32 wideCounters = 0;
- for (FX_INT32 j = 0; j < numCounters; j++) {
+ int32_t pattern = 0;
+ int32_t wideCounters = 0;
+ for (int32_t j = 0; j < numCounters; j++) {
if ((*counter)[j] > averageCounter) {
pattern |= 1 << (numCounters - 1 - j);
wideCounters++;
}
}
if ((wideCounters == 2) || (wideCounters == 3)) {
- for (FX_INT32 k = 0; k < 22; k++) {
+ for (int32_t k = 0; k < 22; k++) {
if (CHARACTER_ENCODINGS[k] == pattern) {
return (ALPHABET_STRING)[k];
}