Constify data and put it into the .rodata section

This commit is contained in:
Milian Wolff 2017-01-10 12:00:19 +01:00
parent bb903ca27e
commit 4c22c65b5e
1 changed files with 5 additions and 5 deletions

View File

@ -37,7 +37,7 @@ using zxing::oned::Code39Reader;
using zxing::BitArray; using zxing::BitArray;
namespace { namespace {
const char* ALPHABET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"; const char ALPHABET[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%";
/** /**
* These represent the encodings of characters, as patterns of wide and narrow * These represent the encodings of characters, as patterns of wide and narrow
@ -46,7 +46,7 @@ namespace {
* and narrow, with 1s representing "wide" and 0s representing narrow. * and narrow, with 1s representing "wide" and 0s representing narrow.
*/ */
const int CHARACTER_ENCODINGS_LEN = 44; const int CHARACTER_ENCODINGS_LEN = 44;
int CHARACTER_ENCODINGS[CHARACTER_ENCODINGS_LEN] = { const int CHARACTER_ENCODINGS[CHARACTER_ENCODINGS_LEN] = {
0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, // 0-9 0x034, 0x121, 0x061, 0x160, 0x031, 0x130, 0x070, 0x025, 0x124, 0x064, // 0-9
0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, // A-J 0x109, 0x049, 0x148, 0x019, 0x118, 0x058, 0x00D, 0x10C, 0x04C, 0x01C, // A-J
0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, // K-T 0x103, 0x043, 0x142, 0x013, 0x112, 0x052, 0x007, 0x106, 0x046, 0x016, // K-T
@ -54,11 +54,11 @@ namespace {
0x0A8, 0x0A2, 0x08A, 0x02A // $-% 0x0A8, 0x0A2, 0x08A, 0x02A // $-%
}; };
int ASTERISK_ENCODING = 0x094; const int ASTERISK_ENCODING = 0x094;
const char* ALPHABET_STRING = const char ALPHABET_STRING[] =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%"; "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. *$/+%";
std::string alphabet_string (ALPHABET_STRING); const std::string alphabet_string (ALPHABET_STRING);
} }
void Code39Reader::init(bool usingCheckDigit_, bool extendedMode_) { void Code39Reader::init(bool usingCheckDigit_, bool extendedMode_) {