summaryrefslogtreecommitdiff
path: root/fxjs/xfa/cjx_list.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2018-01-04 13:57:02 -0500
committerChromium commit bot <commit-bot@chromium.org>2018-01-04 19:15:31 +0000
commitcb6c8d4ec4781c7db8448f2b4d9a8af879cf014e (patch)
treede752e161b1196c6b26b2f34418b7dff7ee39b64 /fxjs/xfa/cjx_list.cpp
parent981a2908d7a213363772d1846a7c63c2cfd73c7e (diff)
downloadpdfium-cb6c8d4ec4781c7db8448f2b4d9a8af879cf014e.tar.xz
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 <dsinclair@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fxjs/xfa/cjx_list.cpp')
-rw-r--r--fxjs/xfa/cjx_list.cpp6
1 files changed, 4 insertions, 2 deletions
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<size_t>(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<int32_t>(GetXFAList()->GetLength()));
}