summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/javascript/util.cpp')
-rw-r--r--fpdfsdk/src/javascript/util.cpp26
1 files changed, 12 insertions, 14 deletions
diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp
index 0ac98ddbac..6898d0c1a2 100644
--- a/fpdfsdk/src/javascript/util.cpp
+++ b/fpdfsdk/src/javascript/util.cpp
@@ -142,7 +142,7 @@ FX_BOOL util::printf(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
int iSize = params.size();
if (iSize < 1)
return FALSE;
- std::wstring c_ConvChar((const wchar_t*)(FX_LPCWSTR)params[0].operator CFX_WideString());
+ std::wstring c_ConvChar(params[0].ToCFXWideString().c_str());
std::vector<std::wstring> c_strConvers;
int iOffset = 0;
int iOffend = 0;
@@ -182,13 +182,13 @@ FX_BOOL util::printf(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
switch (ParstDataType(&c_strFormat))
{
case UTIL_INT:
- strSegment.Format(c_strFormat.c_str(),(int)params[iIndex]);
+ strSegment.Format(c_strFormat.c_str(), params[iIndex].ToInt());
break;
case UTIL_DOUBLE:
- strSegment.Format(c_strFormat.c_str(),(double)params[iIndex]);
+ strSegment.Format(c_strFormat.c_str(), params[iIndex].ToDouble());
break;
case UTIL_STRING:
- strSegment.Format(c_strFormat.c_str(),(FX_LPCWSTR)params[iIndex].operator CFX_WideString());
+ strSegment.Format(c_strFormat.c_str(), params[iIndex].ToCFXWideString().c_str());
break;
default:
strSegment.Format(L"%S", c_strFormat.c_str());
@@ -229,8 +229,7 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
if (p1.GetType() == VT_number)
{
- int nFormat = p1;
-
+ int nFormat = p1.ToInt();
CFX_WideString swResult;
switch (nFormat)
@@ -271,13 +270,12 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
}
else if (p1.GetType() == VT_string)
{
- std::basic_string<wchar_t> cFormat = (FX_LPCWSTR)p1.operator CFX_WideString();
+ std::basic_string<wchar_t> cFormat = p1.ToCFXWideString().c_str();
bool bXFAPicture = false;
if (iSize > 2)
{
- //CJS_Value value;
- bXFAPicture = params[2];
+ bXFAPicture = params[2].ToBool();
}
if (bXFAPicture)
@@ -467,8 +465,8 @@ FX_BOOL util::printx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
int iSize = params.size();
if (iSize<2)
return FALSE;
- CFX_WideString sFormat = params[0].operator CFX_WideString();
- CFX_WideString sSource = params[1].operator CFX_WideString();
+ CFX_WideString sFormat = params[0].ToCFXWideString();
+ CFX_WideString sSource = params[1].ToCFXWideString();
std::string cFormat = CFX_ByteString::FromUnicode(sFormat).c_str();
std::string cSource = CFX_ByteString::FromUnicode(sSource).c_str();
std::string cDest;
@@ -582,9 +580,9 @@ FX_BOOL util::scand(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
int iSize = params.size();
if (iSize < 2)
return FALSE;
- CFX_WideString sFormat = params[0].operator CFX_WideString();
- CFX_WideString sDate = params[1].operator CFX_WideString();
+ CFX_WideString sFormat = params[0].ToCFXWideString();
+ CFX_WideString sDate = params[1].ToCFXWideString();
double dDate = JS_GetDateTime();
if (sDate.GetLength() > 0)
{
@@ -638,7 +636,7 @@ FX_BOOL util::byteToChar(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Va
int iSize = params.size();
if (iSize == 0)
return FALSE;
- int nByte = (int)params[0];
+ int nByte = params[0].ToInt();
unsigned char cByte = (unsigned char)nByte;
CFX_WideString csValue;
csValue.Format(L"%c", cByte);