diff options
-rw-r--r-- | test/barcode_test.pdf | bin | 0 -> 80879 bytes | |||
-rw-r--r-- | xfa/include/foxitxfa.h | 1 | ||||
-rw-r--r-- | xfa/src/fxbarcode/src/BC_PDF417DecodedBitStreamParser.cpp | 16 | ||||
-rw-r--r-- | xfa/src/fxbarcode/src/BC_PDF417HighLevelEncoder.cpp | 17 | ||||
-rw-r--r-- | xfa/src/fxbarcode/src/include/BC_PDF417DecodedBitStreamParser.h | 1 |
5 files changed, 14 insertions, 21 deletions
diff --git a/test/barcode_test.pdf b/test/barcode_test.pdf Binary files differnew file mode 100644 index 0000000000..8454cd0752 --- /dev/null +++ b/test/barcode_test.pdf diff --git a/xfa/include/foxitxfa.h b/xfa/include/foxitxfa.h index 26ab6cd8f3..1c54e53722 100644 --- a/xfa/include/foxitxfa.h +++ b/xfa/include/foxitxfa.h @@ -17,4 +17,5 @@ #include "./fwl/fwl.h"
#include "./fxjse/fxjse.h"
#include "./fxfa/fxfa.h"
+#include "../../third_party/bigint/BigIntegerLibrary.hh"
#endif
diff --git a/xfa/src/fxbarcode/src/BC_PDF417DecodedBitStreamParser.cpp b/xfa/src/fxbarcode/src/BC_PDF417DecodedBitStreamParser.cpp index cf0a1490f4..b832ab94aa 100644 --- a/xfa/src/fxbarcode/src/BC_PDF417DecodedBitStreamParser.cpp +++ b/xfa/src/fxbarcode/src/BC_PDF417DecodedBitStreamParser.cpp @@ -18,8 +18,8 @@ #define BEGIN_MACRO_PDF417_OPTIONAL_FIELD 923
#define MACRO_PDF417_TERMINATOR 922
#define MODE_SHIFT_TO_BYTE_COMPACTION_MODE 913
+
FX_INT32 CBC_DecodedBitStreamPaser::MAX_NUMERIC_CODEWORDS = 15;
-FX_INT32 CBC_DecodedBitStreamPaser::EXP900[16] = {0};
FX_INT32 CBC_DecodedBitStreamPaser::NUMBER_OF_SEQUENCE_CODEWORDS = 2;
FX_INT32 CBC_DecodedBitStreamPaser::PL = 25;
FX_INT32 CBC_DecodedBitStreamPaser::LL = 27;
@@ -40,12 +40,6 @@ FX_CHAR CBC_DecodedBitStreamPaser::MIXED_CHARS[30] = { };
void CBC_DecodedBitStreamPaser::Initialize()
{
- EXP900[0] = 1;
- FX_INT32 nineHundred = 900;
- EXP900[1] = nineHundred;
- for (FX_INT32 i = 2; i < sizeof(EXP900) / sizeof(FX_INT32); i++) {
- EXP900[i] = EXP900[i - 1] * nineHundred;
- }
}
void CBC_DecodedBitStreamPaser::Finalize()
{
@@ -460,12 +454,12 @@ FX_INT32 CBC_DecodedBitStreamPaser::numericCompaction(CFX_Int32Array &codewords, }
CFX_ByteString CBC_DecodedBitStreamPaser::decodeBase900toBase10(CFX_Int32Array &codewords, FX_INT32 count, FX_INT32 &e)
{
- FX_INT32 result = 0;
+ BigInteger result = 0;
+ BigInteger nineHundred(900);
for (FX_INT32 i = 0; i < count; i++) {
- result += EXP900[count - i - 1] * codewords[i];
+ result = result * nineHundred + BigInteger(codewords[i]);
}
- CFX_ByteString resultString;
- resultString = resultString.FormatInteger(result);
+ CFX_ByteString resultString(bigIntegerToString(result).c_str());
if (resultString.GetAt(0) != '1') {
e = BCExceptionFormatInstance;
return ' ';
diff --git a/xfa/src/fxbarcode/src/BC_PDF417HighLevelEncoder.cpp b/xfa/src/fxbarcode/src/BC_PDF417HighLevelEncoder.cpp index ade6977a50..7b4701f21d 100644 --- a/xfa/src/fxbarcode/src/BC_PDF417HighLevelEncoder.cpp +++ b/xfa/src/fxbarcode/src/BC_PDF417HighLevelEncoder.cpp @@ -292,20 +292,19 @@ void CBC_PDF417HighLevelEncoder::encodeBinary(CFX_ByteArray* bytes, FX_INT32 sta void CBC_PDF417HighLevelEncoder::encodeNumeric(CFX_WideString msg, FX_INT32 startpos, FX_INT32 count, CFX_WideString &sb)
{
FX_INT32 idx = 0;
- CFX_WideString tmp;
- FX_INT32 num900 = 900;
- FX_INT32 num0 = 0;
+ BigInteger num900 = 900;
while (idx < count - 1) {
+ CFX_WideString tmp;
FX_INT32 len = 44 < count - idx ? 44 : count - idx;
- CFX_WideString part = (FX_WCHAR)'1' + msg.Mid(startpos + idx, len);
- FX_INT32 bigint = part.GetInteger();
+ CFX_ByteString part = ((FX_WCHAR)'1' + msg.Mid(startpos + idx, len)).UTF8Encode();
+ BigInteger bigint = stringToBigInteger(FX_LPCSTR(part));
do {
- FX_INT32 c = bigint % num900;
- tmp += (FX_WCHAR) (c);
+ FX_INT32 c = (bigint % num900).toInt();
+ tmp += (FX_WCHAR)(c);
bigint = bigint / num900;
- } while (bigint != num0);
+ } while (!bigint.isZero());
for (FX_INT32 i = tmp.GetLength() - 1; i >= 0; i--) {
- sb += (tmp.GetAt(i));
+ sb += tmp.GetAt(i);
}
idx += len;
}
diff --git a/xfa/src/fxbarcode/src/include/BC_PDF417DecodedBitStreamParser.h b/xfa/src/fxbarcode/src/include/BC_PDF417DecodedBitStreamParser.h index a612769106..64ae2aee53 100644 --- a/xfa/src/fxbarcode/src/include/BC_PDF417DecodedBitStreamParser.h +++ b/xfa/src/fxbarcode/src/include/BC_PDF417DecodedBitStreamParser.h @@ -37,7 +37,6 @@ private: static FX_INT32 PAL;
static FX_CHAR PUNCT_CHARS[29];
static FX_CHAR MIXED_CHARS[30];
- static FX_INT32 EXP900[16];
static FX_INT32 NUMBER_OF_SEQUENCE_CODEWORDS;
static FX_INT32 decodeMacroBlock(CFX_Int32Array &codewords, FX_INT32 codeIndex, CBC_PDF417ResultMetadata* resultMetadata, FX_INT32 &e);
static FX_INT32 textCompaction(CFX_Int32Array &codewords, FX_INT32 codeIndex, CFX_ByteString &result);
|