summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/util.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-10-23 09:40:59 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-23 17:56:28 +0000
commitc970895f94cf76eb738d0a583ae139fecdd85268 (patch)
tree85a46f604e7294cf4402aff67d3338fe031611f4 /fpdfsdk/javascript/util.cpp
parent97dab80731a15a6bd74cdc3caf11f97c3a3be5ed (diff)
downloadpdfium-c970895f94cf76eb738d0a583ae139fecdd85268.tar.xz
Cleanup CJS_Valuechromium/3248
This CL removes unused methods; renames Attach to Set and generally cleans up the CJS_Value classes. Change-Id: I858082100908f3bc51f4b58c11ceda3357fadc70 Reviewed-on: https://pdfium-review.googlesource.com/16430 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/util.cpp')
-rw-r--r--fpdfsdk/javascript/util.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp
index b82020d874..109c0ece4b 100644
--- a/fpdfsdk/javascript/util.cpp
+++ b/fpdfsdk/javascript/util.cpp
@@ -81,7 +81,7 @@ bool util::printf(CJS_Runtime* pRuntime,
if (iSize < 1)
return false;
- std::wstring unsafe_fmt_string(params[0].ToCFXWideString(pRuntime).c_str());
+ std::wstring unsafe_fmt_string(params[0].ToWideString(pRuntime).c_str());
std::vector<std::wstring> unsafe_conversion_specifiers;
int iOffset = 0;
int iOffend = 0;
@@ -122,7 +122,7 @@ bool util::printf(CJS_Runtime* pRuntime,
break;
case UTIL_STRING:
strSegment.Format(c_strFormat.c_str(),
- params[iIndex].ToCFXWideString(pRuntime).c_str());
+ params[iIndex].ToWideString(pRuntime).c_str());
break;
default:
strSegment.Format(L"%ls", c_strFormat.c_str());
@@ -146,12 +146,12 @@ bool util::printd(CJS_Runtime* pRuntime,
const CJS_Value& p1 = params[0];
const CJS_Value& p2 = params[1];
- CJS_Date jsDate;
- if (!p2.ConvertToDate(pRuntime, jsDate)) {
+ if (!p2.IsDateObject()) {
sError = JSGetStringFromID(IDS_STRING_JSPRINT1);
return false;
}
+ CJS_Date jsDate = p2.ToDate(pRuntime);
if (!jsDate.IsValidDate(pRuntime)) {
sError = JSGetStringFromID(IDS_STRING_JSPRINT2);
return false;
@@ -197,7 +197,7 @@ bool util::printd(CJS_Runtime* pRuntime,
// Convert PDF-style format specifiers to wcsftime specifiers. Remove any
// pre-existing %-directives before inserting our own.
- std::basic_string<wchar_t> cFormat = p1.ToCFXWideString(pRuntime).c_str();
+ std::basic_string<wchar_t> cFormat = p1.ToWideString(pRuntime).c_str();
cFormat.erase(std::remove(cFormat.begin(), cFormat.end(), '%'),
cFormat.end());
@@ -276,8 +276,8 @@ bool util::printx(CJS_Runtime* pRuntime,
return false;
}
- vRet = CJS_Value(pRuntime, printx(params[0].ToCFXWideString(pRuntime),
- params[1].ToCFXWideString(pRuntime))
+ vRet = CJS_Value(pRuntime, printx(params[0].ToWideString(pRuntime),
+ params[1].ToWideString(pRuntime))
.c_str());
return true;
@@ -388,8 +388,8 @@ bool util::scand(CJS_Runtime* pRuntime,
if (params.size() < 2)
return false;
- WideString sFormat = params[0].ToCFXWideString(pRuntime);
- WideString sDate = params[1].ToCFXWideString(pRuntime);
+ WideString sFormat = params[0].ToWideString(pRuntime);
+ WideString sDate = params[1].ToWideString(pRuntime);
double dDate = JS_GetDateTime();
if (sDate.GetLength() > 0) {
dDate = CJS_PublicMethods::MakeRegularDate(sDate, sFormat, nullptr);