diff options
author | Lei Zhang <thestig@chromium.org> | 2017-03-30 12:41:55 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-30 20:50:20 +0000 |
commit | 574b574064af5ec0dabf8d49d98d25af6c5d5925 (patch) | |
tree | e26bd60e563ab937f2d969581d3d140a816823c5 /fpdfsdk/javascript | |
parent | 0bb1333a9eff1190ddd68f34c71d6a779c69dfef (diff) | |
download | pdfium-574b574064af5ec0dabf8d49d98d25af6c5d5925.tar.xz |
Fix some nits in the javascript util code.
Change-Id: I695ca2c4de589f763557d2c327fdb5906bd1a3cf
Reviewed-on: https://pdfium-review.googlesource.com/3411
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r-- | fpdfsdk/javascript/util.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp index 32104b41a6..f88cdc615d 100644 --- a/fpdfsdk/javascript/util.cpp +++ b/fpdfsdk/javascript/util.cpp @@ -113,9 +113,10 @@ bool util::printf(CJS_Runtime* pRuntime, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - int iSize = params.size(); + const size_t iSize = params.size(); if (iSize < 1) return false; + std::wstring c_ConvChar(params[0].ToCFXWideString(pRuntime).c_str()); std::vector<std::wstring> c_strConvers; int iOffset = 0; @@ -134,19 +135,19 @@ bool util::printf(CJS_Runtime* pRuntime, std::wstring c_strResult; std::wstring c_strFormat; - for (int iIndex = 0; iIndex < (int)c_strConvers.size(); iIndex++) { + for (size_t iIndex = 0; iIndex < c_strConvers.size(); ++iIndex) { c_strFormat = c_strConvers[iIndex]; if (iIndex == 0) { c_strResult = c_strFormat; continue; } - CFX_WideString strSegment; if (iIndex >= iSize) { c_strResult += c_strFormat; continue; } + CFX_WideString strSegment; switch (ParseDataType(&c_strFormat)) { case UTIL_INT: strSegment.Format(c_strFormat.c_str(), params[iIndex].ToInt(pRuntime)); @@ -175,12 +176,12 @@ bool util::printd(CJS_Runtime* pRuntime, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - int iSize = params.size(); + const size_t iSize = params.size(); if (iSize < 2) return false; - CJS_Value p1 = params[0]; - CJS_Value p2 = params[1]; + const CJS_Value& p1 = params[0]; + const CJS_Value& p2 = params[1]; CJS_Date jsDate; if (!p2.ConvertToDate(pRuntime, jsDate)) { sError = JSGetStringFromID(IDS_STRING_JSPRINT1); @@ -421,8 +422,7 @@ bool util::scand(CJS_Runtime* pRuntime, const std::vector<CJS_Value>& params, CJS_Value& vRet, CFX_WideString& sError) { - int iSize = params.size(); - if (iSize < 2) + if (params.size() < 2) return false; CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime); |