Index: xfa/src/fxbarcode/oned/BC_OnedCode128Writer.cpp |
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.cpp |
index 6dd3cbe8a56a2783c03af42d3ebf2ccda2cc6e7f..5f7b32caa4338ee1bdc837f5b5d7a4759882e183 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++; |