From cb6c8d4ec4781c7db8448f2b4d9a8af879cf014e Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Thu, 4 Jan 2018 13:57:02 -0500 Subject: Make CXFA_List::GetLength return a size_t This requires a number of other minor cleanups to get sizes and signedness agreeing everywhere. Change-Id: Ie25318a23d458be5a8a2a91927c3b37eb198f5ce Reviewed-on: https://pdfium-review.googlesource.com/22256 Reviewed-by: dsinclair Commit-Queue: Ryan Harrison --- fxjs/xfa/cjx_list.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'fxjs/xfa') diff --git a/fxjs/xfa/cjx_list.cpp b/fxjs/xfa/cjx_list.cpp index 198804dbed..57087a8492 100644 --- a/fxjs/xfa/cjx_list.cpp +++ b/fxjs/xfa/cjx_list.cpp @@ -11,6 +11,7 @@ #include "fxjs/cfxjse_engine.h" #include "fxjs/cfxjse_value.h" #include "fxjs/js_resources.h" +#include "third_party/base/numerics/safe_conversions.h" #include "xfa/fxfa/parser/cxfa_document.h" #include "xfa/fxfa/parser/cxfa_list.h" #include "xfa/fxfa/parser/cxfa_node.h" @@ -76,7 +77,7 @@ CJS_Return CJX_List::item(CJS_V8* runtime, return CJS_Return(JSGetStringFromID(JSMessage::kParamError)); int32_t iIndex = runtime->ToInt32(params[0]); - if (iIndex < 0 || iIndex >= GetXFAList()->GetLength()) + if (iIndex < 0 || static_cast(iIndex) >= GetXFAList()->GetLength()) return CJS_Return(JSGetStringFromID(JSMessage::kInvalidInputError)); return CJS_Return(runtime->NewXFAObject( @@ -91,5 +92,6 @@ void CJX_List::length(CFXJSE_Value* pValue, ThrowInvalidPropertyException(); return; } - pValue->SetInteger(GetXFAList()->GetLength()); + pValue->SetInteger( + pdfium::base::checked_cast(GetXFAList()->GetLength())); } -- cgit v1.2.3