summaryrefslogtreecommitdiff
path: root/xfa/src/fxbarcode/oned
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/src/fxbarcode/oned')
-rw-r--r--xfa/src/fxbarcode/oned/BC_OneDReader.cpp3
-rw-r--r--xfa/src/fxbarcode/oned/BC_OneDReader.h5
-rw-r--r--xfa/src/fxbarcode/oned/BC_OneDimReader.cpp2
-rw-r--r--xfa/src/fxbarcode/oned/BC_OneDimReader.h14
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp1
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.h10
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.h4
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp18
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedCode128Reader.h38
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedCode128Writer.h10
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedCode39Reader.h4
-rw-r--r--xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.h2
12 files changed, 48 insertions, 63 deletions
diff --git a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
index 76d05042da..9ecb20e671 100644
--- a/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OneDReader.cpp
@@ -29,9 +29,6 @@
#include "xfa/src/fxbarcode/oned/BC_OneDReader.h"
#include "xfa/src/fxbarcode/utils.h"
-const int32_t CBC_OneDReader::INTEGER_MATH_SHIFT = 8;
-const int32_t CBC_OneDReader::PATTERN_MATCH_RESULT_SCALE_FACTOR = 1 << 8;
-
CBC_OneDReader::CBC_OneDReader() {}
CBC_OneDReader::~CBC_OneDReader() {}
CFX_ByteString CBC_OneDReader::Decode(CBC_BinaryBitmap* image, int32_t& e) {
diff --git a/xfa/src/fxbarcode/oned/BC_OneDReader.h b/xfa/src/fxbarcode/oned/BC_OneDReader.h
index 27a1a3d7ee..bcd7cbc8b5 100644
--- a/xfa/src/fxbarcode/oned/BC_OneDReader.h
+++ b/xfa/src/fxbarcode/oned/BC_OneDReader.h
@@ -31,8 +31,9 @@ class CBC_OneDReader : public CBC_Reader {
CFX_ByteString DeDecode(CBC_BinaryBitmap* image, int32_t hints, int32_t& e);
protected:
- const static int32_t INTEGER_MATH_SHIFT;
- const static int32_t PATTERN_MATCH_RESULT_SCALE_FACTOR;
+ static const int32_t INTEGER_MATH_SHIFT = 8;
+ static const int32_t PATTERN_MATCH_RESULT_SCALE_FACTOR = 1 << 8;
+
void RecordPattern(CBC_CommonBitArray* row,
int32_t start,
CFX_Int32Array* counters,
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp b/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp
index da1f47bfe8..07b8657189 100644
--- a/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OneDimReader.cpp
@@ -29,8 +29,6 @@
#include "xfa/src/fxbarcode/oned/BC_OneDReader.h"
#include "xfa/src/fxbarcode/utils.h"
-const int32_t CBC_OneDimReader::MAX_AVG_VARIANCE = (int32_t)(256 * 0.48f);
-const int32_t CBC_OneDimReader::MAX_INDIVIDUAL_VARIANCE = (int32_t)(256 * 0.7f);
const int32_t CBC_OneDimReader::START_END_PATTERN[3] = {1, 1, 1};
const int32_t CBC_OneDimReader::MIDDLE_PATTERN[5] = {1, 1, 1, 1, 1};
const int32_t CBC_OneDimReader::L_PATTERNS[10][4] = {
diff --git a/xfa/src/fxbarcode/oned/BC_OneDimReader.h b/xfa/src/fxbarcode/oned/BC_OneDimReader.h
index 3374bec63a..9e5789afb9 100644
--- a/xfa/src/fxbarcode/oned/BC_OneDimReader.h
+++ b/xfa/src/fxbarcode/oned/BC_OneDimReader.h
@@ -14,18 +14,20 @@ class CBC_CommonBitArray;
class CBC_OneDimReader : public CBC_OneDReader {
private:
- const static int32_t MAX_AVG_VARIANCE;
- const static int32_t MAX_INDIVIDUAL_VARIANCE;
+ static const int32_t MAX_AVG_VARIANCE = (int32_t)(256 * 0.48f);
+ static const int32_t MAX_INDIVIDUAL_VARIANCE = (int32_t)(256 * 0.7f);
FX_BOOL CheckStandardUPCEANChecksum(CFX_ByteString& s, int32_t& e);
public:
- const static int32_t START_END_PATTERN[3];
- const static int32_t MIDDLE_PATTERN[5];
- const static int32_t L_PATTERNS[10][4];
- const static int32_t L_AND_G_PATTERNS[20][4];
+ static const int32_t START_END_PATTERN[3];
+ static const int32_t MIDDLE_PATTERN[5];
+ static const int32_t L_PATTERNS[10][4];
+ static const int32_t L_AND_G_PATTERNS[20][4];
+
CBC_OneDimReader();
virtual ~CBC_OneDimReader();
+
CFX_ByteString DecodeRow(int32_t rowNumber,
CBC_CommonBitArray* row,
int32_t hints,
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp
index 3cbad1eade..5d2d447efc 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.cpp
@@ -38,7 +38,6 @@ const int32_t CBC_OnedCodaBarReader::CHARACTER_ENCODINGS[22] = {
0x003, 0x006, 0x009, 0x060, 0x012, 0x042, 0x021, 0x024,
0x030, 0x048, 0x00c, 0x018, 0x045, 0x051, 0x054, 0x015,
0x01A, 0x029, 0x00B, 0x00E, 0x01A, 0x029};
-const int32_t CBC_OnedCodaBarReader::minCharacterLength = 3;
const FX_CHAR CBC_OnedCodaBarReader::STARTEND_ENCODING[8] = {
'E', '*', 'A', 'B', 'C', 'D', 'T', 'N'};
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.h b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.h
index cbb47fb554..49c136f4fd 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.h
+++ b/xfa/src/fxbarcode/oned/BC_OnedCodaBarReader.h
@@ -24,13 +24,13 @@ class CBC_OnedCodaBarReader : public CBC_OneDReader {
CFX_Int32Array* FindAsteriskPattern(CBC_CommonBitArray* row, int32_t& e);
FX_BOOL ArrayContains(const FX_CHAR array[], FX_CHAR key);
FX_CHAR ToNarrowWidePattern(CFX_Int32Array* counter);
- static const FX_CHAR* ALPHABET_STRING;
-
- const static int32_t CHARACTER_ENCODINGS[22];
- const static int32_t minCharacterLength;
+ static const FX_CHAR* ALPHABET_STRING;
+ static const int32_t CHARACTER_ENCODINGS[22];
- const static FX_CHAR STARTEND_ENCODING[8];
+ private:
+ static const int32_t minCharacterLength = 3;
+ static const FX_CHAR STARTEND_ENCODING[8];
};
#endif // XFA_SRC_FXBARCODE_ONED_BC_ONEDCODABARREADER_H_
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.h b/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.h
index 3671821bce..8f9ca5883d 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.h
+++ b/xfa/src/fxbarcode/oned/BC_OnedCodaBarWriter.h
@@ -44,8 +44,8 @@ class CBC_OnedCodaBarWriter : public CBC_OneDimWriter {
int32_t codeLength,
FX_BOOL isDevice,
int32_t& e);
- const static FX_CHAR START_END_CHARS[];
- const static FX_CHAR CONTENT_CHARS[];
+ static const FX_CHAR START_END_CHARS[];
+ static const FX_CHAR CONTENT_CHARS[];
FX_CHAR m_chStart;
FX_CHAR m_chEnd;
int32_t m_iWideNarrRatio;
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp
index 33be8c57d7..41a6ad1d05 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp
+++ b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.cpp
@@ -65,22 +65,7 @@ const int32_t CBC_OnedCode128Reader::CODE_PATTERNS[107][7] = {
{1, 1, 3, 1, 4, 1, 0}, {1, 1, 4, 1, 3, 1, 0}, {3, 1, 1, 1, 4, 1, 0},
{4, 1, 1, 1, 3, 1, 0}, {2, 1, 1, 4, 1, 2, 0}, {2, 1, 1, 2, 1, 4, 0},
{2, 1, 1, 2, 3, 2, 0}, {2, 3, 3, 1, 1, 1, 2}};
-const int32_t CBC_OnedCode128Reader::MAX_AVG_VARIANCE = (int32_t)(256 * 0.25f);
-const int32_t CBC_OnedCode128Reader::MAX_INDIVIDUAL_VARIANCE =
- (int32_t)(256 * 0.7f);
-const int32_t CBC_OnedCode128Reader::CODE_SHIFT = 98;
-const int32_t CBC_OnedCode128Reader::CODE_CODE_C = 99;
-const int32_t CBC_OnedCode128Reader::CODE_CODE_B = 100;
-const int32_t CBC_OnedCode128Reader::CODE_CODE_A = 101;
-const int32_t CBC_OnedCode128Reader::CODE_FNC_1 = 102;
-const int32_t CBC_OnedCode128Reader::CODE_FNC_2 = 97;
-const int32_t CBC_OnedCode128Reader::CODE_FNC_3 = 96;
-const int32_t CBC_OnedCode128Reader::CODE_FNC_4_A = 101;
-const int32_t CBC_OnedCode128Reader::CODE_FNC_4_B = 100;
-const int32_t CBC_OnedCode128Reader::CODE_START_A = 103;
-const int32_t CBC_OnedCode128Reader::CODE_START_B = 104;
-const int32_t CBC_OnedCode128Reader::CODE_START_C = 105;
-const int32_t CBC_OnedCode128Reader::CODE_STOP = 106;
+
CBC_OnedCode128Reader::CBC_OnedCode128Reader() {}
CBC_OnedCode128Reader::~CBC_OnedCode128Reader() {}
CFX_Int32Array* CBC_OnedCode128Reader::FindStartPattern(CBC_CommonBitArray* row,
@@ -306,6 +291,7 @@ CFX_ByteString CBC_OnedCode128Reader::DecodeRow(int32_t rowNumber,
result += '0';
}
FX_CHAR temp[128];
+ // TODO(dsinclair): Should this be snprintf?
sprintf(temp, "%d", code);
result += temp;
} else {
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.h b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.h
index a99c0e89f8..1d2c6a1ce0 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.h
+++ b/xfa/src/fxbarcode/oned/BC_OnedCode128Reader.h
@@ -17,26 +17,28 @@ class CBC_OnedCode128Reader : public CBC_OneDReader {
CBC_CommonBitArray* row,
int32_t hints,
int32_t& e);
- const static int32_t CODE_PATTERNS[107][7];
- const static int32_t MAX_AVG_VARIANCE;
- const static int32_t MAX_INDIVIDUAL_VARIANCE;
-
- const static int32_t CODE_SHIFT;
- const static int32_t CODE_CODE_C;
- const static int32_t CODE_CODE_B;
- const static int32_t CODE_CODE_A;
- const static int32_t CODE_FNC_1;
- const static int32_t CODE_FNC_2;
- const static int32_t CODE_FNC_3;
- const static int32_t CODE_FNC_4_A;
- const static int32_t CODE_FNC_4_B;
-
- const static int32_t CODE_START_A;
- const static int32_t CODE_START_B;
- const static int32_t CODE_START_C;
- const static int32_t CODE_STOP;
+
+ static const int32_t CODE_PATTERNS[107][7];
private:
+ static const int32_t MAX_AVG_VARIANCE = (int32_t)(256 * 0.25f);
+ static const int32_t MAX_INDIVIDUAL_VARIANCE = (int32_t)(256 * 0.7f);
+
+ static const int32_t CODE_SHIFT = 98;
+ static const int32_t CODE_CODE_C = 99;
+ static const int32_t CODE_CODE_B = 100;
+ static const int32_t CODE_CODE_A = 101;
+ static const int32_t CODE_FNC_1 = 102;
+ static const int32_t CODE_FNC_2 = 97;
+ static const int32_t CODE_FNC_3 = 96;
+ static const int32_t CODE_FNC_4_A = 101;
+ static const int32_t CODE_FNC_4_B = 100;
+
+ static const int32_t CODE_START_A = 103;
+ static const int32_t CODE_START_B = 104;
+ static const int32_t CODE_START_C = 105;
+ static const int32_t CODE_STOP = 106;
+
CFX_Int32Array* FindStartPattern(CBC_CommonBitArray* row, int32_t& e);
int32_t DecodeCode(CBC_CommonBitArray* row,
CFX_Int32Array* counters,
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.h b/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.h
index 333d3c563b..1fbb02832b 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.h
+++ b/xfa/src/fxbarcode/oned/BC_OnedCode128Writer.h
@@ -39,11 +39,11 @@ class CBC_OnedCode128Writer : public CBC_OneDimWriter {
int32_t Encode128B(const CFX_ByteString& contents, CFX_PtrArray& patterns);
int32_t Encode128C(const CFX_ByteString& contents, CFX_PtrArray& patterns);
BC_TYPE m_codeFormat;
- const static int32_t CODE_START_B;
- const static int32_t CODE_START_C;
- const static int32_t CODE_CODE_B;
- const static int32_t CODE_CODE_C;
- const static int32_t CODE_STOP;
+ static const int32_t CODE_START_B;
+ static const int32_t CODE_START_C;
+ static const int32_t CODE_CODE_B;
+ static const int32_t CODE_CODE_C;
+ static const int32_t CODE_STOP;
};
#endif // XFA_SRC_FXBARCODE_ONED_BC_ONEDCODE128WRITER_H_
diff --git a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.h b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.h
index b3fa803cd7..b5573b1bdf 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.h
+++ b/xfa/src/fxbarcode/oned/BC_OnedCode39Reader.h
@@ -13,8 +13,8 @@ class CBC_OnedCode39Reader : public CBC_OneDReader {
public:
static const FX_CHAR* ALPHABET_STRING;
static const FX_CHAR* CHECKSUM_STRING;
- const static int32_t CHARACTER_ENCODINGS[44];
- const static int32_t ASTERISK_ENCODING;
+ static const int32_t CHARACTER_ENCODINGS[44];
+ static const int32_t ASTERISK_ENCODING;
CBC_OnedCode39Reader();
CBC_OnedCode39Reader(FX_BOOL usingCheckDigit);
CBC_OnedCode39Reader(FX_BOOL usingCheckDigit, FX_BOOL extendedMode);
diff --git a/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.h b/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.h
index cf9e647c85..795cc2fbde 100644
--- a/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.h
+++ b/xfa/src/fxbarcode/oned/BC_OnedEAN13Reader.h
@@ -11,7 +11,7 @@ class CBC_CommonBitArray;
class CBC_OnedEAN13Reader;
class CBC_OnedEAN13Reader : public CBC_OneDimReader {
public:
- const static int32_t FIRST_DIGIT_ENCODINGS[10];
+ static const int32_t FIRST_DIGIT_ENCODINGS[10];
CBC_OnedEAN13Reader();
virtual ~CBC_OnedEAN13Reader();