From e49749265c4e503c37a316e4ca6eeff430d13b87 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 24 Oct 2017 09:36:16 -0400 Subject: Remove most CJS_Value Set methods This CL removes all of the Set(*) methods from CJS_Value except for Set(v8::Local). All uses of Set are changed to convert to a v8::Value before setting. Change-Id: I6e4d2cebec42fce5c039dc0a3abe46086cfdd34f Reviewed-on: https://pdfium-review.googlesource.com/16610 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- fpdfsdk/javascript/PublicMethods.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'fpdfsdk/javascript/PublicMethods.cpp') diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index 5e428007ad..ccd2cfc885 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -122,15 +122,15 @@ void JSGlobalFunc(const char* func_name_string, return; std::vector parameters; for (unsigned int i = 0; i < (unsigned int)info.Length(); i++) { - parameters.push_back(CJS_Value(pRuntime, info[i])); + parameters.push_back(CJS_Value(info[i])); } - CJS_Value valueRes(pRuntime); + CJS_Value valueRes; WideString sError; if (!(*F)(pRuntime, parameters, valueRes, sError)) { pRuntime->Error(JSFormatErrorString(func_name_string, nullptr, sError)); return; } - info.GetReturnValue().Set(valueRes.ToV8Value(pRuntime)); + info.GetReturnValue().Set(valueRes.ToV8Value()); } } // namespace @@ -896,7 +896,7 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime, if (iNegStyle == 1 || iNegStyle == 3) { if (Field* fTarget = pEvent->Target_Field()) { CJS_Array arColor; - CJS_Value vColElm(pRuntime); + CJS_Value vColElm; vColElm = CJS_Value(pRuntime, L"RGB"); arColor.SetElement(pRuntime, 0, vColElm); vColElm = CJS_Value(pRuntime, 1); @@ -913,7 +913,7 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime, if (iNegStyle == 1 || iNegStyle == 3) { if (Field* fTarget = pEvent->Target_Field()) { CJS_Array arColor; - CJS_Value vColElm(pRuntime); + CJS_Value vColElm; vColElm = CJS_Value(pRuntime, L"RGB"); arColor.SetElement(pRuntime, 0, vColElm); vColElm = CJS_Value(pRuntime, 0); @@ -921,7 +921,7 @@ bool CJS_PublicMethods::AFNumber_Format(CJS_Runtime* pRuntime, arColor.SetElement(pRuntime, 2, vColElm); arColor.SetElement(pRuntime, 3, vColElm); - CJS_Value vProp(pRuntime); + CJS_Value vProp; fTarget->get_text_color(pRuntime, &vProp, &sError); CFX_Color crProp = @@ -1661,7 +1661,7 @@ bool CJS_PublicMethods::AFSimple_Calculate(CJS_Runtime* pRuntime, return false; } - CJS_Value params1 = params[1]; + CJS_Value params1(params[1]); if (!params1.IsArrayObject() && params1.GetType() != CJS_Value::VT_string) { sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR); return false; @@ -1826,7 +1826,7 @@ bool CJS_PublicMethods::AFExtractNums(CJS_Runtime* pRuntime, if (nums.GetLength(pRuntime) > 0) vRet = CJS_Value(pRuntime, nums); else - vRet.SetNull(pRuntime); + vRet.Set(pRuntime->NewNull()); return true; } -- cgit v1.2.3