diff options
author | tsepez <tsepez@chromium.org> | 2016-04-13 21:40:19 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-13 21:40:19 -0700 |
commit | bd9748d504555f100d34025d76a9e0119986bc3f (patch) | |
tree | 829a03f0064b6593f6eff9551ed24b862a06006e /fpdfsdk | |
parent | 6e0d67d4f55fc7cb4632f4c5d08cd7565a237d30 (diff) | |
download | pdfium-bd9748d504555f100d34025d76a9e0119986bc3f.tar.xz |
Remove implicit cast from CFX_WideString to (const wchar_t*)
BUG=
Review URL: https://codereview.chromium.org/1882043004
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/fsdk_baseform.cpp | 4 | ||||
-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 |
4 files changed, 21 insertions, 20 deletions
diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp index bfeba0e6dd..288a2fe5a3 100644 --- a/fpdfsdk/fsdk_baseform.cpp +++ b/fpdfsdk/fsdk_baseform.cpp @@ -718,7 +718,7 @@ void CPDFSDK_Widget::ResetAppearance(FX_BOOL bValueChanged) { case FIELDTYPE_COMBOBOX: { FX_BOOL bFormated = FALSE; CFX_WideString sValue = OnFormat(bFormated); - ResetAppearance(bFormated ? sValue : nullptr, TRUE); + ResetAppearance(bFormated ? sValue.c_str() : nullptr, TRUE); } break; default: ResetAppearance(nullptr, FALSE); @@ -1546,7 +1546,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) { CFX_WideString sValueTmp; if (!sValue && GetMixXFAWidget()) { sValueTmp = GetValue(TRUE); - sValue = sValueTmp; + sValue = sValueTmp.c_str(); } #endif // PDF_ENABLE_XFA 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; } |