diff options
Diffstat (limited to 'xfa')
-rw-r--r-- | xfa/fgas/crt/cfgas_formatstring.cpp | 18 | ||||
-rw-r--r-- | xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp | 2 | ||||
-rw-r--r-- | xfa/fxfa/parser/cxfa_scriptcontext.cpp | 12 |
3 files changed, 21 insertions, 11 deletions
diff --git a/xfa/fgas/crt/cfgas_formatstring.cpp b/xfa/fgas/crt/cfgas_formatstring.cpp index 9da8bb9583..df95a3588a 100644 --- a/xfa/fgas/crt/cfgas_formatstring.cpp +++ b/xfa/fgas/crt/cfgas_formatstring.cpp @@ -293,7 +293,7 @@ bool ParseLocaleDate(const CFX_WideString& wsDate, } } } else if (symbol == L"YY" || symbol == L"YYYY") { - if (*cc + symbol.GetLength() > len) + if (*cc + pdfium::base::checked_cast<int32_t>(symbol.GetLength()) > len) return false; year = 0; @@ -417,11 +417,13 @@ bool ParseLocaleTime(const CFX_WideString& wsTime, } else if (symbol == L"A") { CFX_WideString wsAM = pLocale->GetMeridiemName(true); CFX_WideString wsPM = pLocale->GetMeridiemName(false); - if ((*cc + wsAM.GetLength() <= len) && + if ((*cc + pdfium::base::checked_cast<int32_t>(wsAM.GetLength()) <= + len) && (CFX_WideStringC(str + *cc, wsAM.GetLength()) == wsAM)) { *cc += wsAM.GetLength(); bHasA = true; - } else if ((*cc + wsPM.GetLength() <= len) && + } else if ((*cc + pdfium::base::checked_cast<int32_t>(wsPM.GetLength()) <= + len) && (CFX_WideStringC(str + *cc, wsPM.GetLength()) == wsPM)) { *cc += wsPM.GetLength(); bHasA = true; @@ -2087,12 +2089,13 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, if (cc >= 0) { int nPos = dot_index.value() % 3; wsOutput->clear(); - for (int32_t i = 0; i < dot_index; i++) { + for (int32_t i = 0; + i < pdfium::base::checked_cast<int32_t>(dot_index.value()); i++) { if (i % 3 == nPos && i != 0) *wsOutput += wsGroupSymbol; *wsOutput += wsSrcNum[i]; } - if (dot_index < len) { + if (pdfium::base::checked_cast<int32_t>(dot_index.value()) < len) { *wsOutput += pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Decimal); *wsOutput += wsSrcNum.Right(len - dot_index.value() - 1); } @@ -2102,7 +2105,8 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, } return false; } - if (dot_index_f == wsNumFormat.GetLength()) { + if (dot_index_f == + pdfium::base::checked_cast<int32_t>(wsNumFormat.GetLength())) { if (!bAddNeg && bNeg) { *wsOutput = pLocale->GetNumbericSymbol(FX_LOCALENUMSYMBOL_Minus) + *wsOutput; @@ -2115,7 +2119,7 @@ bool CFGAS_FormatString::FormatStrNum(const CFX_WideStringC& wsInputNum, if (strf[dot_index_f] == 'V') { *wsOutput += wsDotSymbol; } else if (strf[dot_index_f] == '.') { - if (dot_index < len) + if (pdfium::base::checked_cast<int32_t>(dot_index.value()) < len) *wsOutput += wsDotSymbol; else if (strf[dot_index_f + 1] == '9' || strf[dot_index_f + 1] == 'Z') *wsOutput += wsDotSymbol; diff --git a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp index c465c96ff0..58ddbac806 100644 --- a/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmsimpleexpression_unittest.cpp @@ -66,7 +66,7 @@ TEST(FMStringExpressionTest, Long) { CFX_WideTextBuf accumulator; std::vector<CFX_WideStringC::UnsignedType> vec(140000, L'A'); CXFA_FMStringExpression(1, CFX_WideStringC(vec)).ToJavaScript(accumulator); - EXPECT_EQ(140000, accumulator.GetLength()); + EXPECT_EQ(140000u, accumulator.GetLength()); } TEST(FMStringExpressionTest, Quoted) { diff --git a/xfa/fxfa/parser/cxfa_scriptcontext.cpp b/xfa/fxfa/parser/cxfa_scriptcontext.cpp index e7c86296ee..98b5da057f 100644 --- a/xfa/fxfa/parser/cxfa_scriptcontext.cpp +++ b/xfa/fxfa/parser/cxfa_scriptcontext.cpp @@ -624,7 +624,9 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refObject, bool bCreate = m_ResolveProcessor->GetNodeHelper()->ResolveNodes_CreateNode( rndFind.m_wsName, rndFind.m_wsCondition, - nStart == wsExpression.GetLength(), this); + nStart == + pdfium::base::checked_cast<int32_t>(wsExpression.GetLength()), + this); if (bCreate) { continue; } else { @@ -650,7 +652,9 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refObject, continue; } if (rndFind.m_dwFlag == XFA_RESOVENODE_RSTYPE_Attribute && - rndFind.m_pScriptAttribute && nStart < wsExpression.GetLength()) { + rndFind.m_pScriptAttribute && + nStart < + pdfium::base::checked_cast<int32_t>(wsExpression.GetLength())) { auto pValue = pdfium::MakeUnique<CFXJSE_Value>(m_pIsolate); (rndFind.m_Objects.front() ->*(rndFind.m_pScriptAttribute->lpfnCallback))( @@ -679,7 +683,9 @@ int32_t CXFA_ScriptContext::ResolveObjects(CXFA_Object* refObject, bool bCreate = m_ResolveProcessor->GetNodeHelper()->ResolveNodes_CreateNode( rndFind.m_wsName, rndFind.m_wsCondition, - nStart == wsExpression.GetLength(), this); + nStart == pdfium::base::checked_cast<int32_t>( + wsExpression.GetLength()), + this); if (bCreate) { continue; } else { |