summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorochang <ochang@chromium.org>2016-06-01 12:20:03 -0700
committerCommit bot <commit-bot@chromium.org>2016-06-01 12:20:04 -0700
commitf6be145f54bf44810974e43e9554c756c9730bb6 (patch)
tree4505ef3bf163877c345f622091940eefc262178c
parent386b19e03f3915ae22f8c96029b10270e7faa75f (diff)
downloadpdfium-f6be145f54bf44810974e43e9554c756c9730bb6.tar.xz
Fix some signed/unsigned comparisons in xfa_fm2jscontext.cpp
Looks like this causes compile warnings on ARM where wchar_t is unsigned. Review-Url: https://codereview.chromium.org/2023173002
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index 6eb8249cc1..0aa0599f23 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -359,20 +359,20 @@ const FXJSE_CLASS_DESCRIPTOR formcalc_fm2js_descriptor = {
};
const uint8_t g_sAltTable_Date[] = {
- 255, 255, 255, 3, 9, 255, 255, 255, 255, 255, 255, 255, 2,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 1, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 255, 3, 9, 255, 255, 255, 255, 255, 255,
+ 255, 2, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 255, 255, 1, 255, 255, 255, 255, 255, 255, 255, 255,
};
+static_assert(FX_ArraySize(g_sAltTable_Date) == L'a' - L'A' + 1,
+ "Invalid g_sAltTable_Date size.");
const uint8_t g_sAltTable_Time[] = {
- 14, 255, 255, 3, 9, 255, 255, 15, 255, 255, 255, 255, 6,
- 255, 255, 255, 255, 255, 7, 255, 255, 255, 255, 255, 1, 17,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 15, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
- 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
+ 14, 255, 255, 3, 9, 255, 255, 15, 255, 255, 255,
+ 255, 6, 255, 255, 255, 255, 255, 7, 255, 255, 255,
+ 255, 255, 1, 17, 255, 255, 255, 255, 255, 255, 255,
};
+static_assert(FX_ArraySize(g_sAltTable_Time) == L'a' - L'A' + 1,
+ "Invalid g_sAltTable_Time size.");
void AlternateDateTimeSymbols(CFX_WideString& wsPattern,
const CFX_WideString& wsAltSymbols,
@@ -380,7 +380,7 @@ void AlternateDateTimeSymbols(CFX_WideString& wsPattern,
int32_t nLength = wsPattern.GetLength();
FX_BOOL bInConstRange = FALSE;
FX_BOOL bEscape = FALSE;
- int32_t i = 0, n = 0;
+ int32_t i = 0;
while (i < nLength) {
FX_WCHAR wc = wsPattern[i];
if (wc == L'\'') {
@@ -394,8 +394,8 @@ void AlternateDateTimeSymbols(CFX_WideString& wsPattern,
bEscape = !bEscape;
continue;
}
- if (!bInConstRange && (n = wc - L'A') >= 0 && n <= (L'a' - L'A')) {
- int32_t nAlt = (int32_t)pAltTable[n];
+ if (!bInConstRange && wc >= L'A' && wc <= L'a') {
+ uint8_t nAlt = pAltTable[wc - L'A'];
if (nAlt != 255)
wsPattern.SetAt(i, wsAltSymbols[nAlt]);
}
@@ -4228,7 +4228,7 @@ void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString,
} else if (ch >= 0x20 && ch <= 0x7e) {
wsResultBuf.AppendChar(ch);
} else {
- int32_t iRadix = 16;
+ const FX_WCHAR iRadix = 16;
CFX_WideString strTmp;
while (ch >= iRadix) {
FX_WCHAR tmp = strCode[ch % iRadix];