summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-02-25 14:12:52 -0500
committerDan Sinclair <dsinclair@chromium.org>2016-02-25 14:12:52 -0500
commitf014768833406e68234eeb4f8ba94cabf766dff3 (patch)
treefd07894bc8d8736998ef02ddf4809153270abeb1
parenta3f220934a9f8325b00aba927ebc508d34a4de6f (diff)
downloadpdfium-f014768833406e68234eeb4f8ba94cabf766dff3.tar.xz
Replace various *_MAX_VALUE macros with numeric_limits.
R=thestig@chromium.org Review URL: https://codereview.chromium.org/1740783002 .
-rw-r--r--xfa/src/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp9
-rw-r--r--xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp5
-rw-r--r--xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp10
3 files changed, 13 insertions, 11 deletions
diff --git a/xfa/src/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/xfa/src/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
index 3173c9c594..21e1b6bb51 100644
--- a/xfa/src/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
+++ b/xfa/src/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
@@ -20,6 +20,8 @@
* limitations under the License.
*/
+#include <limits>
+
#include "xfa/src/fxbarcode/BC_Dimension.h"
#include "xfa/src/fxbarcode/BC_UtilCodingConvert.h"
#include "xfa/src/fxbarcode/common/BC_CommonBitMatrix.h"
@@ -36,8 +38,6 @@
#include "xfa/src/fxbarcode/datamatrix/BC_X12Encoder.h"
#include "xfa/src/fxbarcode/utils.h"
-#define Integer_MAX_VALUE 2147483647
-
FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_C40 = 230;
FX_WCHAR CBC_HighLevelEncoder::LATCH_TO_BASE256 = 231;
FX_WCHAR CBC_HighLevelEncoder::UPPER_SHIFT = 235;
@@ -166,7 +166,7 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg,
int32_t charsProcessed = 0;
while (TRUE) {
if ((startpos + charsProcessed) == msg.GetLength()) {
- FX_DWORD min = Integer_MAX_VALUE;
+ FX_DWORD min = std::numeric_limits<int32_t>::max();
CFX_ByteArray mins;
mins.SetSize(6);
CFX_Int32Array intCharCounts;
@@ -241,7 +241,8 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg,
intCharCounts.SetSize(6);
CFX_ByteArray mins;
mins.SetSize(6);
- findMinimums(charCounts, intCharCounts, Integer_MAX_VALUE, mins);
+ findMinimums(charCounts, intCharCounts,
+ std::numeric_limits<int32_t>::max(), mins);
int32_t minCount = getMinimumCount(mins);
if (intCharCounts[ASCII_ENCODATION] < intCharCounts[BASE256_ENCODATION] &&
intCharCounts[ASCII_ENCODATION] < intCharCounts[C40_ENCODATION] &&
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp
index 8bb2c1ebc8..ea1e38765a 100644
--- a/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp
+++ b/xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.cpp
@@ -20,11 +20,12 @@
* limitations under the License.
*/
+#include <limits>
+
#include "xfa/src/fxbarcode/pdf417/BC_PDF417CodewordDecoder.h"
#include "xfa/src/fxbarcode/pdf417/BC_PDF417Common.h"
#define SYMBOL_TABLE_Length 2787
-#define Float_MAX_VALUE 2147483647
FX_FLOAT CBC_PDF417CodewordDecoder::RATIOS_TABLE[2787][8] = {{0}};
@@ -99,7 +100,7 @@ int32_t CBC_PDF417CodewordDecoder::getClosestDecodedValue(
for (int32_t i = 0; i < bitCountRatios.GetSize(); i++) {
bitCountRatios[i] = moduleBitCount.GetAt(i) / (FX_FLOAT)bitCountSum;
}
- FX_FLOAT bestMatchError = (FX_FLOAT)Float_MAX_VALUE;
+ FX_FLOAT bestMatchError = std::numeric_limits<int32_t>::max();
int32_t bestMatch = -1;
for (int32_t j = 0; j < SYMBOL_TABLE_Length; j++) {
FX_FLOAT error = 0.0f;
diff --git a/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp b/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp
index 7e5d0d8851..6365e27efb 100644
--- a/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp
+++ b/xfa/src/fxbarcode/pdf417/BC_PDF417Reader.cpp
@@ -20,6 +20,8 @@
* limitations under the License.
*/
+#include <limits>
+
#include "xfa/src/fxbarcode/BC_BinaryBitmap.h"
#include "xfa/src/fxbarcode/BC_BinaryBitmap.h"
#include "xfa/src/fxbarcode/BC_DecoderResult.h"
@@ -51,10 +53,9 @@
#include "xfa/src/fxbarcode/pdf417/BC_PDF417ScanningDecoder.h"
#include "xfa/src/fxbarcode/utils.h"
-#define Integer_MAX_VALUE 2147483647
-
CBC_PDF417Reader::CBC_PDF417Reader() {}
CBC_PDF417Reader::~CBC_PDF417Reader() {}
+
CFX_ByteString CBC_PDF417Reader::Decode(CBC_BinaryBitmap* image, int32_t& e) {
return Decode(image, 0, e);
}
@@ -100,9 +101,8 @@ int32_t CBC_PDF417Reader::getMaxWidth(CBC_ResultPoint* p1,
}
int32_t CBC_PDF417Reader::getMinWidth(CBC_ResultPoint* p1,
CBC_ResultPoint* p2) {
- if (p1 == NULL || p2 == NULL) {
- return Integer_MAX_VALUE;
- }
+ if (!p1 || !p2)
+ return std::numeric_limits<int32_t>::max();
return (int32_t)FXSYS_fabs(p1->GetX() - p2->GetX());
}
int32_t CBC_PDF417Reader::getMaxCodewordWidth(CFX_PtrArray& p) {