summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
authorweili <weili@chromium.org>2016-05-16 13:53:42 -0700
committerCommit bot <commit-bot@chromium.org>2016-05-16 13:53:42 -0700
commit3cc01f2ba255f4b7584668ee2b8e5ed97792c26d (patch)
tree6a207d8910696ef1c28ef60a855ae266f81067cd /xfa
parentc6450bb06b69528406a2a261c70c4ea769965a8d (diff)
downloadpdfium-3cc01f2ba255f4b7584668ee2b8e5ed97792c26d.tar.xz
Fix the code that causes warnings
These are the left or newly added code which causes compilation warnings of "signed and unsigned comparison". Need to fix them before I re-enable the warning flag. BUG=pdfium:29 Review-Url: https://codereview.chromium.org/1986533002
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fgas/localization/fgas_locale.cpp24
-rw-r--r--xfa/fgas/xml/fgas_sax.cpp2
-rw-r--r--xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp14
-rw-r--r--xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp2
4 files changed, 20 insertions, 22 deletions
diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp
index 851b687c4b..bb4fe93ba3 100644
--- a/xfa/fgas/localization/fgas_locale.cpp
+++ b/xfa/fgas/localization/fgas_locale.cpp
@@ -2304,12 +2304,12 @@ static FX_BOOL FX_ParseLocaleDate(const CFX_WideString& wsDate,
continue;
}
uint32_t dwSymbolNum = 1;
- uint32_t dwSymbol = strf[ccf++];
- while (ccf < lenf && strf[ccf] == dwSymbol) {
+ FX_WCHAR dwCharSymbol = strf[ccf++];
+ while (ccf < lenf && strf[ccf] == dwCharSymbol) {
ccf++;
dwSymbolNum++;
}
- dwSymbol = (dwSymbol << 8) | (dwSymbolNum + '0');
+ uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0');
if (dwSymbol == FXBSTR_ID(0, 0, 'D', '1')) {
if (!FX_IsDigit(str[cc])) {
return FALSE;
@@ -2523,12 +2523,12 @@ static FX_BOOL FX_ParseLocaleTime(const CFX_WideString& wsTime,
continue;
}
uint32_t dwSymbolNum = 1;
- uint32_t dwSymbol = strf[ccf++];
- while (ccf < lenf && strf[ccf] == dwSymbol) {
+ FX_WCHAR dwCharSymbol = strf[ccf++];
+ while (ccf < lenf && strf[ccf] == dwCharSymbol) {
ccf++;
dwSymbolNum++;
}
- dwSymbol = (dwSymbol << 8) | (dwSymbolNum + '0');
+ uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0');
if (dwSymbol == FXBSTR_ID(0, 0, 'k', '1') ||
dwSymbol == FXBSTR_ID(0, 0, 'H', '1') ||
dwSymbol == FXBSTR_ID(0, 0, 'h', '1') ||
@@ -3952,12 +3952,12 @@ static FX_BOOL FX_DateFormat(const CFX_WideString& wsDatePattern,
continue;
}
uint32_t dwSymbolNum = 1;
- uint32_t dwSymbol = strf[ccf++];
- while (ccf < lenf && strf[ccf] == dwSymbol) {
+ FX_WCHAR dwCharSymbol = strf[ccf++];
+ while (ccf < lenf && strf[ccf] == dwCharSymbol) {
ccf++;
dwSymbolNum++;
}
- dwSymbol = (dwSymbol << 8) | (dwSymbolNum + '0');
+ uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0');
if (dwSymbol == FXBSTR_ID(0, 0, 'D', '1')) {
CFX_WideString wsDay;
wsDay.Format(L"%d", day);
@@ -4079,12 +4079,12 @@ static FX_BOOL FX_TimeFormat(const CFX_WideString& wsTimePattern,
continue;
}
uint32_t dwSymbolNum = 1;
- uint32_t dwSymbol = strf[ccf++];
- while (ccf < lenf && strf[ccf] == dwSymbol) {
+ FX_WCHAR dwCharSymbol = strf[ccf++];
+ while (ccf < lenf && strf[ccf] == dwCharSymbol) {
ccf++;
dwSymbolNum++;
}
- dwSymbol = (dwSymbol << 8) | (dwSymbolNum + '0');
+ uint32_t dwSymbol = (dwCharSymbol << 8) | (dwSymbolNum + '0');
if (dwSymbol == FXBSTR_ID(0, 0, 'h', '1')) {
if (wHour > 12) {
wHour -= 12;
diff --git a/xfa/fgas/xml/fgas_sax.cpp b/xfa/fgas/xml/fgas_sax.cpp
index b97aeb0a7c..1128e1184f 100644
--- a/xfa/fgas/xml/fgas_sax.cpp
+++ b/xfa/fgas/xml/fgas_sax.cpp
@@ -32,7 +32,7 @@ FX_BOOL CFX_SAXFile::StartFile(IFX_FileRead* pFile,
if (dwStart >= dwSize) {
return FALSE;
}
- if (dwLen == -1 || dwStart + dwLen > dwSize) {
+ if (dwLen == static_cast<uint32_t>(-1) || dwStart + dwLen > dwSize) {
dwLen = dwSize - dwStart;
}
if (dwLen == 0) {
diff --git a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
index 1c20b7c8a1..8f54353d4a 100644
--- a/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_ErrorCorrection.cpp
@@ -172,14 +172,12 @@ CFX_WideString CBC_ErrorCorrection::createECCBlock(CFX_WideString codewords,
int32_t len,
int32_t numECWords,
int32_t& e) {
- int32_t table = -1;
- for (int32_t i = 0; i < sizeof(FACTOR_SETS) / sizeof(int32_t); i++) {
- if (FACTOR_SETS[i] == numECWords) {
- table = i;
- break;
- }
- }
- if (table < 0) {
+ static const size_t kFactorTableNum = sizeof(FACTOR_SETS) / sizeof(int32_t);
+ size_t table = 0;
+ while (table < kFactorTableNum && FACTOR_SETS[table] != numECWords)
+ table++;
+
+ if (table >= kFactorTableNum) {
e = BCExceptionIllegalArgument;
return (FX_WCHAR*)"";
}
diff --git a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
index 15f288be63..19672c1b71 100644
--- a/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
+++ b/xfa/fxbarcode/datamatrix/BC_HighLevelEncoder.cpp
@@ -158,7 +158,7 @@ int32_t CBC_HighLevelEncoder::lookAheadTest(CFX_WideString msg,
int32_t charsProcessed = 0;
while (TRUE) {
if ((startpos + charsProcessed) == msg.GetLength()) {
- uint32_t min = std::numeric_limits<int32_t>::max();
+ int32_t min = std::numeric_limits<int32_t>::max();
CFX_ByteArray mins;
mins.SetSize(6);
CFX_Int32Array intCharCounts;