From 0bc02c152bd0c178a5946196e2054a5cdc7650f4 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 26 Feb 2018 21:02:52 +0000 Subject: Add some more missing consts. Get things out of the .data section. Change-Id: I375cf00186a3d5d8d10f5d147bd4b692f5db3683 Reviewed-on: https://pdfium-review.googlesource.com/27130 Commit-Queue: Tom Sepez Reviewed-by: dsinclair --- fxbarcode/datamatrix/BC_ErrorCorrection.cpp | 2 +- fxbarcode/datamatrix/BC_ErrorCorrection.h | 4 ++-- fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp | 23 ++++++++++++----------- fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h | 24 +++++++++++++----------- 4 files changed, 28 insertions(+), 25 deletions(-) (limited to 'fxbarcode') diff --git a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp index 35077ee628..83442645e4 100644 --- a/fxbarcode/datamatrix/BC_ErrorCorrection.cpp +++ b/fxbarcode/datamatrix/BC_ErrorCorrection.cpp @@ -102,9 +102,9 @@ const uint8_t* const FACTORS[16] = { } // namespace -int32_t CBC_ErrorCorrection::MODULO_VALUE = 0x12D; int32_t CBC_ErrorCorrection::LOG[256] = {0}; int32_t CBC_ErrorCorrection::ALOG[256] = {0}; + void CBC_ErrorCorrection::Initialize() { int32_t p = 1; for (int32_t i = 0; i < 255; i++) { diff --git a/fxbarcode/datamatrix/BC_ErrorCorrection.h b/fxbarcode/datamatrix/BC_ErrorCorrection.h index 361b205ef4..ccb83f0b86 100644 --- a/fxbarcode/datamatrix/BC_ErrorCorrection.h +++ b/fxbarcode/datamatrix/BC_ErrorCorrection.h @@ -23,11 +23,11 @@ class CBC_ErrorCorrection { int32_t& e); private: - static int32_t MODULO_VALUE; + static const int32_t MODULO_VALUE = 0x12D; + static int32_t LOG[256]; static int32_t ALOG[256]; - private: static WideString createECCBlock(WideString codewords, int32_t numECWords, int32_t& e); diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp index 059287a665..ffc057a5f6 100644 --- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp +++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.cpp @@ -31,21 +31,22 @@ #define SUBMODE_LOWER 1 #define SUBMODE_MIXED 2 -int32_t CBC_PDF417HighLevelEncoder::TEXT_COMPACTION = 0; -int32_t CBC_PDF417HighLevelEncoder::BYTE_COMPACTION = 1; -int32_t CBC_PDF417HighLevelEncoder::NUMERIC_COMPACTION = 2; -int32_t CBC_PDF417HighLevelEncoder::SUBMODE_PUNCTUATION = 3; -int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_TEXT = 900; -int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE_PADDED = 901; -int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_NUMERIC = 902; -int32_t CBC_PDF417HighLevelEncoder::SHIFT_TO_BYTE = 913; -int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE = 924; -uint8_t CBC_PDF417HighLevelEncoder::TEXT_MIXED_RAW[] = { +const int32_t CBC_PDF417HighLevelEncoder::TEXT_COMPACTION = 0; +const int32_t CBC_PDF417HighLevelEncoder::BYTE_COMPACTION = 1; +const int32_t CBC_PDF417HighLevelEncoder::NUMERIC_COMPACTION = 2; +const int32_t CBC_PDF417HighLevelEncoder::SUBMODE_PUNCTUATION = 3; +const int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_TEXT = 900; +const int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE_PADDED = 901; +const int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_NUMERIC = 902; +const int32_t CBC_PDF417HighLevelEncoder::SHIFT_TO_BYTE = 913; +const int32_t CBC_PDF417HighLevelEncoder::LATCH_TO_BYTE = 924; +const uint8_t CBC_PDF417HighLevelEncoder::TEXT_MIXED_RAW[] = { 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 38, 13, 9, 44, 58, 35, 45, 46, 36, 47, 43, 37, 42, 61, 94, 0, 32, 0, 0, 0}; -uint8_t CBC_PDF417HighLevelEncoder::TEXT_PUNCTUATION_RAW[] = { +const uint8_t CBC_PDF417HighLevelEncoder::TEXT_PUNCTUATION_RAW[] = { 59, 60, 62, 64, 91, 92, 93, 95, 96, 126, 33, 13, 9, 44, 58, 10, 45, 46, 36, 47, 34, 124, 42, 40, 41, 63, 123, 125, 39, 0}; + int32_t CBC_PDF417HighLevelEncoder::MIXED[128] = {0}; int32_t CBC_PDF417HighLevelEncoder::PUNCTUATION[128] = {0}; diff --git a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h index 2701c810fb..5e0ab52961 100644 --- a/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h +++ b/fxbarcode/pdf417/BC_PDF417HighLevelEncoder.h @@ -22,19 +22,21 @@ class CBC_PDF417HighLevelEncoder { static void Finalize(); private: - static int32_t TEXT_COMPACTION; - static int32_t BYTE_COMPACTION; - static int32_t NUMERIC_COMPACTION; - static int32_t SUBMODE_PUNCTUATION; - static int32_t LATCH_TO_TEXT; - static int32_t LATCH_TO_BYTE_PADDED; - static int32_t LATCH_TO_NUMERIC; - static int32_t SHIFT_TO_BYTE; - static int32_t LATCH_TO_BYTE; - static uint8_t TEXT_MIXED_RAW[]; - static uint8_t TEXT_PUNCTUATION_RAW[]; + static const int32_t TEXT_COMPACTION; + static const int32_t BYTE_COMPACTION; + static const int32_t NUMERIC_COMPACTION; + static const int32_t SUBMODE_PUNCTUATION; + static const int32_t LATCH_TO_TEXT; + static const int32_t LATCH_TO_BYTE_PADDED; + static const int32_t LATCH_TO_NUMERIC; + static const int32_t SHIFT_TO_BYTE; + static const int32_t LATCH_TO_BYTE; + static const uint8_t TEXT_MIXED_RAW[]; + static const uint8_t TEXT_PUNCTUATION_RAW[]; + static int32_t MIXED[128]; static int32_t PUNCTUATION[128]; + static int32_t encodeText(WideString msg, int32_t startpos, int32_t count, -- cgit v1.2.3