From 3e00ecd283f86852411115dc661a2b0a469cf908 Mon Sep 17 00:00:00 2001 From: rpechayr Date: Wed, 22 Dec 2010 17:31:16 +0000 Subject: [PATCH] [cpp] Minor Changes. Changed static members initialization into enum to make the code build with clang, and probably visual c++, removed some dead code detected by clang static analyzer git-svn-id: https://zxing.googlecode.com/svn/trunk@1689 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- cpp/core/src/zxing/common/BitMatrix.cpp | 2 +- cpp/core/src/zxing/oned/Code128Reader.h | 7 ++++--- cpp/core/src/zxing/oned/ITFReader.h | 7 ++++--- cpp/core/src/zxing/oned/UPCEANReader.h | 6 ++++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/cpp/core/src/zxing/common/BitMatrix.cpp b/cpp/core/src/zxing/common/BitMatrix.cpp index afb5d42e3..c3e9f1ab9 100644 --- a/cpp/core/src/zxing/common/BitMatrix.cpp +++ b/cpp/core/src/zxing/common/BitMatrix.cpp @@ -91,7 +91,7 @@ void BitMatrix::clear() { } void BitMatrix::setRegion(size_t left, size_t top, size_t width, size_t height) { - if (top < 0 || left < 0) { + if ((long)top < 0 || (long)left < 0) { throw IllegalArgumentException("topI and leftJ must be nonnegative"); } if (height < 1 || width < 1) { diff --git a/cpp/core/src/zxing/oned/Code128Reader.h b/cpp/core/src/zxing/oned/Code128Reader.h index ee8bf9661..b0bf5d103 100644 --- a/cpp/core/src/zxing/oned/Code128Reader.h +++ b/cpp/core/src/zxing/oned/Code128Reader.h @@ -28,9 +28,10 @@ namespace zxing { class Code128Reader : public OneDReader { private: - static const unsigned int MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.25f); - static const int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f); - + //static const unsigned int MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.25f); + enum {MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.25f)}; + //static const int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f); + enum {MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f)}; static const int CODE_SHIFT = 98; static const int CODE_CODE_C = 99; diff --git a/cpp/core/src/zxing/oned/ITFReader.h b/cpp/core/src/zxing/oned/ITFReader.h index ba3054d0d..81ebd0bf6 100644 --- a/cpp/core/src/zxing/oned/ITFReader.h +++ b/cpp/core/src/zxing/oned/ITFReader.h @@ -29,9 +29,10 @@ namespace zxing { class ITFReader : public OneDReader { private: - static const unsigned int MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f); - static const int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.8f); - + //static const unsigned int MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f); + enum {MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f)}; + //static const int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.8f); + enum {MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.8f)}; // Stores the actual narrow line width of the image being decoded. int narrowLineWidth; diff --git a/cpp/core/src/zxing/oned/UPCEANReader.h b/cpp/core/src/zxing/oned/UPCEANReader.h index 2584b26bb..9773de09a 100644 --- a/cpp/core/src/zxing/oned/UPCEANReader.h +++ b/cpp/core/src/zxing/oned/UPCEANReader.h @@ -34,8 +34,10 @@ namespace zxing { class UPCEANReader : public OneDReader { private: - static const unsigned int MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f); - static const int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f); + //static const unsigned int MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f); + enum {MAX_AVG_VARIANCE = (unsigned int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.42f)}; + //static const int MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f); + enum {MAX_INDIVIDUAL_VARIANCE = (int) (PATTERN_MATCH_RESULT_SCALE_FACTOR * 0.7f)}; static bool findStartGuardPattern(Ref row, int* rangeStart, int* rangeEnd);