diff options
author | Lei Zhang <thestig@chromium.org> | 2018-01-12 21:49:50 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-12 21:49:50 +0000 |
commit | 53c4ba4011ab59ecc8406e144df8aaaa1169801b (patch) | |
tree | e35e5a2e9ae3dbc9e57d2ad28ded618e23019988 /fxbarcode/oned | |
parent | 14e77443e92ce3fdf1cebe85f8f5c8fe705a1558 (diff) | |
download | pdfium-53c4ba4011ab59ecc8406e144df8aaaa1169801b.tar.xz |
Add jumbo build support for fxbarcode.
BUG=pdfium:964
Change-Id: Ic306a374bc9b710e2ac043eebe43504e5bd75926
Reviewed-on: https://pdfium-review.googlesource.com/22870
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fxbarcode/oned')
-rw-r--r-- | fxbarcode/oned/BC_OnedCodaBarWriter.cpp | 10 | ||||
-rw-r--r-- | fxbarcode/oned/BC_OnedCode39Writer.cpp | 28 | ||||
-rw-r--r-- | fxbarcode/oned/BC_OnedEAN13Writer.cpp | 20 | ||||
-rw-r--r-- | fxbarcode/oned/BC_OnedEAN8Writer.cpp | 16 |
4 files changed, 38 insertions, 36 deletions
diff --git a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp index 791904de5b..3c3ea4afe8 100644 --- a/fxbarcode/oned/BC_OnedCodaBarWriter.cpp +++ b/fxbarcode/oned/BC_OnedCodaBarWriter.cpp @@ -30,9 +30,9 @@ namespace { -const char ALPHABET_STRING[] = "0123456789-$:/.+ABCDTN"; +const char kOnedCodaAlphabet[] = "0123456789-$:/.+ABCDTN"; -const int32_t CHARACTER_ENCODINGS[22] = { +const int32_t kOnedCodaCharacterEncoding[22] = { 0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024, 0x030, 0x048, 0x00c, 0x018, 0x045, 0x051, 0x054, 0x015, 0x01A, 0x029, 0x00B, 0x00E, 0x01A, 0x029}; @@ -158,10 +158,10 @@ uint8_t* CBC_OnedCodaBarWriter::EncodeImpl(const ByteString& contents, break; } int32_t code = 0; - size_t len = strlen(ALPHABET_STRING); + size_t len = strlen(kOnedCodaAlphabet); for (size_t i = 0; i < len; i++) { - if (ch == ALPHABET_STRING[i]) { - code = CHARACTER_ENCODINGS[i]; + if (ch == kOnedCodaAlphabet[i]) { + code = kOnedCodaCharacterEncoding[i]; break; } } diff --git a/fxbarcode/oned/BC_OnedCode39Writer.cpp b/fxbarcode/oned/BC_OnedCode39Writer.cpp index 4f25eb1570..f26ebc193c 100644 --- a/fxbarcode/oned/BC_OnedCode39Writer.cpp +++ b/fxbarcode/oned/BC_OnedCode39Writer.cpp @@ -30,11 +30,13 @@ namespace { -const char ALPHABET_STRING[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"; +const char kOnedCode39Alphabet[] = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"; -const char CHECKSUM_STRING[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; +const char kOnedCode39Checksum[] = + "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%"; -const int32_t CHARACTER_ENCODINGS[44] = { +const int32_t kOnedCode39CharacterEncoding[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, @@ -141,11 +143,11 @@ char CBC_OnedCode39Writer::CalcCheckSum(const ByteString& contents) { return '*'; int32_t checksum = 0; - size_t len = strlen(ALPHABET_STRING); + size_t len = strlen(kOnedCode39Alphabet); for (const auto& c : contents) { size_t j = 0; for (; j < len; j++) { - if (ALPHABET_STRING[j] == c) { + if (kOnedCode39Alphabet[j] == c) { if (c != '*') checksum += j; break; @@ -155,7 +157,7 @@ char CBC_OnedCode39Writer::CalcCheckSum(const ByteString& contents) { return '*'; } checksum = checksum % 43; - return CHECKSUM_STRING[checksum]; + return kOnedCode39Checksum[checksum]; } uint8_t* CBC_OnedCode39Writer::EncodeImpl(const ByteString& contents, @@ -173,20 +175,20 @@ uint8_t* CBC_OnedCode39Writer::EncodeImpl(const ByteString& contents, m_iContentLen = encodedContents.GetLength(); int32_t codeWidth = (wideStrideNum * m_iWideNarrRatio + narrStrideNum) * 2 + 1 + m_iContentLen; - size_t len = strlen(ALPHABET_STRING); + size_t len = strlen(kOnedCode39Alphabet); for (size_t j = 0; j < m_iContentLen; j++) { for (size_t i = 0; i < len; i++) { - if (ALPHABET_STRING[i] != encodedContents[j]) + if (kOnedCode39Alphabet[i] != encodedContents[j]) continue; - ToIntArray(CHARACTER_ENCODINGS[i], widths); + ToIntArray(kOnedCode39CharacterEncoding[i], widths); for (size_t k = 0; k < 9; k++) codeWidth += widths[k]; } } outlength = codeWidth; std::unique_ptr<uint8_t, FxFreeDeleter> result(FX_Alloc(uint8_t, codeWidth)); - ToIntArray(CHARACTER_ENCODINGS[39], widths); + ToIntArray(kOnedCode39CharacterEncoding[39], widths); int32_t e = BCExceptionNO; int32_t pos = AppendPattern(result.get(), 0, widths, 9, 1, e); if (e != BCExceptionNO) @@ -199,10 +201,10 @@ uint8_t* CBC_OnedCode39Writer::EncodeImpl(const ByteString& contents, for (int32_t l = m_iContentLen - 1; l >= 0; l--) { for (size_t i = 0; i < len; i++) { - if (ALPHABET_STRING[i] != encodedContents[l]) + if (kOnedCode39Alphabet[i] != encodedContents[l]) continue; - ToIntArray(CHARACTER_ENCODINGS[i], widths); + ToIntArray(kOnedCode39CharacterEncoding[i], widths); pos += AppendPattern(result.get(), pos, widths, 9, 1, e); if (e != BCExceptionNO) return nullptr; @@ -211,7 +213,7 @@ uint8_t* CBC_OnedCode39Writer::EncodeImpl(const ByteString& contents, if (e != BCExceptionNO) return nullptr; } - ToIntArray(CHARACTER_ENCODINGS[39], widths); + ToIntArray(kOnedCode39CharacterEncoding[39], widths); pos += AppendPattern(result.get(), pos, widths, 9, 1, e); if (e != BCExceptionNO) return nullptr; diff --git a/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/fxbarcode/oned/BC_OnedEAN13Writer.cpp index daf53a8b7b..a6315bcdbb 100644 --- a/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -35,11 +35,11 @@ namespace { -const int8_t FIRST_DIGIT_ENCODINGS[10] = {0x00, 0x0B, 0x0D, 0xE, 0x13, - 0x19, 0x1C, 0x15, 0x16, 0x1A}; -const int8_t START_END_PATTERN[3] = {1, 1, 1}; -const int8_t MIDDLE_PATTERN[5] = {1, 1, 1, 1, 1}; -const int8_t L_PATTERNS[10][4] = { +const int8_t kFirstDigitEncodings[10] = {0x00, 0x0B, 0x0D, 0xE, 0x13, + 0x19, 0x1C, 0x15, 0x16, 0x1A}; +const int8_t kOnedEAN13StartPattern[3] = {1, 1, 1}; +const int8_t kOnedEAN13MiddlePattern[5] = {1, 1, 1, 1, 1}; +const int8_t kOnedEAN13LPattern[10][4] = { {3, 2, 1, 1}, {2, 2, 2, 1}, {2, 1, 2, 2}, {1, 4, 1, 1}, {1, 1, 3, 2}, {1, 2, 3, 1}, {1, 1, 1, 4}, {1, 3, 1, 2}, {1, 2, 1, 3}, {3, 1, 1, 2}}; const int8_t L_AND_G_PATTERNS[20][4] = { @@ -98,13 +98,13 @@ uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const ByteString& contents, m_iDataLenth = 13; int32_t firstDigit = FXSYS_DecimalCharToInt(contents.First()); - int32_t parities = FIRST_DIGIT_ENCODINGS[firstDigit]; + int32_t parities = kFirstDigitEncodings[firstDigit]; outLength = m_codeWidth; std::unique_ptr<uint8_t, FxFreeDeleter> result( FX_Alloc(uint8_t, m_codeWidth)); int32_t pos = 0; int32_t e = BCExceptionNO; - pos += AppendPattern(result.get(), pos, START_END_PATTERN, 3, 1, e); + pos += AppendPattern(result.get(), pos, kOnedEAN13StartPattern, 3, 1, e); if (e != BCExceptionNO) return nullptr; @@ -118,17 +118,17 @@ uint8_t* CBC_OnedEAN13Writer::EncodeImpl(const ByteString& contents, if (e != BCExceptionNO) return nullptr; } - pos += AppendPattern(result.get(), pos, MIDDLE_PATTERN, 5, 0, e); + pos += AppendPattern(result.get(), pos, kOnedEAN13MiddlePattern, 5, 0, e); if (e != BCExceptionNO) return nullptr; for (i = 7; i <= 12; i++) { int32_t digit = FXSYS_DecimalCharToInt(contents[i]); - pos += AppendPattern(result.get(), pos, L_PATTERNS[digit], 4, 1, e); + pos += AppendPattern(result.get(), pos, kOnedEAN13LPattern[digit], 4, 1, e); if (e != BCExceptionNO) return nullptr; } - pos += AppendPattern(result.get(), pos, START_END_PATTERN, 3, 1, e); + pos += AppendPattern(result.get(), pos, kOnedEAN13StartPattern, 3, 1, e); if (e != BCExceptionNO) return nullptr; return result.release(); diff --git a/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/fxbarcode/oned/BC_OnedEAN8Writer.cpp index 865979c396..988528ed09 100644 --- a/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -36,9 +36,9 @@ namespace { -const int8_t START_END_PATTERN[3] = {1, 1, 1}; -const int8_t MIDDLE_PATTERN[5] = {1, 1, 1, 1, 1}; -const int8_t L_PATTERNS[10][4] = { +const int8_t kOnedEAN8StartPattern[3] = {1, 1, 1}; +const int8_t kOnedEAN8MiddlePattern[5] = {1, 1, 1, 1, 1}; +const int8_t kOnedEAN8LPattern[10][4] = { {3, 2, 1, 1}, {2, 2, 2, 1}, {2, 1, 2, 2}, {1, 4, 1, 1}, {1, 1, 3, 2}, {1, 2, 3, 1}, {1, 1, 1, 4}, {1, 3, 1, 2}, {1, 2, 1, 3}, {3, 1, 1, 2}}; @@ -108,28 +108,28 @@ uint8_t* CBC_OnedEAN8Writer::EncodeImpl(const ByteString& contents, FX_Alloc(uint8_t, m_codeWidth)); int32_t pos = 0; int32_t e = BCExceptionNO; - pos += AppendPattern(result.get(), pos, START_END_PATTERN, 3, 1, e); + pos += AppendPattern(result.get(), pos, kOnedEAN8StartPattern, 3, 1, e); if (e != BCExceptionNO) return nullptr; int32_t i = 0; for (i = 0; i <= 3; i++) { int32_t digit = FXSYS_DecimalCharToInt(contents[i]); - pos += AppendPattern(result.get(), pos, L_PATTERNS[digit], 4, 0, e); + pos += AppendPattern(result.get(), pos, kOnedEAN8LPattern[digit], 4, 0, e); if (e != BCExceptionNO) return nullptr; } - pos += AppendPattern(result.get(), pos, MIDDLE_PATTERN, 5, 0, e); + pos += AppendPattern(result.get(), pos, kOnedEAN8MiddlePattern, 5, 0, e); if (e != BCExceptionNO) return nullptr; for (i = 4; i <= 7; i++) { int32_t digit = FXSYS_DecimalCharToInt(contents[i]); - pos += AppendPattern(result.get(), pos, L_PATTERNS[digit], 4, 1, e); + pos += AppendPattern(result.get(), pos, kOnedEAN8LPattern[digit], 4, 1, e); if (e != BCExceptionNO) return nullptr; } - pos += AppendPattern(result.get(), pos, START_END_PATTERN, 3, 1, e); + pos += AppendPattern(result.get(), pos, kOnedEAN8StartPattern, 3, 1, e); if (e != BCExceptionNO) return nullptr; return result.release(); |