diff options
Diffstat (limited to 'xfa/src/fxbarcode/oned')
30 files changed, 590 insertions, 590 deletions
diff --git a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp index 1079c348d0..810b2c70c7 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp @@ -25,44 +25,44 @@ #include "../BC_BinaryBitmap.h"
#include "../common/BC_CommonBitArray.h"
#include "BC_OneDReader.h"
-const FX_INT32 CBC_OneDReader::INTEGER_MATH_SHIFT = 8;
-const FX_INT32 CBC_OneDReader::PATTERN_MATCH_RESULT_SCALE_FACTOR = 1 << 8;
+const int32_t CBC_OneDReader::INTEGER_MATH_SHIFT = 8;
+const int32_t CBC_OneDReader::PATTERN_MATCH_RESULT_SCALE_FACTOR = 1 << 8;
CBC_OneDReader::CBC_OneDReader()
{
}
CBC_OneDReader::~CBC_OneDReader()
{
}
-CFX_ByteString CBC_OneDReader::Decode(CBC_BinaryBitmap *image, FX_INT32 &e)
+CFX_ByteString CBC_OneDReader::Decode(CBC_BinaryBitmap *image, int32_t &e)
{
CFX_ByteString strtemp = Decode(image, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
return strtemp;
}
-CFX_ByteString CBC_OneDReader::Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OneDReader::Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e)
{
CFX_ByteString strtemp = DeDecode(image, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
return strtemp;
}
-CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e)
{
- FX_INT32 width = image->GetWidth();
- FX_INT32 height = image->GetHeight();
+ int32_t width = image->GetWidth();
+ int32_t height = image->GetHeight();
CBC_CommonBitArray *row = NULL;
- FX_INT32 middle = height >> 1;
+ int32_t middle = height >> 1;
FX_BOOL tryHarder = FALSE;
- FX_INT32 rowStep = FX_MAX(1, height >> (tryHarder ? 8 : 5));
- FX_INT32 maxLines;
+ int32_t rowStep = FX_MAX(1, height >> (tryHarder ? 8 : 5));
+ int32_t maxLines;
if (tryHarder) {
maxLines = height;
} else {
maxLines = 15;
}
- for (FX_INT32 x = 0; x < maxLines; x++) {
- FX_INT32 rowStepsAboveOrBelow = (x + 1) >> 1;
+ for (int32_t x = 0; x < maxLines; x++) {
+ int32_t rowStepsAboveOrBelow = (x + 1) >> 1;
FX_BOOL isAbove = (x & 0x01) == 0;
- FX_INT32 rowNumber = middle + rowStep * (isAbove ? rowStepsAboveOrBelow : -rowStepsAboveOrBelow);
+ int32_t rowNumber = middle + rowStep * (isAbove ? rowStepsAboveOrBelow : -rowStepsAboveOrBelow);
if (rowNumber < 0 || rowNumber >= height) {
break;
}
@@ -75,7 +75,7 @@ CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap *image, FX_INT32 hints, }
continue;
}
- for (FX_INT32 attempt = 0; attempt < 2; attempt++) {
+ for (int32_t attempt = 0; attempt < 2; attempt++) {
if (attempt == 1) {
row->Reverse();
}
@@ -98,20 +98,20 @@ CFX_ByteString CBC_OneDReader::DeDecode(CBC_BinaryBitmap *image, FX_INT32 hints, e = BCExceptionNotFound;
return "";
}
-void CBC_OneDReader::RecordPattern(CBC_CommonBitArray *row, FX_INT32 start, CFX_Int32Array *counters, FX_INT32 &e)
+void CBC_OneDReader::RecordPattern(CBC_CommonBitArray *row, int32_t start, CFX_Int32Array *counters, int32_t &e)
{
- FX_INT32 numCounters = counters->GetSize();
- for (FX_INT32 i = 0; i < numCounters; i++) {
+ int32_t numCounters = counters->GetSize();
+ for (int32_t i = 0; i < numCounters; i++) {
(*counters)[i] = 0;
}
- FX_INT32 end = row->GetSize();
+ int32_t end = row->GetSize();
if (start >= end) {
e = BCExceptionNotFound;
return;
}
FX_BOOL isWhite = !row->Get(start);
- FX_INT32 counterPosition = 0;
- FX_INT32 j = start;
+ int32_t counterPosition = 0;
+ int32_t j = start;
while (j < end) {
FX_BOOL pixel = row->Get(j);
if (pixel ^ isWhite) {
@@ -132,9 +132,9 @@ void CBC_OneDReader::RecordPattern(CBC_CommonBitArray *row, FX_INT32 start, CFX_ return;
}
}
-void CBC_OneDReader::RecordPatternInReverse(CBC_CommonBitArray *row, FX_INT32 start, CFX_Int32Array *counters, FX_INT32 &e)
+void CBC_OneDReader::RecordPatternInReverse(CBC_CommonBitArray *row, int32_t start, CFX_Int32Array *counters, int32_t &e)
{
- FX_INT32 numTransitionsLeft = counters->GetSize();
+ int32_t numTransitionsLeft = counters->GetSize();
FX_BOOL last = row->Get(start);
while (start > 0 && numTransitionsLeft >= 0) {
if (row->Get(--start) != last) {
@@ -149,12 +149,12 @@ void CBC_OneDReader::RecordPatternInReverse(CBC_CommonBitArray *row, FX_INT32 st RecordPattern(row, start + 1, counters, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
-FX_INT32 CBC_OneDReader::PatternMatchVariance(CFX_Int32Array *counters, const FX_INT32 *pattern, FX_INT32 maxIndividualVariance)
+int32_t CBC_OneDReader::PatternMatchVariance(CFX_Int32Array *counters, const int32_t *pattern, int32_t maxIndividualVariance)
{
- FX_INT32 numCounters = counters->GetSize();
- FX_INT32 total = 0;
- FX_INT32 patternLength = 0;
- for (FX_INT32 i = 0; i < numCounters; i++) {
+ int32_t numCounters = counters->GetSize();
+ int32_t total = 0;
+ int32_t patternLength = 0;
+ for (int32_t i = 0; i < numCounters; i++) {
total += (*counters)[i];
patternLength += pattern[i];
}
@@ -162,13 +162,13 @@ FX_INT32 CBC_OneDReader::PatternMatchVariance(CFX_Int32Array *counters, const FX #undef max
return FXSYS_IntMax;
}
- FX_INT32 unitBarWidth = (total << INTEGER_MATH_SHIFT) / patternLength;
+ int32_t unitBarWidth = (total << INTEGER_MATH_SHIFT) / patternLength;
maxIndividualVariance = (maxIndividualVariance * unitBarWidth) >> INTEGER_MATH_SHIFT;
- FX_INT32 totalVariance = 0;
- for (FX_INT32 x = 0; x < numCounters; x++) {
- FX_INT32 counter = (*counters)[x] << INTEGER_MATH_SHIFT;
- FX_INT32 scaledPattern = pattern[x] * unitBarWidth;
- FX_INT32 variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;
+ int32_t totalVariance = 0;
+ for (int32_t x = 0; x < numCounters; x++) {
+ int32_t counter = (*counters)[x] << INTEGER_MATH_SHIFT;
+ int32_t scaledPattern = pattern[x] * unitBarWidth;
+ int32_t variance = counter > scaledPattern ? counter - scaledPattern : scaledPattern - counter;
if (variance > maxIndividualVariance) {
#undef max
return FXSYS_IntMax;
diff --git a/xfa/src/fxbarcode/oned/BC_OneDReader.h b/xfa/src/fxbarcode/oned/BC_OneDReader.h index 8645c9edf9..064f5edae0 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDReader.h +++ b/xfa/src/fxbarcode/oned/BC_OneDReader.h @@ -15,20 +15,20 @@ class CBC_OneDReader : public CBC_Reader public:
CBC_OneDReader();
virtual ~CBC_OneDReader();
- virtual CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 &e);
- virtual CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e);
- virtual CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e)
+ virtual CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t &e);
+ virtual CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e);
+ virtual CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e)
{
return "";
}
private:
- CFX_ByteString DeDecode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e);
+ CFX_ByteString DeDecode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e);
protected:
- const static FX_INT32 INTEGER_MATH_SHIFT;
- const static FX_INT32 PATTERN_MATCH_RESULT_SCALE_FACTOR;
- void RecordPattern(CBC_CommonBitArray *row, FX_INT32 start, CFX_Int32Array *counters, FX_INT32 &e);
- void RecordPatternInReverse(CBC_CommonBitArray *row, FX_INT32 start, CFX_Int32Array *counters, FX_INT32 &e);
- FX_INT32 PatternMatchVariance(CFX_Int32Array *counters, const FX_INT32 *pattern, FX_INT32 maxIndividualVariance);
+ const static int32_t INTEGER_MATH_SHIFT;
+ const static int32_t PATTERN_MATCH_RESULT_SCALE_FACTOR;
+ void RecordPattern(CBC_CommonBitArray *row, int32_t start, CFX_Int32Array *counters, int32_t &e);
+ void RecordPatternInReverse(CBC_CommonBitArray *row, int32_t start, CFX_Int32Array *counters, int32_t &e);
+ int32_t PatternMatchVariance(CFX_Int32Array *counters, const int32_t *pattern, int32_t maxIndividualVariance);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp b/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp index f1db94a6a1..a2dd7a1972 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp @@ -25,11 +25,11 @@ #include "../common/BC_CommonBitArray.h"
#include "BC_OneDReader.h"
#include "BC_OneDimReader.h"
-const FX_INT32 CBC_OneDimReader::MAX_AVG_VARIANCE = (FX_INT32)(256 * 0.48f);
-const FX_INT32 CBC_OneDimReader::MAX_INDIVIDUAL_VARIANCE = (FX_INT32)(256 * 0.7f);
-const FX_INT32 CBC_OneDimReader::START_END_PATTERN[3] = {1, 1, 1};
-const FX_INT32 CBC_OneDimReader::MIDDLE_PATTERN[5] = {1, 1, 1, 1, 1};
-const FX_INT32 CBC_OneDimReader::L_PATTERNS[10][4] = {
+const int32_t CBC_OneDimReader::MAX_AVG_VARIANCE = (int32_t)(256 * 0.48f);
+const int32_t CBC_OneDimReader::MAX_INDIVIDUAL_VARIANCE = (int32_t)(256 * 0.7f);
+const int32_t CBC_OneDimReader::START_END_PATTERN[3] = {1, 1, 1};
+const int32_t CBC_OneDimReader::MIDDLE_PATTERN[5] = {1, 1, 1, 1, 1};
+const int32_t CBC_OneDimReader::L_PATTERNS[10][4] = {
{3, 2, 1, 1},
{2, 2, 2, 1},
{2, 1, 2, 2},
@@ -41,7 +41,7 @@ const FX_INT32 CBC_OneDimReader::L_PATTERNS[10][4] = { {1, 2, 1, 3},
{3, 1, 1, 2}
};
-const FX_INT32 CBC_OneDimReader::L_AND_G_PATTERNS[20][4] = {
+const int32_t CBC_OneDimReader::L_AND_G_PATTERNS[20][4] = {
{3, 2, 1, 1},
{2, 2, 2, 1},
{2, 1, 2, 2},
@@ -69,7 +69,7 @@ CBC_OneDimReader::CBC_OneDimReader() CBC_OneDimReader::~CBC_OneDimReader()
{
}
-CFX_Int32Array *CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray *row, FX_INT32 &e)
+CFX_Int32Array *CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray *row, int32_t &e)
{
FX_BOOL foundStart = FALSE;
CFX_Int32Array *startRange = NULL;
@@ -78,7 +78,7 @@ CFX_Int32Array *CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray *row, startEndPattern[0] = START_END_PATTERN[0];
startEndPattern[1] = START_END_PATTERN[1];
startEndPattern[2] = START_END_PATTERN[2];
- FX_INT32 nextStart = 0;
+ int32_t nextStart = 0;
while (!foundStart) {
if(startRange != NULL) {
delete startRange;
@@ -86,12 +86,12 @@ CFX_Int32Array *CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray *row, }
startRange = FindGuardPattern(row, nextStart, FALSE, &startEndPattern, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
- FX_INT32 start = (*startRange)[0];
+ int32_t start = (*startRange)[0];
nextStart = (*startRange)[1];
if (start <= 1) {
break;
}
- FX_INT32 quietStart = start - (nextStart - start);
+ int32_t quietStart = start - (nextStart - start);
if (quietStart >= 0) {
FX_BOOL booT = row->IsRange(quietStart, start, FALSE, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
@@ -100,7 +100,7 @@ CFX_Int32Array *CBC_OneDimReader::FindStartGuardPattern(CBC_CommonBitArray *row, }
return startRange;
}
-CFX_ByteString CBC_OneDimReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OneDimReader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e)
{
CFX_Int32Array* StartPattern = FindStartGuardPattern(row, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -109,10 +109,10 @@ CFX_ByteString CBC_OneDimReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArra BC_EXCEPTION_CHECK_ReturnValue(e, "");
return temp;
}
-CFX_ByteString CBC_OneDimReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OneDimReader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, int32_t hints, int32_t &e)
{
CFX_ByteString result;
- FX_INT32 endStart = DecodeMiddle(row, startGuardRange, result, e);
+ int32_t endStart = DecodeMiddle(row, startGuardRange, result, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
FX_BOOL b = CheckChecksum(result, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -122,21 +122,21 @@ CFX_ByteString CBC_OneDimReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArra }
return result;
}
-FX_BOOL CBC_OneDimReader::CheckChecksum(CFX_ByteString &s, FX_INT32 &e)
+FX_BOOL CBC_OneDimReader::CheckChecksum(CFX_ByteString &s, int32_t &e)
{
FX_BOOL temp = CheckStandardUPCEANChecksum(s, e);
BC_EXCEPTION_CHECK_ReturnValue(e, FALSE);
return temp;
}
-FX_BOOL CBC_OneDimReader::CheckStandardUPCEANChecksum(CFX_ByteString &s, FX_INT32 &e)
+FX_BOOL CBC_OneDimReader::CheckStandardUPCEANChecksum(CFX_ByteString &s, int32_t &e)
{
- FX_INT32 length = s.GetLength();
+ int32_t length = s.GetLength();
if (length == 0) {
return FALSE;
}
- FX_INT32 sum = 0;
- for (FX_INT32 i = length - 2; i >= 0; i -= 2) {
- FX_INT32 digit = (FX_INT32) s[i] - (FX_INT32) '0';
+ int32_t sum = 0;
+ for (int32_t i = length - 2; i >= 0; i -= 2) {
+ int32_t digit = (int32_t) s[i] - (int32_t) '0';
if (digit < 0 || digit > 9) {
e = BCExceptionFormatException;
return FALSE;
@@ -144,8 +144,8 @@ FX_BOOL CBC_OneDimReader::CheckStandardUPCEANChecksum(CFX_ByteString &s, FX_INT3 sum += digit;
}
sum *= 3;
- for (FX_INT32 j = length - 1; j >= 0; j -= 2) {
- FX_INT32 digit = (FX_INT32) s[j] - (FX_INT32) '0';
+ for (int32_t j = length - 1; j >= 0; j -= 2) {
+ int32_t digit = (int32_t) s[j] - (int32_t) '0';
if (digit < 0 || digit > 9) {
e = BCExceptionFormatException;
return FALSE;
@@ -154,7 +154,7 @@ FX_BOOL CBC_OneDimReader::CheckStandardUPCEANChecksum(CFX_ByteString &s, FX_INT3 }
return sum % 10 == 0;
}
-CFX_Int32Array *CBC_OneDimReader::DecodeEnd(CBC_CommonBitArray* row, FX_INT32 endStart, FX_INT32 &e)
+CFX_Int32Array *CBC_OneDimReader::DecodeEnd(CBC_CommonBitArray* row, int32_t endStart, int32_t &e)
{
CFX_Int32Array startEndPattern;
startEndPattern.Add(START_END_PATTERN[0]);
@@ -164,12 +164,12 @@ CFX_Int32Array *CBC_OneDimReader::DecodeEnd(CBC_CommonBitArray* row, FX_INT32 en BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return FindGuard;
}
-CFX_Int32Array *CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray *row, FX_INT32 rowOffset, FX_BOOL whiteFirst, CFX_Int32Array *pattern, FX_INT32 &e)
+CFX_Int32Array *CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray *row, int32_t rowOffset, FX_BOOL whiteFirst, CFX_Int32Array *pattern, int32_t &e)
{
- FX_INT32 patternLength = pattern->GetSize();
+ int32_t patternLength = pattern->GetSize();
CFX_Int32Array counters;
counters.SetSize(patternLength);
- FX_INT32 width = row->GetSize();
+ int32_t width = row->GetSize();
FX_BOOL isWhite = FALSE;
while (rowOffset < width) {
isWhite = !row->Get(rowOffset);
@@ -178,9 +178,9 @@ CFX_Int32Array *CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray *row, FX_I }
rowOffset++;
}
- FX_INT32 counterPosition = 0;
- FX_INT32 patternStart = rowOffset;
- for (FX_INT32 x = rowOffset; x < width; x++) {
+ int32_t counterPosition = 0;
+ int32_t patternStart = rowOffset;
+ for (int32_t x = rowOffset; x < width; x++) {
FX_BOOL pixel = row->Get(x);
if (pixel ^ isWhite) {
counters[counterPosition]++;
@@ -194,7 +194,7 @@ CFX_Int32Array *CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray *row, FX_I return result;
}
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;
@@ -211,15 +211,15 @@ CFX_Int32Array *CBC_OneDimReader::FindGuardPattern(CBC_CommonBitArray *row, FX_I BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return NULL;
}
-FX_INT32 CBC_OneDimReader::DecodeDigit(CBC_CommonBitArray *row, CFX_Int32Array *counters, FX_INT32 rowOffset, const FX_INT32* patterns, FX_INT32 patternLength, FX_INT32 &e)
+int32_t CBC_OneDimReader::DecodeDigit(CBC_CommonBitArray *row, CFX_Int32Array *counters, int32_t rowOffset, const int32_t* patterns, int32_t patternLength, int32_t &e)
{
RecordPattern(row, rowOffset, counters, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
- FX_INT32 bestVariance = MAX_AVG_VARIANCE;
- FX_INT32 bestMatch = -1;
- FX_INT32 max = patternLength;
- for (FX_INT32 i = 0; i < max; i++) {
- FX_INT32 variance = PatternMatchVariance(counters, &patterns[i * 4], MAX_INDIVIDUAL_VARIANCE);
+ int32_t bestVariance = MAX_AVG_VARIANCE;
+ int32_t bestMatch = -1;
+ int32_t max = patternLength;
+ for (int32_t i = 0; i < max; i++) {
+ int32_t variance = PatternMatchVariance(counters, &patterns[i * 4], MAX_INDIVIDUAL_VARIANCE);
if (variance < bestVariance) {
bestVariance = variance;
bestMatch = i;
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimReader.h b/xfa/src/fxbarcode/oned/BC_OneDimReader.h index bb10060ba3..2e644de841 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDimReader.h +++ b/xfa/src/fxbarcode/oned/BC_OneDimReader.h @@ -12,28 +12,28 @@ class CBC_OneDimReader; class CBC_OneDimReader : public CBC_OneDReader
{
private:
- const static FX_INT32 MAX_AVG_VARIANCE;
- const static FX_INT32 MAX_INDIVIDUAL_VARIANCE;
+ const static int32_t MAX_AVG_VARIANCE;
+ const static int32_t MAX_INDIVIDUAL_VARIANCE;
- FX_BOOL CheckStandardUPCEANChecksum(CFX_ByteString &s, FX_INT32 &e);
+ FX_BOOL CheckStandardUPCEANChecksum(CFX_ByteString &s, int32_t &e);
public:
- const static FX_INT32 START_END_PATTERN[3];
- const static FX_INT32 MIDDLE_PATTERN[5];
- const static FX_INT32 L_PATTERNS[10][4];
- const static FX_INT32 L_AND_G_PATTERNS[20][4];
+ const static int32_t START_END_PATTERN[3];
+ const static int32_t MIDDLE_PATTERN[5];
+ const static int32_t L_PATTERNS[10][4];
+ const static int32_t L_AND_G_PATTERNS[20][4];
CBC_OneDimReader();
virtual ~CBC_OneDimReader();
- CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e);
- CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, FX_INT32 hints, FX_INT32 &e);
+ CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e);
+ CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, int32_t hints, int32_t &e);
protected:
- CFX_Int32Array *FindStartGuardPattern(CBC_CommonBitArray *row, FX_INT32 &e);
- virtual FX_BOOL CheckChecksum(CFX_ByteString &s, FX_INT32 &e);
- CFX_Int32Array *FindGuardPattern(CBC_CommonBitArray *row, FX_INT32 rowOffset, FX_BOOL whiteFirst, CFX_Int32Array *pattern, FX_INT32 &e);
- FX_INT32 DecodeDigit(CBC_CommonBitArray *row, CFX_Int32Array *counters, FX_INT32 rowOffset, const FX_INT32* patterns, FX_INT32 patternLength, FX_INT32 &e);
- virtual FX_INT32 DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultResult, FX_INT32 &e)
+ CFX_Int32Array *FindStartGuardPattern(CBC_CommonBitArray *row, int32_t &e);
+ virtual FX_BOOL CheckChecksum(CFX_ByteString &s, int32_t &e);
+ CFX_Int32Array *FindGuardPattern(CBC_CommonBitArray *row, int32_t rowOffset, FX_BOOL whiteFirst, CFX_Int32Array *pattern, int32_t &e);
+ int32_t DecodeDigit(CBC_CommonBitArray *row, CFX_Int32Array *counters, int32_t rowOffset, const int32_t* patterns, int32_t patternLength, int32_t &e);
+ virtual int32_t DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultResult, int32_t &e)
{
return 0;
}
- virtual CFX_Int32Array *DecodeEnd(CBC_CommonBitArray *row, FX_INT32 endStart, FX_INT32 &e);
+ virtual CFX_Int32Array *DecodeEnd(CBC_CommonBitArray *row, int32_t endStart, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp index 25f3fa5f6c..a1554a8047 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp +++ b/xfa/src/fxbarcode/oned/BC_OneDimWriter.cpp @@ -50,11 +50,11 @@ void CBC_OneDimWriter::SetPrintChecksum(FX_BOOL checksum) {
m_bPrintChecksum = checksum;
}
-void CBC_OneDimWriter::SetDataLength(FX_INT32 length)
+void CBC_OneDimWriter::SetDataLength(int32_t length)
{
m_iDataLenth = length;
}
-void CBC_OneDimWriter::SetCalcChecksum(FX_INT32 state)
+void CBC_OneDimWriter::SetCalcChecksum(int32_t state)
{
m_bCalcChecksum = state;
}
@@ -70,7 +70,7 @@ void CBC_OneDimWriter::SetFontSize(FX_FLOAT size) {
m_fFontSize = size;
}
-void CBC_OneDimWriter::SetFontStyle(FX_INT32 style)
+void CBC_OneDimWriter::SetFontStyle(int32_t style)
{
m_iFontStyle = style;
}
@@ -85,10 +85,10 @@ FX_WCHAR CBC_OneDimWriter::Upper(FX_WCHAR ch) }
return ch;
}
-FX_BYTE* CBC_OneDimWriter::Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t* CBC_OneDimWriter::Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
- FX_BYTE *ret = NULL;
+ uint8_t *ret = NULL;
outHeight = 1;
if (m_Width >= 20) {
ret = Encode(contents, outWidth, e);
@@ -98,23 +98,23 @@ FX_BYTE* CBC_OneDimWriter::Encode(const CFX_ByteString &contents, BCFORMAT forma BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OneDimWriter::Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t *CBC_OneDimWriter::Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_INT32 CBC_OneDimWriter::AppendPattern(FX_BYTE* target, FX_INT32 pos, const FX_INT32* pattern , FX_INT32 patternLength, FX_INT32 startColor, FX_INT32 &e)
+int32_t CBC_OneDimWriter::AppendPattern(uint8_t* target, int32_t pos, const int32_t* pattern , int32_t patternLength, int32_t startColor, int32_t &e)
{
if (startColor != 0 && startColor != 1) {
e = BCExceptionValueMustBeEither0or1;
return 0;
}
- FX_BYTE color = (FX_BYTE) startColor;
- FX_INT32 numAdded = 0;
- for (FX_INT32 i = 0; i < patternLength; i++) {
- for (FX_INT32 j = 0; j < pattern[i]; j++) {
+ uint8_t color = (uint8_t) startColor;
+ int32_t numAdded = 0;
+ for (int32_t i = 0; i < patternLength; i++) {
+ for (int32_t j = 0; j < pattern[i]; j++) {
target[pos] = color;
pos += 1;
numAdded += 1;
@@ -123,20 +123,20 @@ FX_INT32 CBC_OneDimWriter::AppendPattern(FX_BYTE* target, FX_INT32 pos, const FX }
return numAdded;
}
-void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString &text, FXTEXT_CHARPOS *charPos, CFX_Font *cFont, FX_FLOAT geWidth, FX_INT32 fontSize, FX_FLOAT &charsLen)
+void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString &text, FXTEXT_CHARPOS *charPos, CFX_Font *cFont, FX_FLOAT geWidth, int32_t fontSize, FX_FLOAT &charsLen)
{
#ifdef FXFM_ENCODING_NONE
IFX_FontEncodingEx* encoding = FX_CreateFontEncodingEx(cFont);
#else
IFX_FontEncoding * encoding = FXGE_CreateUnicodeEncoding(cFont);
#endif
- FX_INT32 length = text.GetLength();
+ int32_t length = text.GetLength();
FX_DWORD *pCharCode = FX_Alloc(FX_DWORD, text.GetLength());
FX_FLOAT charWidth = 0;
- for (FX_INT32 j = 0; j < text.GetLength(); j++) {
+ for (int32_t j = 0; j < text.GetLength(); j++) {
pCharCode[j] = encoding->CharCodeFromUnicode(text[j]);
- FX_INT32 glyp_code = encoding->GlyphFromCharCode(pCharCode[j]);
- FX_INT32 glyp_value = cFont->GetGlyphWidth(glyp_code);
+ int32_t glyp_code = encoding->GlyphFromCharCode(pCharCode[j]);
+ int32_t glyp_value = cFont->GetGlyphWidth(glyp_code);
FX_FLOAT temp = (FX_FLOAT)((glyp_value) * fontSize / 1000.0);
charWidth += temp;
}
@@ -157,7 +157,7 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString &text, FXTEXT_CHARPOS * charPos[0].m_ExtGID = charPos[0].m_GlyphIndex;
#endif
penX += (FX_FLOAT)(charPos[0].m_FontCharWidth) * (FX_FLOAT)fontSize / 1000.0f;
- for (FX_INT32 i = 1; i < length; i++) {
+ for (int32_t i = 1; i < length; i++) {
charPos[i].m_OriginX = penX + left;
charPos[i].m_OriginY = penY + top;
charPos[i].m_GlyphIndex = encoding->GlyphFromCharCode(pCharCode[i]);
@@ -171,10 +171,10 @@ void CBC_OneDimWriter::CalcTextInfo(const CFX_ByteString &text, FXTEXT_CHARPOS * delete encoding;
encoding = NULL;
}
-void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice *device, const CFX_Matrix* matrix, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, FX_INT32 barWidth)
+void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice *device, const CFX_Matrix* matrix, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, int32_t barWidth)
{
- FX_INT32 iFontSize = (FX_INT32)fabs(m_fFontSize);
- FX_INT32 iTextHeight = iFontSize + 1;
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
CFX_FloatRect rect((FX_FLOAT)locX, (FX_FLOAT)locY, (FX_FLOAT)(locX + geWidth), (FX_FLOAT)(locY + iTextHeight));
if (geWidth != m_Width) {
rect.right -= 1;
@@ -194,10 +194,10 @@ void CBC_OneDimWriter::ShowDeviceChars(CFX_RenderDevice *device, const CFX_Matri (CFX_AffineMatrix *) &affine_matrix,
m_fontColor, FXTEXT_CLEARTYPE);
}
-void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap *pOutBitmap, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, FX_INT32 barWidth)
+void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap *pOutBitmap, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, int32_t barWidth)
{
- FX_INT32 iFontSize = (FX_INT32)fabs(m_fFontSize);
- FX_INT32 iTextHeight = iFontSize + 1;
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
CFX_FxgeDevice ge;
ge.Create((int)geWidth, iTextHeight , m_colorSpace);
FX_RECT geRect(0, 0, (int)geWidth, iTextHeight);
@@ -214,7 +214,7 @@ void CBC_OneDimWriter::ShowBitmapChars(CFX_DIBitmap *pOutBitmap, const CFX_ByteS geBitmap.Attach(pOutBitmap);
geBitmap.SetDIBits(ge.GetBitmap(), (int)locX, (int)locY);
}
-void CBC_OneDimWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice *device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e)
+void CBC_OneDimWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice *device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e)
{
if (device == NULL && pOutBitmap == NULL) {
e = BCExceptionIllegalArgument;
@@ -225,7 +225,7 @@ void CBC_OneDimWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX return;
}
CFX_ByteString str = FX_UTF8Encode(contents);
- FX_INT32 iLen = str.GetLength();
+ int32_t iLen = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
if (!pCharPos) {
return;
@@ -240,17 +240,17 @@ void CBC_OneDimWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX m_locTextLoc == BC_TEXT_LOC_BELOW ) {
geWidth = (FX_FLOAT)barWidth;
}
- FX_INT32 iFontSize = (FX_INT32)fabs(m_fFontSize);
- FX_INT32 iTextHeight = iFontSize + 1;
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
CalcTextInfo(str, pCharPos, m_pFont, geWidth, iFontSize, charsLen);
if (charsLen < 1) {
return;
}
- FX_INT32 locX = 0;
- FX_INT32 locY = 0;
+ int32_t locX = 0;
+ int32_t locY = 0;
switch (m_locTextLoc) {
case BC_TEXT_LOC_ABOVEEMBED:
- locX = (FX_INT32)(barWidth - charsLen) / 2;
+ locX = (int32_t)(barWidth - charsLen) / 2;
locY = 0;
geWidth = charsLen;
break;
@@ -260,7 +260,7 @@ void CBC_OneDimWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX geWidth = (FX_FLOAT)barWidth;
break;
case BC_TEXT_LOC_BELOWEMBED:
- locX = (FX_INT32)(barWidth - charsLen) / 2;
+ locX = (int32_t)(barWidth - charsLen) / 2;
locY = m_Height - iTextHeight;
geWidth = charsLen;
break;
@@ -278,7 +278,7 @@ void CBC_OneDimWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX }
FX_Free(pCharPos);
}
-void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_WSTR contents, FX_INT32 &e)
+void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_WSTR contents, int32_t &e)
{
if (m_output == NULL) {
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -289,14 +289,14 @@ void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_WSTR con e = BCExceptionFailToCreateBitmap;
return;
}
- for (FX_INT32 x = 0; x < m_output->GetWidth(); x++) {
- for (FX_INT32 y = 0; y < m_output->GetHeight(); y++) {
+ for (int32_t x = 0; x < m_output->GetWidth(); x++) {
+ for (int32_t y = 0; y < m_output->GetHeight(); y++) {
if (m_output->Get(x, y)) {
pOutBitmap->SetPixel(x, y, m_barColor);
}
}
}
- FX_INT32 i = 0;
+ int32_t i = 0;
for (; i < contents.GetLength(); i++)
if (contents.GetAt(i) != ' ') {
break;
@@ -311,7 +311,7 @@ void CBC_OneDimWriter::RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_WSTR con }
pOutBitmap = pStretchBitmap;
}
-void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_WSTR contents, FX_INT32 &e)
+void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_WSTR contents, int32_t &e)
{
if (m_output == NULL) {
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -322,8 +322,8 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Ma device->DrawPath(&path, matrix, &stateData, m_backgroundColor, m_backgroundColor, FXFILL_ALTERNATE);
CFX_Matrix matri(m_outputHScale, 0.0, 0.0, (FX_FLOAT)m_Height, 0.0, 0.0);
matri.Concat(*matrix);
- for (FX_INT32 x = 0; x < m_output->GetWidth(); x++) {
- for (FX_INT32 y = 0; y < m_output->GetHeight(); y++) {
+ for (int32_t x = 0; x < m_output->GetWidth(); x++) {
+ for (int32_t y = 0; y < m_output->GetHeight(); y++) {
CFX_PathData rect;
rect.AppendRect((FX_FLOAT)x, (FX_FLOAT)y, (FX_FLOAT)(x + 1), (FX_FLOAT)(y + 1));
CFX_GraphStateData stateData;
@@ -332,7 +332,7 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Ma }
}
}
- FX_INT32 i = 0;
+ int32_t i = 0;
for (; i < contents.GetLength(); i++)
if (contents.GetAt(i) != ' ') {
break;
@@ -342,7 +342,7 @@ void CBC_OneDimWriter::RenderDeviceResult(CFX_RenderDevice* device, const CFX_Ma BC_EXCEPTION_CHECK_ReturnVoid(e);
}
}
-void CBC_OneDimWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e)
+void CBC_OneDimWriter::RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e)
{
if (codeLength < 1) {
BC_EXCEPTION_CHECK_ReturnVoid(e);
@@ -350,9 +350,9 @@ void CBC_OneDimWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 co if (m_ModuleHeight < 20.0) {
m_ModuleHeight = 20;
}
- FX_INT32 codeOldLength = codeLength;
- FX_INT32 leftPadding = 0;
- FX_INT32 rightPadding = 0;
+ int32_t codeOldLength = codeLength;
+ int32_t leftPadding = 0;
+ int32_t rightPadding = 0;
if (m_bLeftPadding) {
leftPadding = 7;
}
@@ -377,9 +377,9 @@ void CBC_OneDimWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 co }
m_multiple = 1;
if (!isDevice) {
- m_multiple = (FX_INT32)ceil(m_outputHScale * dataLengthScale);
+ m_multiple = (int32_t)ceil(m_outputHScale * dataLengthScale);
}
- FX_INT32 outputHeight = 1;
+ int32_t outputHeight = 1;
if (!isDevice) {
if (m_Height == 0) {
outputHeight = FX_MAX(20, m_ModuleHeight);
@@ -387,9 +387,9 @@ void CBC_OneDimWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 co outputHeight = m_Height;
}
}
- FX_INT32 outputWidth = codeLength;
+ int32_t outputWidth = codeLength;
if (!isDevice) {
- outputWidth = (FX_INT32)(codeLength * m_multiple / dataLengthScale);
+ outputWidth = (int32_t)(codeLength * m_multiple / dataLengthScale);
}
m_barWidth = m_Width;
if (!isDevice) {
@@ -397,8 +397,8 @@ void CBC_OneDimWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 co }
m_output = FX_NEW CBC_CommonBitMatrix;
m_output->Init(outputWidth, outputHeight);
- FX_INT32 outputX = leftPadding * m_multiple;
- for (FX_INT32 inputX = 0; inputX < codeOldLength; inputX++) {
+ int32_t outputX = leftPadding * m_multiple;
+ for (int32_t inputX = 0; inputX < codeOldLength; inputX++) {
if (code[inputX] == 1) {
if (outputX >= outputWidth ) {
break;
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimWriter.h b/xfa/src/fxbarcode/oned/BC_OneDimWriter.h index cd5d937aca..aeb19e0081 100644 --- a/xfa/src/fxbarcode/oned/BC_OneDimWriter.h +++ b/xfa/src/fxbarcode/oned/BC_OneDimWriter.h @@ -14,17 +14,17 @@ class CBC_OneDimWriter : public CBC_Writer public:
CBC_OneDimWriter();
virtual ~CBC_OneDimWriter();
- FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
- virtual FX_BYTE *Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e)
+ uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
+ virtual uint8_t *Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e)
{
return NULL;
};
- virtual void RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e);
- virtual void RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_WSTR contents, FX_INT32 &e);
- virtual void RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_WSTR contents, FX_INT32 &e);
+ virtual void RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e);
+ virtual void RenderBitmapResult(CFX_DIBitmap *&pOutBitmap, FX_WSTR contents, int32_t &e);
+ virtual void RenderDeviceResult(CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_WSTR contents, int32_t &e);
virtual FX_BOOL CheckContentValidity(FX_WSTR contents)
{
return TRUE;
@@ -38,33 +38,33 @@ public: return CFX_WideString();
}
virtual void SetPrintChecksum(FX_BOOL checksum);
- virtual void SetDataLength(FX_INT32 length);
- virtual void SetCalcChecksum(FX_INT32 state);
+ virtual void SetDataLength(int32_t length);
+ virtual void SetCalcChecksum(int32_t state);
virtual void SetFontSize(FX_FLOAT size);
- virtual void SetFontStyle(FX_INT32 style);
+ virtual void SetFontStyle(int32_t style);
virtual void SetFontColor(FX_ARGB color);
virtual FX_BOOL SetFont(CFX_Font * cFont);
protected:
FX_BOOL m_bPrintChecksum;
- FX_INT32 m_iDataLenth;
+ int32_t m_iDataLenth;
FX_BOOL m_bCalcChecksum;
CFX_Font* m_pFont;
FX_FLOAT m_fFontSize;
- FX_INT32 m_iFontStyle;
+ int32_t m_iFontStyle;
FX_DWORD m_fontColor;
BC_TEXT_LOC m_locTextLoc;
- FX_INT32 m_iContentLen;
+ int32_t m_iContentLen;
FX_BOOL m_bLeftPadding;
FX_BOOL m_bRightPadding;
CBC_CommonBitMatrix* m_output;
- FX_INT32 m_barWidth;
- FX_INT32 m_multiple;
+ int32_t m_barWidth;
+ int32_t m_multiple;
FX_FLOAT m_outputHScale;
- void CalcTextInfo(const CFX_ByteString &text, FXTEXT_CHARPOS *charPos, CFX_Font *cFont, FX_FLOAT geWidth, FX_INT32 fontSize, FX_FLOAT &charsLen);
- virtual void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice *device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e);
- virtual void ShowBitmapChars(CFX_DIBitmap *pOutBitmap, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, FX_INT32 barWidth);
- virtual void ShowDeviceChars(CFX_RenderDevice *device, const CFX_Matrix* matrix, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, FX_INT32 barWidth);
- FX_INT32 AppendPattern(FX_BYTE* target, FX_INT32 pos, const FX_INT32* pattern, FX_INT32 patternLength, FX_INT32 startColor, FX_INT32 &e);
+ void CalcTextInfo(const CFX_ByteString &text, FXTEXT_CHARPOS *charPos, CFX_Font *cFont, FX_FLOAT geWidth, int32_t fontSize, FX_FLOAT &charsLen);
+ virtual void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice *device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e);
+ virtual void ShowBitmapChars(CFX_DIBitmap *pOutBitmap, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, int32_t barWidth);
+ virtual void ShowDeviceChars(CFX_RenderDevice *device, const CFX_Matrix* matrix, const CFX_ByteString str, FX_FLOAT geWidth, FXTEXT_CHARPOS* pCharPos, FX_FLOAT locX, FX_FLOAT locY, int32_t barWidth);
+ int32_t AppendPattern(uint8_t* target, int32_t pos, const int32_t* pattern, int32_t patternLength, int32_t startColor, int32_t &e);
FX_WCHAR Upper(FX_WCHAR ch);
};
#endif
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];
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.h b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.h index 1d03491841..18aab8ba8d 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.h +++ b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.h @@ -14,16 +14,16 @@ class CBC_OnedCodaBarReader : public CBC_OneDReader public:
CBC_OnedCodaBarReader();
virtual ~CBC_OnedCodaBarReader();
- CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e);
- CFX_Int32Array *FindAsteriskPattern(CBC_CommonBitArray *row, FX_INT32 &e);
+ CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e);
+ CFX_Int32Array *FindAsteriskPattern(CBC_CommonBitArray *row, int32_t &e);
FX_BOOL ArrayContains(const FX_CHAR array[], FX_CHAR key);
FX_CHAR ToNarrowWidePattern(CFX_Int32Array *counter);
static FX_LPCSTR ALPHABET_STRING;
- const static FX_INT32 CHARACTER_ENCODINGS[22];
+ const static int32_t CHARACTER_ENCODINGS[22];
- const static FX_INT32 minCharacterLength;
+ const static int32_t minCharacterLength;
const static FX_CHAR STARTEND_ENCODING[8];
};
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp index 059d2d7df5..0049a54f7c 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp @@ -42,7 +42,7 @@ CBC_OnedCodaBarWriter::~CBC_OnedCodaBarWriter() }
FX_BOOL CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start)
{
- for (FX_INT32 i = 0; i < sizeof(START_END_CHARS) / sizeof(FX_CHAR); i++) {
+ for (int32_t i = 0; i < sizeof(START_END_CHARS) / sizeof(FX_CHAR); i++) {
if (START_END_CHARS[i] == start) {
m_chStart = start;
return TRUE;
@@ -52,7 +52,7 @@ FX_BOOL CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start) }
FX_BOOL CBC_OnedCodaBarWriter::SetEndChar(FX_CHAR end)
{
- for (FX_INT32 i = 0; i < sizeof(START_END_CHARS) / sizeof(FX_CHAR); i++) {
+ for (int32_t i = 0; i < sizeof(START_END_CHARS) / sizeof(FX_CHAR); i++) {
if (START_END_CHARS[i] == end) {
m_chEnd = end;
return TRUE;
@@ -60,7 +60,7 @@ FX_BOOL CBC_OnedCodaBarWriter::SetEndChar(FX_CHAR end) }
return FALSE;
}
-void CBC_OnedCodaBarWriter::SetDataLength(FX_INT32 length)
+void CBC_OnedCodaBarWriter::SetDataLength(int32_t length)
{
m_iDataLenth = length + 2;
}
@@ -72,7 +72,7 @@ FX_BOOL CBC_OnedCodaBarWriter::SetTextLocation(BC_TEXT_LOC location) m_locTextLoc = location;
return TRUE;
}
-FX_BOOL CBC_OnedCodaBarWriter::SetWideNarrowRatio(FX_INT32 ratio)
+FX_BOOL CBC_OnedCodaBarWriter::SetWideNarrowRatio(int32_t ratio)
{
if(ratio < 2 || ratio > 3) {
return FALSE;
@@ -83,19 +83,19 @@ FX_BOOL CBC_OnedCodaBarWriter::SetWideNarrowRatio(FX_INT32 ratio) FX_BOOL CBC_OnedCodaBarWriter::FindChar(FX_WCHAR ch, FX_BOOL isContent)
{
if(isContent) {
- for(FX_INT32 i = 0 ; i < sizeof(CONTENT_CHARS) / sizeof(FX_CHAR) ; i++) {
+ for(int32_t i = 0 ; i < sizeof(CONTENT_CHARS) / sizeof(FX_CHAR) ; i++) {
if(ch == (FX_WCHAR)CONTENT_CHARS[i]) {
return TRUE;
}
}
- for(FX_INT32 j = 0 ; j < sizeof(START_END_CHARS) / sizeof(FX_CHAR) ; j++) {
+ for(int32_t j = 0 ; j < sizeof(START_END_CHARS) / sizeof(FX_CHAR) ; j++) {
if(ch == (FX_WCHAR)START_END_CHARS[j]) {
return TRUE;
}
}
return FALSE;
} else {
- for(FX_INT32 i = 0 ; i < sizeof(CONTENT_CHARS) / sizeof(FX_CHAR) ; i++) {
+ for(int32_t i = 0 ; i < sizeof(CONTENT_CHARS) / sizeof(FX_CHAR) ; i++) {
if(ch == (FX_WCHAR)CONTENT_CHARS[i]) {
return TRUE;
}
@@ -106,7 +106,7 @@ FX_BOOL CBC_OnedCodaBarWriter::FindChar(FX_WCHAR ch, FX_BOOL isContent) FX_BOOL CBC_OnedCodaBarWriter::CheckContentValidity(FX_WSTR contents)
{
FX_WCHAR ch;
- FX_INT32 index = 0;
+ int32_t index = 0;
for (index = 0; index < contents.GetLength(); index++) {
ch = contents.GetAt(index);
if (FindChar(ch, FALSE)) {
@@ -121,7 +121,7 @@ CFX_WideString CBC_OnedCodaBarWriter::FilterContents(FX_WSTR contents) {
CFX_WideString filtercontents;
FX_WCHAR ch;
- for (FX_INT32 index = 0; index < contents.GetLength(); index ++) {
+ for (int32_t index = 0; index < contents.GetLength(); index ++) {
ch = contents.GetAt(index);
if(ch > 175) {
index++;
@@ -135,31 +135,31 @@ CFX_WideString CBC_OnedCodaBarWriter::FilterContents(FX_WSTR contents) }
return filtercontents;
}
-FX_BYTE *CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t *CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0 , e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0 , e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t *CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
if(format != BCFORMAT_CODABAR) {
e = BCExceptionOnlyEncodeCODEBAR;
return NULL;
}
- FX_BYTE *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ uint8_t *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e)
+uint8_t* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e)
{
CBC_OnedCodaBarReader CodaBarR;
CFX_ByteString data = m_chStart + contents + m_chEnd;
m_iContentLen = data.GetLength();
- FX_BYTE *result = FX_Alloc(FX_BYTE, m_iWideNarrRatio * 7 * data.GetLength());
+ uint8_t *result = FX_Alloc(uint8_t, m_iWideNarrRatio * 7 * data.GetLength());
FX_CHAR ch;
- FX_INT32 position = 0;
- for (FX_INT32 index = 0; index < data.GetLength(); index++) {
+ int32_t position = 0;
+ for (int32_t index = 0; index < data.GetLength(); index++) {
ch = data.GetAt(index);
if (((ch >= 'a') && (ch <= 'z'))) {
ch = ch - 32;
@@ -180,17 +180,17 @@ FX_BYTE* CBC_OnedCodaBarWriter::Encode(const CFX_ByteString &contents, FX_INT32 default:
break;
}
- FX_INT32 code = 0;
- FX_INT32 len = (FX_INT32)strlen(CodaBarR.ALPHABET_STRING);
- for (FX_INT32 i = 0; i < len; i++) {
+ int32_t code = 0;
+ int32_t len = (int32_t)strlen(CodaBarR.ALPHABET_STRING);
+ for (int32_t i = 0; i < len; i++) {
if (ch == CodaBarR.ALPHABET_STRING[i]) {
code = CodaBarR.CHARACTER_ENCODINGS[i];
break;
}
}
- FX_BYTE color = 1;
- FX_INT32 counter = 0;
- FX_INT32 bit = 0;
+ uint8_t color = 1;
+ int32_t counter = 0;
+ int32_t bit = 0;
while (bit < 7) {
result[position] = color;
position++;
@@ -216,7 +216,7 @@ CFX_WideString CBC_OnedCodaBarWriter::encodedContents(FX_WSTR contents) CFX_WideString strEnd(m_chEnd);
return strStart + contents + strEnd;
}
-void CBC_OnedCodaBarWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e)
+void CBC_OnedCodaBarWriter::RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e)
{
CBC_OneDimWriter::RenderResult(encodedContents(contents), code, codeLength, isDevice, e);
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.h b/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.h index b81839ca4a..c5c54b849f 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.h +++ b/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.h @@ -14,25 +14,25 @@ class CBC_OnedCodaBarWriter : public CBC_OneDimWriter public:
CBC_OnedCodaBarWriter();
virtual ~CBC_OnedCodaBarWriter();
- FX_BYTE* Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e);
- FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
+ uint8_t* Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e);
+ uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
CFX_WideString encodedContents(FX_WSTR contents);
FX_BOOL CheckContentValidity(FX_WSTR contents);
CFX_WideString FilterContents(FX_WSTR contents);
FX_BOOL SetStartChar(FX_CHAR start);
FX_BOOL SetEndChar(FX_CHAR end);
- void SetDataLength(FX_INT32 length);
+ void SetDataLength(int32_t length);
FX_BOOL SetTextLocation(BC_TEXT_LOC location);
- FX_BOOL SetWideNarrowRatio(FX_INT32 ratio);
+ FX_BOOL SetWideNarrowRatio(int32_t ratio);
FX_BOOL FindChar(FX_WCHAR ch, FX_BOOL isContent);
private:
- void RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e);
+ void RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e);
const static FX_CHAR START_END_CHARS[];
const static FX_CHAR CONTENT_CHARS[];
FX_CHAR m_chStart;
FX_CHAR m_chEnd;
- FX_INT32 m_iWideNarrRatio;
+ int32_t m_iWideNarrRatio;
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp index 9dd9f629cf..d1f453345b 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp @@ -25,7 +25,7 @@ #include "../common/BC_CommonBitArray.h"
#include "BC_OneDReader.h"
#include "BC_OnedCode128Reader.h"
-const FX_INT32 CBC_OnedCode128Reader::CODE_PATTERNS[107][7] = {
+const int32_t CBC_OnedCode128Reader::CODE_PATTERNS[107][7] = {
{2, 1, 2, 2, 2, 2, 0},
{2, 2, 2, 1, 2, 2, 0},
{2, 2, 2, 2, 2, 1, 0},
@@ -134,53 +134,53 @@ const FX_INT32 CBC_OnedCode128Reader::CODE_PATTERNS[107][7] = { {2, 1, 1, 2, 3, 2, 0},
{2, 3, 3, 1, 1, 1, 2}
};
-const FX_INT32 CBC_OnedCode128Reader::MAX_AVG_VARIANCE = (FX_INT32) (256 * 0.25f);
-const FX_INT32 CBC_OnedCode128Reader::MAX_INDIVIDUAL_VARIANCE = (FX_INT32) (256 * 0.7f);
-const FX_INT32 CBC_OnedCode128Reader::CODE_SHIFT = 98;
-const FX_INT32 CBC_OnedCode128Reader::CODE_CODE_C = 99;
-const FX_INT32 CBC_OnedCode128Reader::CODE_CODE_B = 100;
-const FX_INT32 CBC_OnedCode128Reader::CODE_CODE_A = 101;
-const FX_INT32 CBC_OnedCode128Reader::CODE_FNC_1 = 102;
-const FX_INT32 CBC_OnedCode128Reader::CODE_FNC_2 = 97;
-const FX_INT32 CBC_OnedCode128Reader::CODE_FNC_3 = 96;
-const FX_INT32 CBC_OnedCode128Reader::CODE_FNC_4_A = 101;
-const FX_INT32 CBC_OnedCode128Reader::CODE_FNC_4_B = 100;
-const FX_INT32 CBC_OnedCode128Reader::CODE_START_A = 103;
-const FX_INT32 CBC_OnedCode128Reader::CODE_START_B = 104;
-const FX_INT32 CBC_OnedCode128Reader::CODE_START_C = 105;
-const FX_INT32 CBC_OnedCode128Reader::CODE_STOP = 106;
+const int32_t CBC_OnedCode128Reader::MAX_AVG_VARIANCE = (int32_t) (256 * 0.25f);
+const int32_t CBC_OnedCode128Reader::MAX_INDIVIDUAL_VARIANCE = (int32_t) (256 * 0.7f);
+const int32_t CBC_OnedCode128Reader::CODE_SHIFT = 98;
+const int32_t CBC_OnedCode128Reader::CODE_CODE_C = 99;
+const int32_t CBC_OnedCode128Reader::CODE_CODE_B = 100;
+const int32_t CBC_OnedCode128Reader::CODE_CODE_A = 101;
+const int32_t CBC_OnedCode128Reader::CODE_FNC_1 = 102;
+const int32_t CBC_OnedCode128Reader::CODE_FNC_2 = 97;
+const int32_t CBC_OnedCode128Reader::CODE_FNC_3 = 96;
+const int32_t CBC_OnedCode128Reader::CODE_FNC_4_A = 101;
+const int32_t CBC_OnedCode128Reader::CODE_FNC_4_B = 100;
+const int32_t CBC_OnedCode128Reader::CODE_START_A = 103;
+const int32_t CBC_OnedCode128Reader::CODE_START_B = 104;
+const int32_t CBC_OnedCode128Reader::CODE_START_C = 105;
+const int32_t CBC_OnedCode128Reader::CODE_STOP = 106;
CBC_OnedCode128Reader::CBC_OnedCode128Reader()
{
}
CBC_OnedCode128Reader::~CBC_OnedCode128Reader()
{
}
-CFX_Int32Array *CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray *row, FX_INT32 &e)
+CFX_Int32Array *CBC_OnedCode128Reader::FindStartPattern(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(6);
- 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]++;
} else {
if (counterPosition == patternLength - 1) {
- FX_INT32 bestVariance = MAX_AVG_VARIANCE;
- FX_INT32 bestMatch = -1;
- for (FX_INT32 startCode = CODE_START_A; startCode <= CODE_START_C; startCode++) {
- FX_INT32 variance = PatternMatchVariance(&counters, &CODE_PATTERNS[startCode][0], MAX_INDIVIDUAL_VARIANCE);
+ int32_t bestVariance = MAX_AVG_VARIANCE;
+ int32_t bestMatch = -1;
+ for (int32_t startCode = CODE_START_A; startCode <= CODE_START_C; startCode++) {
+ int32_t variance = PatternMatchVariance(&counters, &CODE_PATTERNS[startCode][0], MAX_INDIVIDUAL_VARIANCE);
if (variance < bestVariance) {
bestVariance = variance;
bestMatch = startCode;
@@ -199,7 +199,7 @@ CFX_Int32Array *CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray *row, }
}
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;
@@ -215,14 +215,14 @@ CFX_Int32Array *CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray *row, e = BCExceptionNotFound;
return NULL;
}
-FX_INT32 CBC_OnedCode128Reader::DecodeCode(CBC_CommonBitArray *row, CFX_Int32Array *counters, FX_INT32 rowOffset, FX_INT32 &e)
+int32_t CBC_OnedCode128Reader::DecodeCode(CBC_CommonBitArray *row, CFX_Int32Array *counters, int32_t rowOffset, int32_t &e)
{
RecordPattern(row, rowOffset, counters, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
- FX_INT32 bestVariance = MAX_AVG_VARIANCE;
- FX_INT32 bestMatch = -1;
- for (FX_INT32 d = 0; d < 107; d++) {
- FX_INT32 variance = PatternMatchVariance(counters, &CODE_PATTERNS[d][0], MAX_INDIVIDUAL_VARIANCE);
+ int32_t bestVariance = MAX_AVG_VARIANCE;
+ int32_t bestMatch = -1;
+ for (int32_t d = 0; d < 107; d++) {
+ int32_t variance = PatternMatchVariance(counters, &CODE_PATTERNS[d][0], MAX_INDIVIDUAL_VARIANCE);
if (variance < bestVariance) {
bestVariance = variance;
bestMatch = d;
@@ -236,12 +236,12 @@ FX_INT32 CBC_OnedCode128Reader::DecodeCode(CBC_CommonBitArray *row, CFX_Int32Arr }
return 0;
}
-CFX_ByteString CBC_OnedCode128Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OnedCode128Reader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e)
{
CFX_Int32Array *startPatternInfo = FindStartPattern(row, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
- FX_INT32 startCode = (*startPatternInfo)[2];
- FX_INT32 codeSet;
+ int32_t startCode = (*startPatternInfo)[2];
+ int32_t codeSet;
switch (startCode) {
case 103:
codeSet = CODE_CODE_A;
@@ -264,8 +264,8 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi FX_BOOL done = FALSE;
FX_BOOL isNextShifted = FALSE;
CFX_ByteString result;
- FX_INT32 lastStart = (*startPatternInfo)[0];
- FX_INT32 nextStart = (*startPatternInfo)[1];
+ int32_t lastStart = (*startPatternInfo)[0];
+ int32_t nextStart = (*startPatternInfo)[1];
if(startPatternInfo != NULL) {
startPatternInfo->RemoveAll();
delete startPatternInfo;
@@ -273,10 +273,10 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi }
CFX_Int32Array counters;
counters.SetSize(6);
- FX_INT32 lastCode = 0;
- FX_INT32 code = 0;
- FX_INT32 checksumTotal = startCode;
- FX_INT32 multiplier = 0;
+ int32_t lastCode = 0;
+ int32_t code = 0;
+ int32_t checksumTotal = startCode;
+ int32_t multiplier = 0;
FX_BOOL lastCharacterWasPrintable = TRUE;
while (!done) {
FX_BOOL unshift = isNextShifted;
@@ -292,7 +292,7 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi checksumTotal += multiplier * code;
}
lastStart = nextStart;
- for (FX_INT32 i = 0; i < counters.GetSize(); i++) {
+ for (int32_t i = 0; i < counters.GetSize(); i++) {
nextStart += counters[i];
}
switch (code) {
@@ -399,7 +399,7 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi codeSet = codeSet == CODE_CODE_A ? CODE_CODE_B : CODE_CODE_A;
}
}
- FX_INT32 width = row->GetSize();
+ int32_t width = row->GetSize();
while (nextStart < width && row->Get(nextStart)) {
nextStart++;
}
@@ -414,7 +414,7 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBi e = BCExceptionChecksumException;
return "";
}
- FX_INT32 resultLength = result.GetLength();
+ int32_t resultLength = result.GetLength();
if (resultLength > 0 && lastCharacterWasPrintable) {
if (codeSet == CODE_CODE_C) {
result = result.Mid(0, result.GetLength() - 2);
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.h b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.h index 94e1a6388b..558b111c22 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.h +++ b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.h @@ -14,27 +14,27 @@ class CBC_OnedCode128Reader : public CBC_OneDReader public:
CBC_OnedCode128Reader();
virtual ~CBC_OnedCode128Reader();
- virtual CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e);
- const static FX_INT32 CODE_PATTERNS[107][7];
- const static FX_INT32 MAX_AVG_VARIANCE;
- const static FX_INT32 MAX_INDIVIDUAL_VARIANCE;
+ virtual CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e);
+ const static int32_t CODE_PATTERNS[107][7];
+ const static int32_t MAX_AVG_VARIANCE;
+ const static int32_t MAX_INDIVIDUAL_VARIANCE;
- const static FX_INT32 CODE_SHIFT;
- const static FX_INT32 CODE_CODE_C;
- const static FX_INT32 CODE_CODE_B;
- const static FX_INT32 CODE_CODE_A;
- const static FX_INT32 CODE_FNC_1;
- const static FX_INT32 CODE_FNC_2;
- const static FX_INT32 CODE_FNC_3;
- const static FX_INT32 CODE_FNC_4_A;
- const static FX_INT32 CODE_FNC_4_B ;
+ const static int32_t CODE_SHIFT;
+ const static int32_t CODE_CODE_C;
+ const static int32_t CODE_CODE_B;
+ const static int32_t CODE_CODE_A;
+ const static int32_t CODE_FNC_1;
+ const static int32_t CODE_FNC_2;
+ const static int32_t CODE_FNC_3;
+ const static int32_t CODE_FNC_4_A;
+ const static int32_t CODE_FNC_4_B ;
- const static FX_INT32 CODE_START_A;
- const static FX_INT32 CODE_START_B;
- const static FX_INT32 CODE_START_C;
- const static FX_INT32 CODE_STOP;
+ const static int32_t CODE_START_A;
+ const static int32_t CODE_START_B;
+ const static int32_t CODE_START_C;
+ const static int32_t CODE_STOP;
private:
- CFX_Int32Array *FindStartPattern(CBC_CommonBitArray *row, FX_INT32 &e);
- FX_INT32 DecodeCode(CBC_CommonBitArray *row, CFX_Int32Array *counters, FX_INT32 rowOffset, FX_INT32 &e);
+ CFX_Int32Array *FindStartPattern(CBC_CommonBitArray *row, int32_t &e);
+ int32_t DecodeCode(CBC_CommonBitArray *row, CFX_Int32Array *counters, int32_t rowOffset, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.cpp index 6dd3cbe8a5..5f7b32caa4 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.cpp @@ -27,11 +27,11 @@ #include "BC_OneDimWriter.h"
#include "BC_OnedCode128Reader.h"
#include "BC_OnedCode128Writer.h"
-const FX_INT32 CBC_OnedCode128Writer::CODE_CODE_B = 100;
-const FX_INT32 CBC_OnedCode128Writer::CODE_CODE_C = 99;
-const FX_INT32 CBC_OnedCode128Writer::CODE_START_B = 104;
-const FX_INT32 CBC_OnedCode128Writer::CODE_START_C = 105;
-const FX_INT32 CBC_OnedCode128Writer::CODE_STOP = 106;
+const int32_t CBC_OnedCode128Writer::CODE_CODE_B = 100;
+const int32_t CBC_OnedCode128Writer::CODE_CODE_C = 99;
+const int32_t CBC_OnedCode128Writer::CODE_START_B = 104;
+const int32_t CBC_OnedCode128Writer::CODE_START_C = 105;
+const int32_t CBC_OnedCode128Writer::CODE_STOP = 106;
CBC_OnedCode128Writer::CBC_OnedCode128Writer()
{
m_codeFormat = BC_CODE128_B;
@@ -50,11 +50,11 @@ BC_TYPE CBC_OnedCode128Writer::GetType() FX_BOOL CBC_OnedCode128Writer::CheckContentValidity(FX_WSTR contents)
{
FX_BOOL ret = TRUE;
- FX_INT32 position = 0;
- FX_INT32 patternIndex = -1;
+ int32_t position = 0;
+ int32_t patternIndex = -1;
if (m_codeFormat == BC_CODE128_B || m_codeFormat == BC_CODE128_C) {
while (position < contents.GetLength()) {
- patternIndex = (FX_INT32)contents.GetAt(position);
+ patternIndex = (int32_t)contents.GetAt(position);
if (patternIndex >= 32 && patternIndex <= 126 && patternIndex != 34) {
position++;
continue;
@@ -73,7 +73,7 @@ CFX_WideString CBC_OnedCode128Writer::FilterContents(FX_WSTR contents) {
CFX_WideString filterChineseChar;
FX_WCHAR ch;
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
ch = contents.GetAt(i);
if(ch > 175) {
i++;
@@ -83,7 +83,7 @@ CFX_WideString CBC_OnedCode128Writer::FilterContents(FX_WSTR contents) }
CFX_WideString filtercontents;
if (m_codeFormat == BC_CODE128_B) {
- for (FX_INT32 i = 0; i < filterChineseChar.GetLength(); i++) {
+ for (int32_t i = 0; i < filterChineseChar.GetLength(); i++) {
ch = filterChineseChar.GetAt(i);
if (ch >= 32 && ch <= 126) {
filtercontents += ch;
@@ -92,7 +92,7 @@ CFX_WideString CBC_OnedCode128Writer::FilterContents(FX_WSTR contents) }
}
} else if (m_codeFormat == BC_CODE128_C) {
- for (FX_INT32 i = 0; i < filterChineseChar.GetLength(); i++) {
+ for (int32_t i = 0; i < filterChineseChar.GetLength(); i++) {
ch = filterChineseChar.GetAt(i);
if (ch >= 32 && ch <= 106) {
filtercontents += ch;
@@ -113,41 +113,41 @@ FX_BOOL CBC_OnedCode128Writer::SetTextLocation(BC_TEXT_LOC location) m_locTextLoc = location;
return TRUE;
}
-FX_BYTE *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
if(format != BCFORMAT_CODE_128) {
e = BCExceptionOnlyEncodeCODE_128;
return NULL;
}
- FX_BYTE *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ uint8_t *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BOOL CBC_OnedCode128Writer::IsDigits(const CFX_ByteString &contents, FX_INT32 start, FX_INT32 length)
+FX_BOOL CBC_OnedCode128Writer::IsDigits(const CFX_ByteString &contents, int32_t start, int32_t length)
{
- FX_INT32 end = start + length;
- for (FX_INT32 i = start; i < end; i++) {
+ int32_t end = start + length;
+ for (int32_t i = start; i < end; i++) {
if (contents[i] < '0' || contents[i] > '9') {
return FALSE;
}
}
return TRUE;
}
-FX_BYTE *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e)
+uint8_t *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e)
{
- FX_INT32 length = contents.GetLength();
+ int32_t length = contents.GetLength();
if(contents.GetLength() < 1 || contents.GetLength() > 80) {
e = BCExceptionContentsLengthShouldBetween1and80;
return NULL;
}
CFX_PtrArray patterns;
- FX_INT32 checkSum = 0;
+ int32_t checkSum = 0;
if (m_codeFormat == BC_CODE128_B) {
checkSum = Encode128B(contents, patterns);
} else if (m_codeFormat == BC_CODE128_C) {
@@ -157,21 +157,21 @@ FX_BYTE *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, FX_INT32 return NULL;
}
checkSum %= 103;
- patterns.Add((FX_INT32*)CBC_OnedCode128Reader::CODE_PATTERNS[checkSum]);
- patterns.Add((FX_INT32*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_STOP]);
+ patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[checkSum]);
+ patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_STOP]);
m_iContentLen = contents.GetLength() + 3;
- FX_INT32 codeWidth = 0;
- for(FX_INT32 k = 0; k < patterns.GetSize(); k++) {
- FX_INT32 *pattern = (FX_INT32*)patterns[k];
- for(FX_INT32 j = 0; j < 7; j++) {
+ int32_t codeWidth = 0;
+ for(int32_t k = 0; k < patterns.GetSize(); k++) {
+ int32_t *pattern = (int32_t*)patterns[k];
+ for(int32_t j = 0; j < 7; j++) {
codeWidth += pattern[j];
}
}
outLength = codeWidth;
- FX_BYTE *result = FX_Alloc(FX_BYTE, outLength);
- FX_INT32 pos = 0;
- for(FX_INT32 j = 0; j < patterns.GetSize(); j++) {
- FX_INT32* pattern = (FX_INT32*)patterns[j];
+ uint8_t *result = FX_Alloc(uint8_t, outLength);
+ int32_t pos = 0;
+ for(int32_t j = 0; j < patterns.GetSize(); j++) {
+ int32_t* pattern = (int32_t*)patterns[j];
pos += AppendPattern(result, pos, pattern, 7, 1, e);
if (e != BCExceptionNO) {
FX_Free (result);
@@ -180,18 +180,18 @@ FX_BYTE *CBC_OnedCode128Writer::Encode(const CFX_ByteString &contents, FX_INT32 }
return result;
}
-FX_INT32 CBC_OnedCode128Writer::Encode128B(const CFX_ByteString &contents, CFX_PtrArray &patterns)
+int32_t CBC_OnedCode128Writer::Encode128B(const CFX_ByteString &contents, CFX_PtrArray &patterns)
{
- FX_INT32 checkSum = 0;
- FX_INT32 checkWeight = 1;
- FX_INT32 position = 0;
- patterns.Add((FX_INT32*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_START_B]);
+ int32_t checkSum = 0;
+ int32_t checkWeight = 1;
+ int32_t position = 0;
+ patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_START_B]);
checkSum += CODE_START_B * checkWeight;
while (position < contents.GetLength()) {
- FX_INT32 patternIndex = 0;
+ int32_t patternIndex = 0;
patternIndex = contents[position] - ' ';
position += 1;
- patterns.Add((FX_INT32*)CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]);
+ patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]);
checkSum += patternIndex * checkWeight;
if (position != 0) {
checkWeight++;
@@ -199,18 +199,18 @@ FX_INT32 CBC_OnedCode128Writer::Encode128B(const CFX_ByteString &contents, CFX_ }
return checkSum;
}
-FX_INT32 CBC_OnedCode128Writer::Encode128C(const CFX_ByteString &contents, CFX_PtrArray &patterns)
+int32_t CBC_OnedCode128Writer::Encode128C(const CFX_ByteString &contents, CFX_PtrArray &patterns)
{
- FX_INT32 checkSum = 0;
- FX_INT32 checkWeight = 1;
- FX_INT32 position = 0;
- patterns.Add((FX_INT32*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_START_C]);
+ int32_t checkSum = 0;
+ int32_t checkWeight = 1;
+ int32_t position = 0;
+ patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[CODE_START_C]);
checkSum += CODE_START_C * checkWeight;
while (position < contents.GetLength()) {
- FX_INT32 patternIndex = 0;
+ int32_t patternIndex = 0;
FX_CHAR ch = contents.GetAt(position);
if (ch < '0' || ch > '9') {
- patternIndex = (FX_INT32)ch;
+ patternIndex = (int32_t)ch;
position++;
} else {
patternIndex = FXSYS_atoi(contents.Mid(position, 2));
@@ -220,7 +220,7 @@ FX_INT32 CBC_OnedCode128Writer::Encode128C(const CFX_ByteString &contents, CFX_ position += 2;
}
}
- patterns.Add((FX_INT32*)CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]);
+ patterns.Add((int32_t*)CBC_OnedCode128Reader::CODE_PATTERNS[patternIndex]);
checkSum += patternIndex * checkWeight;
if (position != 0) {
checkWeight++;
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.h b/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.h index daa48eca51..f27e2e9f09 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.h +++ b/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.h @@ -14,24 +14,24 @@ public: CBC_OnedCode128Writer();
CBC_OnedCode128Writer(BC_TYPE type);
virtual ~CBC_OnedCode128Writer();
- FX_BYTE * Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
- FX_BYTE * Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE * Encode(const CFX_ByteString &contents, FX_INT32 &outLength , FX_INT32 &e);
+ uint8_t * Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
+ uint8_t * Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t * Encode(const CFX_ByteString &contents, int32_t &outLength , int32_t &e);
FX_BOOL CheckContentValidity(FX_WSTR contents);
CFX_WideString FilterContents(FX_WSTR contents);
FX_BOOL SetTextLocation(BC_TEXT_LOC location);
BC_TYPE GetType();
private:
- FX_BOOL IsDigits(const CFX_ByteString &contents, FX_INT32 start, FX_INT32 length);
- FX_INT32 Encode128B(const CFX_ByteString &contents, CFX_PtrArray &patterns);
- FX_INT32 Encode128C(const CFX_ByteString &contents, CFX_PtrArray &patterns);
+ FX_BOOL IsDigits(const CFX_ByteString &contents, int32_t start, int32_t length);
+ int32_t Encode128B(const CFX_ByteString &contents, CFX_PtrArray &patterns);
+ int32_t Encode128C(const CFX_ByteString &contents, CFX_PtrArray &patterns);
BC_TYPE m_codeFormat;
- const static FX_INT32 CODE_START_B;
- const static FX_INT32 CODE_START_C;
- const static FX_INT32 CODE_CODE_B;
- const static FX_INT32 CODE_CODE_C;
- const static FX_INT32 CODE_STOP;
+ const static int32_t CODE_START_B;
+ const static int32_t CODE_START_C;
+ const static int32_t CODE_CODE_B;
+ const static int32_t CODE_CODE_C;
+ const static int32_t CODE_STOP;
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp index b19343943b..e5e6392c17 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.cpp @@ -27,14 +27,14 @@ #include "BC_OnedCode39Reader.h"
FX_LPCSTR CBC_OnedCode39Reader::ALPHABET_STRING = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%";
FX_LPCSTR CBC_OnedCode39Reader::CHECKSUM_STRING = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%";
-const FX_INT32 CBC_OnedCode39Reader::CHARACTER_ENCODINGS[44] = {
+const int32_t CBC_OnedCode39Reader::CHARACTER_ENCODINGS[44] = {
0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064,
0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C,
0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016,
0x181, 0x0C1, 0x1C0, 0x091, 0x190, 0x0D0, 0x085, 0x184, 0x0C4, 0x094,
0x0A8, 0x0A2, 0x08A, 0x02A
};
-const FX_INT32 CBC_OnedCode39Reader::ASTERISK_ENCODING = 0x094;
+const int32_t CBC_OnedCode39Reader::ASTERISK_ENCODING = 0x094;
CBC_OnedCode39Reader::CBC_OnedCode39Reader(): m_extendedMode(FALSE), m_usingCheckDigit(FALSE)
{
}
@@ -51,16 +51,16 @@ CBC_OnedCode39Reader::CBC_OnedCode39Reader(FX_BOOL usingCheckDigit, FX_BOOL exte CBC_OnedCode39Reader::~CBC_OnedCode39Reader()
{
}
-CFX_ByteString CBC_OnedCode39Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OnedCode39Reader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e)
{
CFX_Int32Array *start = FindAsteriskPattern(row, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
- FX_INT32 nextStart = (*start)[1];
+ int32_t nextStart = (*start)[1];
if(start != NULL) {
delete start;
start = NULL;
}
- FX_INT32 end = row->GetSize();
+ int32_t end = row->GetSize();
while (nextStart < end && !row->Get(nextStart)) {
nextStart++;
}
@@ -68,11 +68,11 @@ CFX_ByteString CBC_OnedCode39Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBit CFX_Int32Array counters;
counters.SetSize(9);
FX_CHAR decodedChar;
- FX_INT32 lastStart;
+ int32_t lastStart;
do {
RecordPattern(row, nextStart, &counters, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
- FX_INT32 pattern = ToNarrowWidePattern(&counters);
+ int32_t pattern = ToNarrowWidePattern(&counters);
if (pattern < 0) {
e = BCExceptionNotFound;
return "";
@@ -81,7 +81,7 @@ CFX_ByteString CBC_OnedCode39Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBit BC_EXCEPTION_CHECK_ReturnValue(e, "");
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)) {
@@ -89,17 +89,17 @@ CFX_ByteString CBC_OnedCode39Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBit }
} while (decodedChar != '*');
result = result.Mid(0, result.GetLength() - 1);
- 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(m_usingCheckDigit) {
- FX_INT32 max = result.GetLength() - 1;
- FX_INT32 total = 0;
- FX_INT32 len = (FX_INT32)strlen(ALPHABET_STRING);
- for (FX_INT32 k = 0; k < max; k++) {
- for (FX_INT32 j = 0; j < len; j++)
+ int32_t max = result.GetLength() - 1;
+ int32_t total = 0;
+ int32_t len = (int32_t)strlen(ALPHABET_STRING);
+ for (int32_t k = 0; k < max; k++) {
+ for (int32_t j = 0; j < len; j++)
if (ALPHABET_STRING[j] == result[k]) {
total += j;
}
@@ -122,23 +122,23 @@ CFX_ByteString CBC_OnedCode39Reader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBit return result;
}
}
-CFX_Int32Array *CBC_OnedCode39Reader::FindAsteriskPattern(CBC_CommonBitArray *row, FX_INT32 &e)
+CFX_Int32Array *CBC_OnedCode39Reader::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(9);
- 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]++;
@@ -156,7 +156,7 @@ CFX_Int32Array *CBC_OnedCode39Reader::FindAsteriskPattern(CBC_CommonBitArray *ro }
}
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;
@@ -172,26 +172,26 @@ CFX_Int32Array *CBC_OnedCode39Reader::FindAsteriskPattern(CBC_CommonBitArray *ro e = BCExceptionNotFound;
return NULL;
}
-FX_INT32 CBC_OnedCode39Reader::ToNarrowWidePattern(CFX_Int32Array *counters)
+int32_t CBC_OnedCode39Reader::ToNarrowWidePattern(CFX_Int32Array *counters)
{
- FX_INT32 numCounters = counters->GetSize();
- FX_INT32 maxNarrowCounter = 0;
- FX_INT32 wideCounters;
+ int32_t numCounters = counters->GetSize();
+ int32_t maxNarrowCounter = 0;
+ int32_t wideCounters;
do {
#undef max
- FX_INT32 minCounter = FXSYS_IntMax;
- for (FX_INT32 i = 0; i < numCounters; i++) {
- FX_INT32 counter = (*counters)[i];
+ int32_t minCounter = FXSYS_IntMax;
+ for (int32_t i = 0; i < numCounters; i++) {
+ int32_t counter = (*counters)[i];
if (counter < minCounter && counter > maxNarrowCounter) {
minCounter = counter;
}
}
maxNarrowCounter = minCounter;
wideCounters = 0;
- FX_INT32 totalWideCountersWidth = 0;
- FX_INT32 pattern = 0;
- for (FX_INT32 j = 0; j < numCounters; j++) {
- FX_INT32 counter = (*counters)[j];
+ int32_t totalWideCountersWidth = 0;
+ int32_t pattern = 0;
+ for (int32_t j = 0; j < numCounters; j++) {
+ int32_t counter = (*counters)[j];
if ((*counters)[j] > maxNarrowCounter) {
pattern |= 1 << (numCounters - 1 - j);
wideCounters++;
@@ -199,8 +199,8 @@ FX_INT32 CBC_OnedCode39Reader::ToNarrowWidePattern(CFX_Int32Array *counters) }
}
if (wideCounters == 3) {
- for (FX_INT32 k = 0; k < numCounters && wideCounters > 0; k++) {
- FX_INT32 counter = (*counters)[k];
+ for (int32_t k = 0; k < numCounters && wideCounters > 0; k++) {
+ int32_t counter = (*counters)[k];
if ((*counters)[k] > maxNarrowCounter) {
wideCounters--;
if ((counter << 1) >= totalWideCountersWidth) {
@@ -213,9 +213,9 @@ FX_INT32 CBC_OnedCode39Reader::ToNarrowWidePattern(CFX_Int32Array *counters) } while (wideCounters > 3);
return -1;
}
-FX_CHAR CBC_OnedCode39Reader::PatternToChar(FX_INT32 pattern, FX_INT32 &e)
+FX_CHAR CBC_OnedCode39Reader::PatternToChar(int32_t pattern, int32_t &e)
{
- for (FX_INT32 i = 0; i < 44; i++) {
+ for (int32_t i = 0; i < 44; i++) {
if (CHARACTER_ENCODINGS[i] == pattern) {
return (ALPHABET_STRING)[i];
}
@@ -223,12 +223,12 @@ FX_CHAR CBC_OnedCode39Reader::PatternToChar(FX_INT32 pattern, FX_INT32 &e) e = BCExceptionNotFound;
return 0;
}
-CFX_ByteString CBC_OnedCode39Reader::DecodeExtended(CFX_ByteString &encoded, FX_INT32 &e)
+CFX_ByteString CBC_OnedCode39Reader::DecodeExtended(CFX_ByteString &encoded, int32_t &e)
{
- FX_INT32 length = encoded.GetLength();
+ int32_t length = encoded.GetLength();
CFX_ByteString decoded;
FX_CHAR c, next;
- for(FX_INT32 i = 0; i < length; i++) {
+ for(int32_t i = 0; i < length; i++) {
c = encoded[i];
if(c == '+' || c == '$' || c == '%' || c == '/') {
next = encoded[i + 1];
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.h b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.h index 81fd6b79e9..3e7db70f95 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.h +++ b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.h @@ -14,19 +14,19 @@ class CBC_OnedCode39Reader : public CBC_OneDReader public:
static FX_LPCSTR ALPHABET_STRING;
static FX_LPCSTR CHECKSUM_STRING;
- const static FX_INT32 CHARACTER_ENCODINGS[44];
- const static FX_INT32 ASTERISK_ENCODING;
+ const static int32_t CHARACTER_ENCODINGS[44];
+ const static int32_t ASTERISK_ENCODING;
CBC_OnedCode39Reader();
CBC_OnedCode39Reader(FX_BOOL usingCheckDigit);
CBC_OnedCode39Reader(FX_BOOL usingCheckDigit, FX_BOOL extendedMode);
virtual ~CBC_OnedCode39Reader();
- CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e);
+ CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e);
private:
FX_BOOL m_usingCheckDigit;
FX_BOOL m_extendedMode;
- CFX_Int32Array *FindAsteriskPattern(CBC_CommonBitArray *row, FX_INT32 &e);
- FX_INT32 ToNarrowWidePattern(CFX_Int32Array *counters);
- FX_CHAR PatternToChar(FX_INT32 pattern, FX_INT32 &e);
- CFX_ByteString DecodeExtended(CFX_ByteString &encoded, FX_INT32 &e);
+ CFX_Int32Array *FindAsteriskPattern(CBC_CommonBitArray *row, int32_t &e);
+ int32_t ToNarrowWidePattern(CFX_Int32Array *counters);
+ FX_CHAR PatternToChar(int32_t pattern, int32_t &e);
+ CFX_ByteString DecodeExtended(CFX_ByteString &encoded, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.cpp index d9c77460ac..8d06ecdfc2 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.cpp @@ -46,7 +46,7 @@ FX_BOOL CBC_OnedCode39Writer::CheckContentValidity(FX_WSTR contents) if (m_extendedMode) {
return CheckExtendedContentValidity(contents);
}
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
FX_WCHAR ch = contents.GetAt(i);
if ((ch >= (FX_WCHAR)'0' && ch <= (FX_WCHAR)'9') || (ch >= (FX_WCHAR)'A' && ch <= (FX_WCHAR)'Z')
|| ch == (FX_WCHAR)'-' || ch == (FX_WCHAR)'.' || ch == (FX_WCHAR)' ' || ch == (FX_WCHAR)'*'
@@ -59,7 +59,7 @@ FX_BOOL CBC_OnedCode39Writer::CheckContentValidity(FX_WSTR contents) }
FX_BOOL CBC_OnedCode39Writer::CheckExtendedContentValidity(FX_WSTR contents)
{
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
FX_WCHAR ch = contents.GetAt(i);
if (ch > 127) {
return FALSE;
@@ -73,7 +73,7 @@ CFX_WideString CBC_OnedCode39Writer::FilterContents(FX_WSTR contents) return FilterExtendedContents(contents);
}
CFX_WideString filtercontents;
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
FX_WCHAR ch = contents.GetAt(i);
if ( ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1) ) {
continue;
@@ -95,7 +95,7 @@ CFX_WideString CBC_OnedCode39Writer::FilterContents(FX_WSTR contents) CFX_WideString CBC_OnedCode39Writer::FilterExtendedContents(FX_WSTR contents)
{
CFX_WideString filtercontents;
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
FX_WCHAR ch = contents.GetAt(i);
if ( ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1) ) {
continue;
@@ -155,7 +155,7 @@ CFX_WideString CBC_OnedCode39Writer::RenderTextContents(FX_WSTR contents) return RenderExtendedTextContents(contents);
}
CFX_WideString renderContents;
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
FX_WCHAR ch = contents.GetAt(i);
if ( ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1) ) {
continue;
@@ -176,7 +176,7 @@ CFX_WideString CBC_OnedCode39Writer::RenderTextContents(FX_WSTR contents) CFX_WideString CBC_OnedCode39Writer::RenderExtendedTextContents(FX_WSTR contents)
{
CFX_WideString renderContents;
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
FX_WCHAR ch = contents.GetAt(i);
if ( ch == (FX_WCHAR)'*' && (i == 0 || i == contents.GetLength() - 1) ) {
continue;
@@ -200,7 +200,7 @@ FX_BOOL CBC_OnedCode39Writer::SetTextLocation(BC_TEXT_LOC location) m_locTextLoc = location;
return TRUE;
}
-FX_BOOL CBC_OnedCode39Writer::SetWideNarrowRatio(FX_INT32 ratio)
+FX_BOOL CBC_OnedCode39Writer::SetWideNarrowRatio(int32_t ratio)
{
if ( ratio < 2 || ratio > 3) {
return FALSE;
@@ -208,39 +208,39 @@ FX_BOOL CBC_OnedCode39Writer::SetWideNarrowRatio(FX_INT32 ratio) m_iWideNarrRatio = ratio;
return TRUE;
}
-FX_BYTE *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0 , e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0 , e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
if(format != BCFORMAT_CODE_39) {
e = BCExceptionOnlyEncodeCODE_39;
return NULL;
}
- FX_BYTE *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ uint8_t *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-void CBC_OnedCode39Writer::ToIntArray(FX_INT32 a, FX_INT32 *toReturn)
+void CBC_OnedCode39Writer::ToIntArray(int32_t a, int32_t *toReturn)
{
- for(FX_INT32 i = 0; i < 9; i++) {
+ for(int32_t i = 0; i < 9; i++) {
toReturn[i] = (a & (1 << i) ) == 0 ? 1 : m_iWideNarrRatio;
}
}
-FX_CHAR CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString &contents, FX_INT32 &e)
+FX_CHAR CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString &contents, int32_t &e)
{
- FX_INT32 length = contents.GetLength();
+ int32_t length = contents.GetLength();
if (length > 80) {
e = BCExceptionContentsLengthShouldBetween1and80;
return '*';
}
- FX_INT32 checksum = 0;
- FX_INT32 len = (FX_INT32)strlen(CBC_OnedCode39Reader::ALPHABET_STRING);
- for(FX_INT32 i = 0; i < contents.GetLength(); i++) {
- FX_INT32 j = 0;
+ int32_t checksum = 0;
+ int32_t len = (int32_t)strlen(CBC_OnedCode39Reader::ALPHABET_STRING);
+ for(int32_t i = 0; i < contents.GetLength(); i++) {
+ int32_t j = 0;
for (; j < len; j++) {
if (CBC_OnedCode39Reader::ALPHABET_STRING[j] == contents[i]) {
if(contents[i] != '*') {
@@ -259,48 +259,48 @@ FX_CHAR CBC_OnedCode39Writer::CalcCheckSum(const CFX_ByteString &contents, FX_IN checksum = checksum % 43;
return CBC_OnedCode39Reader::CHECKSUM_STRING[checksum];
}
-FX_BYTE *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, FX_INT32 &outlength , FX_INT32 &e)
+uint8_t *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, int32_t &outlength , int32_t &e)
{
FX_CHAR checksum = CalcCheckSum(contents, e);
if (checksum == '*') {
return NULL;
}
- FX_INT32 widths[9] = {0};
- FX_INT32 wideStrideNum = 3;
- FX_INT32 narrStrideNum = 9 - wideStrideNum;
+ int32_t widths[9] = {0};
+ int32_t wideStrideNum = 3;
+ int32_t narrStrideNum = 9 - wideStrideNum;
CFX_ByteString encodedContents = contents;
if ( m_bCalcChecksum ) {
encodedContents += checksum;
}
m_iContentLen = encodedContents.GetLength();
- FX_INT32 codeWidth = (wideStrideNum * m_iWideNarrRatio + narrStrideNum) * 2 + 1 + m_iContentLen;
- FX_INT32 len = (FX_INT32)strlen(CBC_OnedCode39Reader::ALPHABET_STRING);
- for (FX_INT32 j = 0; j < m_iContentLen; j++) {
- for (FX_INT32 i = 0; i < len; i++) {
+ int32_t codeWidth = (wideStrideNum * m_iWideNarrRatio + narrStrideNum) * 2 + 1 + m_iContentLen;
+ int32_t len = (int32_t)strlen(CBC_OnedCode39Reader::ALPHABET_STRING);
+ for (int32_t j = 0; j < m_iContentLen; j++) {
+ for (int32_t i = 0; i < len; i++) {
if (CBC_OnedCode39Reader::ALPHABET_STRING[i] == encodedContents[j]) {
ToIntArray(CBC_OnedCode39Reader::CHARACTER_ENCODINGS[i], widths);
- for(FX_INT32 k = 0; k < 9; k++) {
+ for(int32_t k = 0; k < 9; k++) {
codeWidth += widths[k];
}
}
}
}
outlength = codeWidth;
- FX_BYTE *result = FX_Alloc(FX_BYTE, codeWidth);
+ uint8_t *result = FX_Alloc(uint8_t, codeWidth);
ToIntArray(CBC_OnedCode39Reader::CHARACTER_ENCODINGS[39], widths);
- FX_INT32 pos = AppendPattern(result, 0, widths, 9, 1 , e);
+ int32_t pos = AppendPattern(result, 0, widths, 9, 1 , e);
if (e != BCExceptionNO) {
FX_Free (result);
return NULL;
}
- FX_INT32 narrowWhite[] = {1};
+ int32_t narrowWhite[] = {1};
pos += AppendPattern(result, pos, narrowWhite, 1, 0, e);
if (e != BCExceptionNO) {
FX_Free (result);
return NULL;
}
- for(FX_INT32 l = m_iContentLen - 1; l >= 0; l--) {
- for (FX_INT32 i = 0; i < len; i++) {
+ for(int32_t l = m_iContentLen - 1; l >= 0; l--) {
+ for (int32_t i = 0; i < len; i++) {
if (CBC_OnedCode39Reader::ALPHABET_STRING[i] == encodedContents[l]) {
ToIntArray(CBC_OnedCode39Reader::CHARACTER_ENCODINGS[i], widths);
pos += AppendPattern(result, pos, widths, 9, 1, e);
@@ -322,14 +322,14 @@ FX_BYTE *CBC_OnedCode39Writer::Encode(const CFX_ByteString &contents, FX_INT32 & FX_Free (result);
return NULL;
}
- for (FX_INT32 i = 0; i < codeWidth / 2; i++) {
+ for (int32_t i = 0; i < codeWidth / 2; i++) {
result[i] ^= result[codeWidth - 1 - i];
result[codeWidth - 1 - i] ^= result[i];
result[i] ^= result[codeWidth - 1 - i];
}
return result;
}
-CFX_WideString CBC_OnedCode39Writer::encodedContents(FX_WSTR contents, FX_INT32 &e)
+CFX_WideString CBC_OnedCode39Writer::encodedContents(FX_WSTR contents, int32_t &e)
{
CFX_WideString encodedContents = contents;
if (m_bCalcChecksum && m_bPrintChecksum) {
@@ -343,7 +343,7 @@ CFX_WideString CBC_OnedCode39Writer::encodedContents(FX_WSTR contents, FX_INT32 }
return encodedContents;
}
-void CBC_OnedCode39Writer::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e)
+void CBC_OnedCode39Writer::RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e)
{
CFX_WideString encodedCon = encodedContents(contents, e);
BC_EXCEPTION_CHECK_ReturnVoid(e);
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.h b/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.h index b37d9d8e19..641d041809 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.h +++ b/xfa/src/fxbarcode/oned/BC_OnedCode39Writer.h @@ -15,11 +15,11 @@ public: CBC_OnedCode39Writer();
CBC_OnedCode39Writer(FX_BOOL extendedMode);
virtual ~CBC_OnedCode39Writer();
- FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE *Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
- FX_BYTE *Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e);
- void RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e);
- CFX_WideString encodedContents(FX_WSTR contents, FX_INT32 &e);
+ uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t *Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
+ uint8_t *Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e);
+ void RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e);
+ CFX_WideString encodedContents(FX_WSTR contents, int32_t &e);
FX_BOOL CheckContentValidity(FX_WSTR contents);
FX_BOOL CheckExtendedContentValidity(FX_WSTR contents);
CFX_WideString FilterContents(FX_WSTR contents);
@@ -27,11 +27,11 @@ public: CFX_WideString RenderTextContents(FX_WSTR contents);
CFX_WideString RenderExtendedTextContents(FX_WSTR contents);
FX_BOOL SetTextLocation(BC_TEXT_LOC loction);
- FX_BOOL SetWideNarrowRatio(FX_INT32 ratio);
+ FX_BOOL SetWideNarrowRatio(int32_t ratio);
private:
- void ToIntArray(FX_INT32 a, FX_INT32 *toReturn);
- FX_CHAR CalcCheckSum(const CFX_ByteString &contents, FX_INT32 &e);
- FX_INT32 m_iWideNarrRatio;
+ void ToIntArray(int32_t a, int32_t *toReturn);
+ FX_CHAR CalcCheckSum(const CFX_ByteString &contents, int32_t &e);
+ int32_t m_iWideNarrRatio;
FX_BOOL m_extendedMode;
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.cpp index ddce736bb8..288aace861 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.cpp @@ -26,7 +26,7 @@ #include "BC_OneDReader.h"
#include "BC_OneDimReader.h"
#include "BC_OnedEAN13Reader.h"
-const FX_INT32 CBC_OnedEAN13Reader::FIRST_DIGIT_ENCODINGS[10] = {
+const int32_t CBC_OnedEAN13Reader::FIRST_DIGIT_ENCODINGS[10] = {
0x00, 0x0B, 0x0D, 0xE, 0x13, 0x19, 0x1C, 0x15, 0x16, 0x1A
};
CBC_OnedEAN13Reader::CBC_OnedEAN13Reader()
@@ -35,9 +35,9 @@ CBC_OnedEAN13Reader::CBC_OnedEAN13Reader() CBC_OnedEAN13Reader::~CBC_OnedEAN13Reader()
{
}
-void CBC_OnedEAN13Reader::DetermineFirstDigit(CFX_ByteString &result, FX_INT32 lgPatternFound, FX_INT32 &e)
+void CBC_OnedEAN13Reader::DetermineFirstDigit(CFX_ByteString &result, int32_t lgPatternFound, int32_t &e)
{
- for (FX_INT32 d = 0; d < 10; d++) {
+ for (int32_t d = 0; d < 10; d++) {
if (lgPatternFound == FIRST_DIGIT_ENCODINGS[d]) {
result.Insert(0, (FX_CHAR) ('0' + d));
return;
@@ -46,21 +46,21 @@ void CBC_OnedEAN13Reader::DetermineFirstDigit(CFX_ByteString &result, FX_INT32 l e = BCExceptionNotFound;
BC_EXCEPTION_CHECK_ReturnVoid(e);
}
-FX_INT32 CBC_OnedEAN13Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, FX_INT32 &e)
+int32_t CBC_OnedEAN13Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, int32_t &e)
{
CFX_Int32Array counters;
counters.Add(0);
counters.Add(0);
counters.Add(0);
counters.Add(0);
- FX_INT32 end = row->GetSize();
- FX_INT32 rowOffset = (*startRange)[1];
- FX_INT32 lgPatternFound = 0;
- for (FX_INT32 x = 0; x < 6 && rowOffset < end; x++) {
- FX_INT32 bestMatch = DecodeDigit(row, &counters, rowOffset, &(CBC_OneDimReader::L_AND_G_PATTERNS[0][0]), 20, e);
+ int32_t end = row->GetSize();
+ int32_t rowOffset = (*startRange)[1];
+ int32_t lgPatternFound = 0;
+ for (int32_t x = 0; x < 6 && rowOffset < end; x++) {
+ int32_t bestMatch = DecodeDigit(row, &counters, rowOffset, &(CBC_OneDimReader::L_AND_G_PATTERNS[0][0]), 20, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
resultString += (FX_CHAR) ('0' + bestMatch % 10);
- for (FX_INT32 i = 0; i < counters.GetSize(); i++) {
+ for (int32_t i = 0; i < counters.GetSize(); i++) {
rowOffset += counters[i];
}
if (bestMatch >= 10) {
@@ -82,11 +82,11 @@ FX_INT32 CBC_OnedEAN13Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Arr delete middleRange;
middleRange = NULL;
}
- for (FX_INT32 Y = 0; Y < 6 && rowOffset < end; Y++) {
- FX_INT32 bestMatch = DecodeDigit(row, &counters, rowOffset, &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e);
+ for (int32_t Y = 0; Y < 6 && rowOffset < end; Y++) {
+ int32_t bestMatch = DecodeDigit(row, &counters, rowOffset, &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
resultString += (FX_CHAR) ('0' + bestMatch);
- for (FX_INT32 k = 0; k < counters.GetSize(); k++) {
+ for (int32_t k = 0; k < counters.GetSize(); k++) {
rowOffset += counters[k];
}
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.h b/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.h index 9afb9b6418..7c31fd4f20 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.h +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.h @@ -12,13 +12,13 @@ class CBC_OnedEAN13Reader; class CBC_OnedEAN13Reader : public CBC_OneDimReader
{
public:
- const static FX_INT32 FIRST_DIGIT_ENCODINGS[10];
+ const static int32_t FIRST_DIGIT_ENCODINGS[10];
CBC_OnedEAN13Reader();
virtual ~CBC_OnedEAN13Reader();
private:
- void DetermineFirstDigit(CFX_ByteString &result, FX_INT32 lgPatternFound, FX_INT32 &e);
+ void DetermineFirstDigit(CFX_ByteString &result, int32_t lgPatternFound, int32_t &e);
protected:
- FX_INT32 DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, FX_INT32 &e);
+ int32_t DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, int32_t &e);
friend class CBC_OnedUPCAReader;
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp index 788cd8f7da..4b258a5a9f 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -42,7 +42,7 @@ CBC_OnedEAN13Writer::~CBC_OnedEAN13Writer() }
FX_BOOL CBC_OnedEAN13Writer::CheckContentValidity(FX_WSTR contents)
{
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') {
continue;
} else {
@@ -55,7 +55,7 @@ CFX_WideString CBC_OnedEAN13Writer::FilterContents(FX_WSTR contents) {
CFX_WideString filtercontents;
FX_WCHAR ch;
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
ch = contents.GetAt(i);
if(ch > 175) {
i++;
@@ -67,12 +67,12 @@ CFX_WideString CBC_OnedEAN13Writer::FilterContents(FX_WSTR contents) }
return filtercontents;
}
-FX_INT32 CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString &contents)
+int32_t CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString &contents)
{
- FX_INT32 odd = 0;
- FX_INT32 even = 0;
- FX_INT32 j = 1;
- for(FX_INT32 i = contents.GetLength() - 1; i >= 0; i--) {
+ int32_t odd = 0;
+ int32_t even = 0;
+ int32_t j = 1;
+ for(int32_t i = contents.GetLength() - 1; i >= 0; i--) {
if(j % 2) {
odd += FXSYS_atoi(contents.Mid(i, 1));
} else {
@@ -80,45 +80,45 @@ FX_INT32 CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString &contents) }
j++;
}
- FX_INT32 checksum = (odd * 3 + even) % 10;
+ int32_t checksum = (odd * 3 + even) % 10;
checksum = (10 - checksum) % 10;
return (checksum);
}
-FX_BYTE *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
if(format != BCFORMAT_EAN_13) {
e = BCExceptionOnlyEncodeEAN_13;
}
- FX_BYTE *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ uint8_t *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e)
+uint8_t *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e)
{
if (contents.GetLength() != 13) {
e = BCExceptionDigitLengthShould13;
return NULL;
}
m_iDataLenth = 13;
- FX_INT32 firstDigit = FXSYS_atoi(contents.Mid(0, 1));
- FX_INT32 parities = CBC_OnedEAN13Reader::FIRST_DIGIT_ENCODINGS[firstDigit];
+ int32_t firstDigit = FXSYS_atoi(contents.Mid(0, 1));
+ int32_t parities = CBC_OnedEAN13Reader::FIRST_DIGIT_ENCODINGS[firstDigit];
outLength = m_codeWidth;
- FX_BYTE *result = FX_Alloc(FX_BYTE, m_codeWidth);
- FX_INT32 pos = 0;
+ uint8_t *result = FX_Alloc(uint8_t, m_codeWidth);
+ int32_t pos = 0;
pos += AppendPattern(result, pos, CBC_OneDimReader::START_END_PATTERN, 3, 1, e);
if (e != BCExceptionNO) {
FX_Free (result);
return NULL;
}
- FX_INT32 i = 0;
+ int32_t i = 0;
for ( i = 1; i <= 6; i++) {
- FX_INT32 digit = FXSYS_atoi(contents.Mid(i, 1));
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1));
if ((parities >> (6 - i) & 1) == 1) {
digit += 10;
}
@@ -134,7 +134,7 @@ FX_BYTE *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, FX_INT32 &o return NULL;
}
for (i = 7; i <= 12; i++) {
- FX_INT32 digit = FXSYS_atoi(contents.Mid(i, 1));
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1));
pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 1, e);
if (e != BCExceptionNO) {
FX_Free (result);
@@ -148,16 +148,16 @@ FX_BYTE *CBC_OnedEAN13Writer::Encode(const CFX_ByteString &contents, FX_INT32 &o }
return result;
}
-void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e)
+void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e)
{
if (device == NULL && pOutBitmap == NULL) {
e = BCExceptionIllegalArgument;
return;
}
- FX_INT32 leftPadding = 7 * multiple;
- FX_INT32 leftPosition = 3 * multiple + leftPadding;
+ int32_t leftPadding = 7 * multiple;
+ int32_t leftPosition = 3 * multiple + leftPadding;
CFX_ByteString str = FX_UTF8Encode(contents);
- FX_INT32 iLen = str.GetLength();
+ int32_t iLen = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
if (!pCharPos) {
return;
@@ -167,10 +167,10 @@ void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, if (pOutBitmap != NULL) {
geBitmap.Attach(pOutBitmap);
}
- FX_INT32 iFontSize = (FX_INT32)fabs(m_fFontSize);
- FX_INT32 iTextHeight = iFontSize + 1;
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
CFX_ByteString tempStr = str.Mid(1, 6);
- FX_INT32 strWidth = multiple * 42;
+ int32_t strWidth = multiple * 42;
if (pOutBitmap == NULL) {
CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect((FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height);
@@ -184,7 +184,7 @@ void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, matr1.TransformRect(rect1);
re = rect1.GetOutterRect();
device->FillRect(&re, m_backgroundColor);
- FX_INT32 strWidth1 = multiple * 7;
+ int32_t strWidth1 = multiple * 7;
CFX_Matrix matr2(m_outputHScale, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f);
CFX_FloatRect rect2(0.0f, (FX_FLOAT)(m_Height - iTextHeight), (FX_FLOAT)strWidth1 - 0.5f, (FX_FLOAT)m_Height);
matr2.Concat(*matrix);
@@ -196,7 +196,7 @@ void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, FX_FLOAT charsWidth = 0;
iLen = tempStr.GetLength();
if (pOutBitmap == NULL) {
- strWidth = (FX_INT32)(strWidth * m_outputHScale);
+ strWidth = (int32_t)(strWidth * m_outputHScale);
}
CalcTextInfo(tempStr, pCharPos + 1, m_pFont, (FX_FLOAT)strWidth, iFontSize, blank);
CFX_AffineMatrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
@@ -258,7 +258,7 @@ void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, iLen = tempStr.GetLength();
strWidth = multiple * 7;
if (pOutBitmap == NULL) {
- strWidth = (FX_INT32)(strWidth * m_outputHScale);
+ strWidth = (int32_t)(strWidth * m_outputHScale);
}
CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, blank);
if(pOutBitmap != NULL) {
@@ -288,7 +288,7 @@ void CBC_OnedEAN13Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, }
FX_Free(pCharPos);
}
-void CBC_OnedEAN13Writer::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e)
+void CBC_OnedEAN13Writer::RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e)
{
CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.h b/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.h index 2353cfda95..df9d635a4e 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.h +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN13Writer.h @@ -11,21 +11,21 @@ class CBC_OnedEAN13Writer; class CBC_OnedEAN13Writer : public CBC_OneDimWriter
{
private:
- FX_INT32 m_codeWidth;
+ int32_t m_codeWidth;
public:
CBC_OnedEAN13Writer();
virtual ~CBC_OnedEAN13Writer();
- FX_BYTE* Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE* Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
- FX_BYTE* Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e);
- void RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e);
+ uint8_t* Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t* Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
+ uint8_t* Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e);
+ void RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e);
FX_BOOL CheckContentValidity(FX_WSTR contents);
CFX_WideString FilterContents(FX_WSTR contents);
- FX_INT32 CalcChecksum(const CFX_ByteString &contents);
+ int32_t CalcChecksum(const CFX_ByteString &contents);
protected:
- void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e);
+ void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.cpp index 48e24681df..4b5de72939 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.cpp @@ -32,25 +32,25 @@ CBC_OnedEAN8Reader::CBC_OnedEAN8Reader() CBC_OnedEAN8Reader::~CBC_OnedEAN8Reader()
{
}
-FX_INT32 CBC_OnedEAN8Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultResult, FX_INT32 &e)
+int32_t CBC_OnedEAN8Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultResult, int32_t &e)
{
CFX_Int32Array counters;
counters.Add(0);
counters.Add(0);
counters.Add(0);
counters.Add(0);
- FX_INT32 end = row->GetSize();
- FX_INT32 rowOffset = (*startRange)[1];
- FX_INT32 rowOffsetLeft = rowOffset;
- for (FX_INT32 x = 0; x < 4 && rowOffset < end; x++) {
- FX_INT32 bestMatch = DecodeDigit(row, &counters, rowOffset, &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e);
+ int32_t end = row->GetSize();
+ int32_t rowOffset = (*startRange)[1];
+ int32_t rowOffsetLeft = rowOffset;
+ for (int32_t x = 0; x < 4 && rowOffset < end; x++) {
+ int32_t bestMatch = DecodeDigit(row, &counters, rowOffset, &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
resultResult += (FX_CHAR) ('0' + bestMatch);
- for (FX_INT32 i = 0; i < counters.GetSize(); i++) {
+ for (int32_t i = 0; i < counters.GetSize(); i++) {
rowOffset += counters[i];
}
}
- FX_INT32 RowOffsetLen = (rowOffset - rowOffsetLeft) / 4;
+ int32_t RowOffsetLen = (rowOffset - rowOffsetLeft) / 4;
CFX_Int32Array result;
result.Add(CBC_OneDimReader::MIDDLE_PATTERN[0]);
result.Add(CBC_OneDimReader::MIDDLE_PATTERN[1]);
@@ -59,7 +59,7 @@ FX_INT32 CBC_OnedEAN8Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Arra result.Add(CBC_OneDimReader::MIDDLE_PATTERN[4]);
CFX_Int32Array *middleRange = FindGuardPattern(row, rowOffset, TRUE, &result, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
- FX_INT32 rowOffsetMid = rowOffset;
+ int32_t rowOffsetMid = rowOffset;
rowOffset = (*middleRange)[1];
if((rowOffset - rowOffsetMid) > RowOffsetLen) {
e = BCExceptionNotFound;
@@ -69,11 +69,11 @@ FX_INT32 CBC_OnedEAN8Reader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Arra delete middleRange;
middleRange = NULL;
}
- for (FX_INT32 y = 0; y < 4 && rowOffset < end; y++) {
- FX_INT32 bestMatch = DecodeDigit(row, & counters, rowOffset, &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e);
+ for (int32_t y = 0; y < 4 && rowOffset < end; y++) {
+ int32_t bestMatch = DecodeDigit(row, & counters, rowOffset, &(CBC_OneDimReader::L_PATTERNS[0][0]), 10, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
resultResult += (FX_CHAR) ('0' + bestMatch);
- for (FX_INT32 i = 0; i < counters.GetSize(); i++) {
+ for (int32_t i = 0; i < counters.GetSize(); i++) {
rowOffset += counters[i];
}
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.h b/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.h index a32bb63083..f2aa93c8ea 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.h +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN8Reader.h @@ -15,6 +15,6 @@ public: CBC_OnedEAN8Reader();
virtual ~CBC_OnedEAN8Reader();
protected:
- FX_INT32 DecodeMiddle(CBC_CommonBitArray*, CFX_Int32Array *startRange, CFX_ByteString &result, FX_INT32 &e);
+ int32_t DecodeMiddle(CBC_CommonBitArray*, CFX_Int32Array *startRange, CFX_ByteString &result, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp index 19f7f7cede..fdf791c686 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -40,7 +40,7 @@ CBC_OnedEAN8Writer::CBC_OnedEAN8Writer() CBC_OnedEAN8Writer::~CBC_OnedEAN8Writer()
{
}
-void CBC_OnedEAN8Writer::SetDataLength(FX_INT32 length)
+void CBC_OnedEAN8Writer::SetDataLength(int32_t length)
{
m_iDataLenth = 8;
}
@@ -54,7 +54,7 @@ FX_BOOL CBC_OnedEAN8Writer::SetTextLocation(BC_TEXT_LOC location) }
FX_BOOL CBC_OnedEAN8Writer::CheckContentValidity(FX_WSTR contents)
{
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') {
continue;
} else {
@@ -67,7 +67,7 @@ CFX_WideString CBC_OnedEAN8Writer::FilterContents(FX_WSTR contents) {
CFX_WideString filtercontents;
FX_WCHAR ch;
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
ch = contents.GetAt(i);
if(ch > 175) {
i++;
@@ -79,12 +79,12 @@ CFX_WideString CBC_OnedEAN8Writer::FilterContents(FX_WSTR contents) }
return filtercontents;
}
-FX_INT32 CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString &contents)
+int32_t CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString &contents)
{
- FX_INT32 odd = 0;
- FX_INT32 even = 0;
- FX_INT32 j = 1;
- for(FX_INT32 i = contents.GetLength() - 1; i >= 0; i--) {
+ int32_t odd = 0;
+ int32_t even = 0;
+ int32_t j = 1;
+ for(int32_t i = contents.GetLength() - 1; i >= 0; i--) {
if(j % 2) {
odd += FXSYS_atoi(contents.Mid(i, 1));
} else {
@@ -92,44 +92,44 @@ FX_INT32 CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString &contents) }
j++;
}
- FX_INT32 checksum = (odd * 3 + even) % 10;
+ int32_t checksum = (odd * 3 + even) % 10;
checksum = (10 - checksum) % 10;
return (checksum);
}
-FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight , FX_INT32 &e)
+uint8_t *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight , int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, BCFORMAT format,
- FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints , FX_INT32 &e)
+uint8_t *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, BCFORMAT format,
+ int32_t &outWidth, int32_t &outHeight, int32_t hints , int32_t &e)
{
if (format != BCFORMAT_EAN_8) {
e = BCExceptionOnlyEncodeEAN_8;
return NULL;
}
- FX_BYTE *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
+ uint8_t *ret = CBC_OneDimWriter::Encode(contents, format, outWidth, outHeight, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, FX_INT32 &outLength , FX_INT32 &e)
+uint8_t *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, int32_t &outLength , int32_t &e)
{
if (contents.GetLength() != 8) {
e = BCExceptionDigitLengthMustBe8;
return NULL;
}
outLength = m_codeWidth;
- FX_BYTE *result = FX_Alloc(FX_BYTE, m_codeWidth);
- FX_INT32 pos = 0;
+ uint8_t *result = FX_Alloc(uint8_t, m_codeWidth);
+ int32_t pos = 0;
pos += AppendPattern(result, pos, CBC_OneDimReader::START_END_PATTERN, 3, 1, e);
if (e != BCExceptionNO) {
FX_Free (result);
return NULL;
}
- FX_INT32 i = 0;
+ int32_t i = 0;
for (i = 0; i <= 3; i++) {
- FX_INT32 digit = FXSYS_atoi(contents.Mid(i, 1));
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1));
pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 0, e);
if (e != BCExceptionNO) {
FX_Free (result);
@@ -142,7 +142,7 @@ FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, FX_INT32 &ou return NULL;
}
for (i = 4; i <= 7; i++) {
- FX_INT32 digit = FXSYS_atoi(contents.Mid(i, 1));
+ int32_t digit = FXSYS_atoi(contents.Mid(i, 1));
pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 1, e);
if (e != BCExceptionNO) {
FX_Free (result);
@@ -156,31 +156,31 @@ FX_BYTE *CBC_OnedEAN8Writer::Encode(const CFX_ByteString &contents, FX_INT32 &ou }
return result;
}
-void CBC_OnedEAN8Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e)
+void CBC_OnedEAN8Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e)
{
if (device == NULL && pOutBitmap == NULL) {
e = BCExceptionIllegalArgument;
return;
}
- FX_INT32 leftPosition = 3 * multiple;
+ int32_t leftPosition = 3 * multiple;
CFX_ByteString str = FX_UTF8Encode(contents);
- FX_INT32 iLength = str.GetLength();
+ int32_t iLength = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLength);
if (!pCharPos) {
return;
}
FXSYS_memset32(pCharPos, 0, sizeof(FXTEXT_CHARPOS) * iLength);
CFX_ByteString tempStr = str.Mid(0, 4);
- FX_INT32 iLen = tempStr.GetLength();
- FX_INT32 strWidth = 7 * multiple * 4;
+ int32_t iLen = tempStr.GetLength();
+ int32_t strWidth = 7 * multiple * 4;
FX_FLOAT blank = 0.0;
CFX_FxgeDevice geBitmap;
if (pOutBitmap != NULL) {
geBitmap.Attach(pOutBitmap);
}
FX_FLOAT charsWidth = 0;
- FX_INT32 iFontSize = (FX_INT32)fabs(m_fFontSize);
- FX_INT32 iTextHeight = iFontSize + 1;
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
if (pOutBitmap == NULL) {
CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect((FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height);
@@ -196,7 +196,7 @@ void CBC_OnedEAN8Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, C device->FillRect(&re, m_backgroundColor);
}
if (pOutBitmap == NULL) {
- strWidth = (FX_INT32)(strWidth * m_outputHScale);
+ strWidth = (int32_t)(strWidth * m_outputHScale);
}
CalcTextInfo(tempStr, pCharPos, m_pFont, (FX_FLOAT)strWidth, iFontSize, blank);
CFX_AffineMatrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (FX_FLOAT)iFontSize);
@@ -255,7 +255,7 @@ void CBC_OnedEAN8Writer::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, C }
FX_Free(pCharPos);
}
-void CBC_OnedEAN8Writer::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e)
+void CBC_OnedEAN8Writer::RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e)
{
CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.h b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.h index 2b55734538..f2e5cc2cbe 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.h +++ b/xfa/src/fxbarcode/oned/BC_OnedEAN8Writer.h @@ -12,21 +12,21 @@ class CBC_OnedEAN8Writer; class CBC_OnedEAN8Writer : public CBC_OneDimWriter
{
private:
- FX_INT32 m_codeWidth;
+ int32_t m_codeWidth;
public:
CBC_OnedEAN8Writer();
virtual ~CBC_OnedEAN8Writer();
- FX_BYTE * Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight , FX_INT32 &e);
- FX_BYTE * Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints , FX_INT32 &e);
- FX_BYTE * Encode(const CFX_ByteString &contents, FX_INT32 &outLength, FX_INT32 &e);
- void RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e);
+ uint8_t * Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight , int32_t &e);
+ uint8_t * Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints , int32_t &e);
+ uint8_t * Encode(const CFX_ByteString &contents, int32_t &outLength, int32_t &e);
+ void RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e);
FX_BOOL CheckContentValidity(FX_WSTR contents);
CFX_WideString FilterContents(FX_WSTR contents);
- void SetDataLength(FX_INT32 length);
+ void SetDataLength(int32_t length);
FX_BOOL SetTextLocation(BC_TEXT_LOC location);
- FX_INT32 CalcChecksum(const CFX_ByteString &contents);
+ int32_t CalcChecksum(const CFX_ByteString &contents);
protected:
- void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e);
+ void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.cpp b/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.cpp index 44c26acf7e..0156ba4af7 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.cpp @@ -42,7 +42,7 @@ CBC_OnedUPCAReader::~CBC_OnedUPCAReader() }
m_ean13Reader = NULL;
}
-CFX_ByteString CBC_OnedUPCAReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OnedUPCAReader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e)
{
CFX_ByteString bytestring = m_ean13Reader->DecodeRow(rowNumber, row, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -50,7 +50,7 @@ CFX_ByteString CBC_OnedUPCAReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitAr BC_EXCEPTION_CHECK_ReturnValue(e, "");
return temp;
}
-CFX_ByteString CBC_OnedUPCAReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OnedUPCAReader::DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, int32_t hints, int32_t &e)
{
CFX_ByteString bytestring = m_ean13Reader->DecodeRow(rowNumber, row, startGuardRange, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -58,7 +58,7 @@ CFX_ByteString CBC_OnedUPCAReader::DecodeRow(FX_INT32 rowNumber, CBC_CommonBitAr BC_EXCEPTION_CHECK_ReturnValue(e, "");
return temp;
}
-CFX_ByteString CBC_OnedUPCAReader::Decode(CBC_BinaryBitmap *image, FX_INT32 &e)
+CFX_ByteString CBC_OnedUPCAReader::Decode(CBC_BinaryBitmap *image, int32_t &e)
{
CFX_ByteString bytestring = m_ean13Reader->Decode(image, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -66,7 +66,7 @@ CFX_ByteString CBC_OnedUPCAReader::Decode(CBC_BinaryBitmap *image, FX_INT32 &e) BC_EXCEPTION_CHECK_ReturnValue(e, "");
return temp;
}
-CFX_ByteString CBC_OnedUPCAReader::Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e)
+CFX_ByteString CBC_OnedUPCAReader::Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e)
{
CFX_ByteString bytestring = m_ean13Reader->Decode(image, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, "");
@@ -74,13 +74,13 @@ CFX_ByteString CBC_OnedUPCAReader::Decode(CBC_BinaryBitmap *image, FX_INT32 hint BC_EXCEPTION_CHECK_ReturnValue(e, "");
return temp;
}
-FX_INT32 CBC_OnedUPCAReader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, FX_INT32 &e)
+int32_t CBC_OnedUPCAReader::DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, int32_t &e)
{
- FX_INT32 temp = m_ean13Reader->DecodeMiddle(row, startRange, resultString, e);
+ int32_t temp = m_ean13Reader->DecodeMiddle(row, startRange, resultString, e);
BC_EXCEPTION_CHECK_ReturnValue(e, 0);
return temp;
}
-CFX_ByteString CBC_OnedUPCAReader::MaybeReturnResult(CFX_ByteString &result, FX_INT32 &e)
+CFX_ByteString CBC_OnedUPCAReader::MaybeReturnResult(CFX_ByteString &result, int32_t &e)
{
if(result[0] == '0') {
result.Delete(0);
diff --git a/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.h b/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.h index 5df6c739ff..c1eccb57d1 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.h +++ b/xfa/src/fxbarcode/oned/BC_OnedUPCAReader.h @@ -18,13 +18,13 @@ private: public:
CBC_OnedUPCAReader();
virtual ~CBC_OnedUPCAReader();
- CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, FX_INT32 hints, FX_INT32 &e);
- CFX_ByteString DecodeRow(FX_INT32 rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, FX_INT32 hints, FX_INT32 &e);
- CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 &e);
- CFX_ByteString Decode(CBC_BinaryBitmap *image, FX_INT32 hints, FX_INT32 &e);
+ CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, int32_t hints, int32_t &e);
+ CFX_ByteString DecodeRow(int32_t rowNumber, CBC_CommonBitArray *row, CFX_Int32Array *startGuardRange, int32_t hints, int32_t &e);
+ CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t &e);
+ CFX_ByteString Decode(CBC_BinaryBitmap *image, int32_t hints, int32_t &e);
virtual void Init();
protected:
- FX_INT32 DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, FX_INT32 &e);
- CFX_ByteString MaybeReturnResult(CFX_ByteString &result, FX_INT32 &e);
+ int32_t DecodeMiddle(CBC_CommonBitArray *row, CFX_Int32Array *startRange, CFX_ByteString &resultString, int32_t &e);
+ CFX_ByteString MaybeReturnResult(CFX_ByteString &result, int32_t &e);
};
#endif
diff --git a/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp index 612c031c02..56324a8e1a 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -44,7 +44,7 @@ CBC_OnedUPCAWriter::~CBC_OnedUPCAWriter() }
FX_BOOL CBC_OnedUPCAWriter::CheckContentValidity(FX_WSTR contents)
{
- FX_INT32 i = 0;
+ int32_t i = 0;
for (i = 0; i < contents.GetLength(); i++) {
if (contents.GetAt(i) >= '0' && contents.GetAt(i) <= '9') {
continue;
@@ -58,7 +58,7 @@ CFX_WideString CBC_OnedUPCAWriter::FilterContents(FX_WSTR contents) {
CFX_WideString filtercontents;
FX_WCHAR ch;
- for (FX_INT32 i = 0; i < contents.GetLength(); i++) {
+ for (int32_t i = 0; i < contents.GetLength(); i++) {
ch = contents.GetAt(i);
if(ch > 175) {
i++;
@@ -70,12 +70,12 @@ CFX_WideString CBC_OnedUPCAWriter::FilterContents(FX_WSTR contents) }
return filtercontents;
}
-FX_INT32 CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString &contents)
+int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString &contents)
{
- FX_INT32 odd = 0;
- FX_INT32 even = 0;
- FX_INT32 j = 1;
- for(FX_INT32 i = contents.GetLength() - 1; i >= 0; i--) {
+ int32_t odd = 0;
+ int32_t even = 0;
+ int32_t j = 1;
+ for(int32_t i = contents.GetLength() - 1; i >= 0; i--) {
if(j % 2) {
odd += FXSYS_atoi(contents.Mid(i, 1));
} else {
@@ -83,17 +83,17 @@ FX_INT32 CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString &contents) }
j++;
}
- FX_INT32 checksum = (odd * 3 + even) % 10;
+ int32_t checksum = (odd * 3 + even) % 10;
checksum = (10 - checksum) % 10;
return (checksum);
}
-FX_BYTE *CBC_OnedUPCAWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e)
+uint8_t *CBC_OnedUPCAWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e)
{
- FX_BYTE *ret = Encode(contents, format, outWidth, outHeight, 0, e);
+ uint8_t *ret = Encode(contents, format, outWidth, outHeight, 0, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-FX_BYTE *CBC_OnedUPCAWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e)
+uint8_t *CBC_OnedUPCAWriter::Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e)
{
if (format != BCFORMAT_UPC_A) {
e = BCExceptionOnlyEncodeUPC_A;
@@ -101,20 +101,20 @@ FX_BYTE *CBC_OnedUPCAWriter::Encode(const CFX_ByteString &contents, BCFORMAT for }
CFX_ByteString toEAN13String = '0' + contents;
m_iDataLenth = 13;
- FX_BYTE *ret = m_subWriter->Encode(toEAN13String, BCFORMAT_EAN_13, outWidth, outHeight, hints, e);
+ uint8_t *ret = m_subWriter->Encode(toEAN13String, BCFORMAT_EAN_13, outWidth, outHeight, hints, e);
BC_EXCEPTION_CHECK_ReturnValue(e, NULL);
return ret;
}
-void CBC_OnedUPCAWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e)
+void CBC_OnedUPCAWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e)
{
if (device == NULL && pOutBitmap == NULL) {
e = BCExceptionIllegalArgument;
return;
}
- FX_INT32 leftPadding = 7 * multiple;
- FX_INT32 leftPosition = 10 * multiple + leftPadding;
+ int32_t leftPadding = 7 * multiple;
+ int32_t leftPosition = 10 * multiple + leftPadding;
CFX_ByteString str = FX_UTF8Encode(contents);
- FX_INT32 iLen = str.GetLength();
+ int32_t iLen = str.GetLength();
FXTEXT_CHARPOS* pCharPos = FX_Alloc(FXTEXT_CHARPOS, iLen);
if (!pCharPos) {
return;
@@ -129,8 +129,8 @@ void CBC_OnedUPCAWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, C }
FX_FLOAT charsWidth = 0;
iLen = tempStr.GetLength();
- FX_INT32 iFontSize = (FX_INT32)fabs(m_fFontSize);
- FX_INT32 iTextHeight = iFontSize + 1;
+ int32_t iFontSize = (int32_t)fabs(m_fFontSize);
+ int32_t iTextHeight = iFontSize + 1;
if (pOutBitmap == NULL) {
CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
CFX_FloatRect rect((FX_FLOAT)leftPosition, (FX_FLOAT)(m_Height - iTextHeight), (FX_FLOAT)(leftPosition + strWidth - 0.5), (FX_FLOAT)m_Height);
@@ -278,7 +278,7 @@ void CBC_OnedUPCAWriter::ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, C }
FX_Free(pCharPos);
}
-void CBC_OnedUPCAWriter::RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e)
+void CBC_OnedUPCAWriter::RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e)
{
CBC_OneDimWriter::RenderResult(contents, code, codeLength, isDevice, e);
}
diff --git a/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.h b/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.h index 4174ceb36e..ff59f9b660 100644 --- a/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.h +++ b/xfa/src/fxbarcode/oned/BC_OnedUPCAWriter.h @@ -17,15 +17,15 @@ public: CBC_OnedUPCAWriter();
virtual ~CBC_OnedUPCAWriter();
virtual void Init();
- FX_BYTE* Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 &e);
- FX_BYTE* Encode(const CFX_ByteString &contents, BCFORMAT format, FX_INT32 &outWidth, FX_INT32 &outHeight, FX_INT32 hints, FX_INT32 &e);
- void RenderResult(FX_WSTR contents, FX_BYTE* code, FX_INT32 codeLength, FX_BOOL isDevice, FX_INT32 &e);
+ uint8_t* Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t &e);
+ uint8_t* Encode(const CFX_ByteString &contents, BCFORMAT format, int32_t &outWidth, int32_t &outHeight, int32_t hints, int32_t &e);
+ void RenderResult(FX_WSTR contents, uint8_t* code, int32_t codeLength, FX_BOOL isDevice, int32_t &e);
FX_BOOL CheckContentValidity(FX_WSTR contents);
CFX_WideString FilterContents(FX_WSTR contents);
- FX_INT32 CalcChecksum(const CFX_ByteString &contents);
+ int32_t CalcChecksum(const CFX_ByteString &contents);
protected:
- void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, FX_INT32 barWidth, FX_INT32 multiple, FX_INT32 &e);
+ void ShowChars(FX_WSTR contents, CFX_DIBitmap *pOutBitmap, CFX_RenderDevice* device, const CFX_Matrix* matrix, int32_t barWidth, int32_t multiple, int32_t &e);
};
#endif
|