diff options
Diffstat (limited to 'xfa/src/fxbarcode')
-rw-r--r-- | xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp | 11 | ||||
-rw-r--r-- | xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp | 25 |
2 files changed, 17 insertions, 19 deletions
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.cpp index f056c17616..5d363814af 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() { } CBC_OnedCodaBarWriter::~CBC_OnedCodaBarWriter() {} FX_BOOL CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start) { - for (int32_t i = 0; i < sizeof(START_END_CHARS) / sizeof(FX_CHAR); i++) { + for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) { if (START_END_CHARS[i] == start) { m_chStart = start; return TRUE; @@ -50,8 +50,9 @@ FX_BOOL CBC_OnedCodaBarWriter::SetStartChar(FX_CHAR start) { } return FALSE; } + FX_BOOL CBC_OnedCodaBarWriter::SetEndChar(FX_CHAR end) { - for (int32_t i = 0; i < sizeof(START_END_CHARS) / sizeof(FX_CHAR); i++) { + for (size_t i = 0; i < FX_ArraySize(START_END_CHARS); ++i) { if (START_END_CHARS[i] == end) { m_chEnd = end; return TRUE; @@ -78,19 +79,19 @@ FX_BOOL CBC_OnedCodaBarWriter::SetWideNarrowRatio(int32_t ratio) { } FX_BOOL CBC_OnedCodaBarWriter::FindChar(FX_WCHAR ch, FX_BOOL isContent) { if (isContent) { - for (int32_t i = 0; i < sizeof(CONTENT_CHARS) / sizeof(FX_CHAR); i++) { + for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) { if (ch == (FX_WCHAR)CONTENT_CHARS[i]) { return TRUE; } } - for (int32_t j = 0; j < sizeof(START_END_CHARS) / sizeof(FX_CHAR); j++) { + for (size_t j = 0; j < FX_ArraySize(START_END_CHARS); ++j) { if (ch == (FX_WCHAR)START_END_CHARS[j]) { return TRUE; } } return FALSE; } else { - for (int32_t i = 0; i < sizeof(CONTENT_CHARS) / sizeof(FX_CHAR); i++) { + for (size_t i = 0; i < FX_ArraySize(CONTENT_CHARS); ++i) { if (ch == (FX_WCHAR)CONTENT_CHARS[i]) { return TRUE; } diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp index 8bd4fe1ba4..89fed29ffa 100644 --- a/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp +++ b/xfa/src/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp @@ -124,30 +124,27 @@ CFX_WideString CBC_PDF417HighLevelEncoder::encodeHighLevel( } return sb; } + void CBC_PDF417HighLevelEncoder::Inverse() { - uint8_t i = 0; - int32_t l = 0; - for (l = 0; l < sizeof(MIXED) / sizeof(MIXED[0]); l++) { + for (size_t l = 0; l < FX_ArraySize(MIXED); ++l) MIXED[l] = -1; - } - for (i = 0; i < sizeof(TEXT_MIXED_RAW) / sizeof(TEXT_MIXED_RAW[0]); i++) { + + for (uint8_t i = 0; i < FX_ArraySize(TEXT_MIXED_RAW); ++i) { uint8_t b = TEXT_MIXED_RAW[i]; - if (b > 0) { + if (b != 0) MIXED[b] = i; - } } - for (l = 0; l < sizeof(PUNCTUATION) / sizeof(PUNCTUATION[0]); l++) { + + for (size_t l = 0; l < FX_ArraySize(PUNCTUATION); ++l) PUNCTUATION[l] = -1; - } - for (i = 0; - i < sizeof(TEXT_PUNCTUATION_RAW) / sizeof(TEXT_PUNCTUATION_RAW[0]); - i++) { + + for (uint8_t i = 0; i < FX_ArraySize(TEXT_PUNCTUATION_RAW); ++i) { uint8_t b = TEXT_PUNCTUATION_RAW[i]; - if (b > 0) { + if (b != 0) PUNCTUATION[b] = i; - } } } + int32_t CBC_PDF417HighLevelEncoder::encodeText(CFX_WideString msg, int32_t startpos, int32_t count, |