Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Unified Diff: fpdfsdk/src/javascript/util.cpp

Issue 1096813008: Kill overloaded cast operators in CJS_Value. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: fix nit. Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/javascript/global.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/util.cpp
diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp
index 0ac98ddbac82145a8b7492c719a0eb20b5b55941..6898d0c1a2ea6257eb9302d1c08cc92a63532419 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);
« no previous file with comments | « fpdfsdk/src/javascript/global.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698