diff options
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r-- | fpdfsdk/javascript/PublicMethods.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/javascript/public_methods_embeddertest.cpp | 32 | ||||
-rw-r--r-- | fpdfsdk/javascript/util.cpp | 3 |
3 files changed, 19 insertions, 18 deletions
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index d03f671599..9f7b60f70d 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -1654,7 +1654,7 @@ FX_BOOL CJS_PublicMethods::AFMakeNumber(IJS_Context* cc, } CFX_WideString ws = params[0].ToCFXWideString(); ws.Replace(L",", L"."); - vRet = ws; + vRet = ws.c_str(); vRet.MaybeCoerceToNumber(); if (vRet.GetType() != CJS_Value::VT_number) vRet = 0; diff --git a/fpdfsdk/javascript/public_methods_embeddertest.cpp b/fpdfsdk/javascript/public_methods_embeddertest.cpp index 153b3cd64f..1fc967b890 100644 --- a/fpdfsdk/javascript/public_methods_embeddertest.cpp +++ b/fpdfsdk/javascript/public_methods_embeddertest.cpp @@ -113,56 +113,56 @@ TEST_F(PublicMethodsEmbedderTest, MakeFormatDate) { // 1968-06-25 formatted_date = CJS_PublicMethods::MakeFormatDate(-47952000000, L"ddmmyy"); - EXPECT_STREQ(L"250668", formatted_date); + EXPECT_STREQ(L"250668", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(-47952000000, L"yy/mm/dd"); - EXPECT_STREQ(L"68/06/25", formatted_date); + EXPECT_STREQ(L"68/06/25", formatted_date.c_str()); // 1969-12-31 formatted_date = CJS_PublicMethods::MakeFormatDate(-0.0001, L"ddmmyy"); - EXPECT_STREQ(L"311269", formatted_date); + EXPECT_STREQ(L"311269", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(-0.0001, L"yy!mmdd"); - EXPECT_STREQ(L"69!1231", formatted_date); + EXPECT_STREQ(L"69!1231", formatted_date.c_str()); // 1970-01-01 formatted_date = CJS_PublicMethods::MakeFormatDate(0, L"ddmmyy"); - EXPECT_STREQ(L"010170", formatted_date); + EXPECT_STREQ(L"010170", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(0, L"mm-yyyy-dd"); - EXPECT_STREQ(L"01-1970-01", formatted_date); + EXPECT_STREQ(L"01-1970-01", formatted_date.c_str()); // 1985-12-31 formatted_date = CJS_PublicMethods::MakeFormatDate(504835200000.0, L"ddmmyy"); - EXPECT_STREQ(L"311285", formatted_date); + EXPECT_STREQ(L"311285", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(504835200000.0, L"yymmdd"); - EXPECT_STREQ(L"851231", formatted_date); + EXPECT_STREQ(L"851231", formatted_date.c_str()); // 1995-02-01 formatted_date = CJS_PublicMethods::MakeFormatDate(791596800000.0, L"ddmmyy"); - EXPECT_STREQ(L"010295", formatted_date); + EXPECT_STREQ(L"010295", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(791596800000.0, L"yyyymmdd"); - EXPECT_STREQ(L"19950201", formatted_date); + EXPECT_STREQ(L"19950201", formatted_date.c_str()); // 2005-02-01 formatted_date = CJS_PublicMethods::MakeFormatDate(1107216000000.0, L"ddmmyy"); - EXPECT_STREQ(L"010205", formatted_date); + EXPECT_STREQ(L"010205", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(1107216000000.0, L"yyyyddmm"); - EXPECT_STREQ(L"20050102", formatted_date); + EXPECT_STREQ(L"20050102", formatted_date.c_str()); // 2085-12-31 formatted_date = CJS_PublicMethods::MakeFormatDate(3660595200000.0, L"ddmmyy"); - EXPECT_STREQ(L"311285", formatted_date); + EXPECT_STREQ(L"311285", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(3660595200000.0, L"yyyydd"); - EXPECT_STREQ(L"208531", formatted_date); + EXPECT_STREQ(L"208531", formatted_date.c_str()); // 2095-02-01 formatted_date = CJS_PublicMethods::MakeFormatDate(3947356800000.0, L"ddmmyy"); - EXPECT_STREQ(L"010295", formatted_date); + EXPECT_STREQ(L"010295", formatted_date.c_str()); formatted_date = CJS_PublicMethods::MakeFormatDate(3947356800000.0, L"mmddyyyy"); - EXPECT_STREQ(L"02012095", formatted_date); + EXPECT_STREQ(L"02012095", formatted_date.c_str()); } diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp index adaa9c794b..4f2d834208 100644 --- a/fpdfsdk/javascript/util.cpp +++ b/fpdfsdk/javascript/util.cpp @@ -312,7 +312,8 @@ FX_BOOL util::printx(IJS_Context* cc, sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPARAMERROR); return FALSE; } - vRet = printx(params[0].ToCFXWideString(), params[1].ToCFXWideString()); + vRet = + printx(params[0].ToCFXWideString(), params[1].ToCFXWideString()).c_str(); return TRUE; } |