summaryrefslogtreecommitdiff
path: root/fxjs/cjs_publicmethods.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-08-17 19:28:52 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-08-17 19:28:52 +0000
commit3a6d058740a9908a06efb9e9362df01acdee6ff8 (patch)
tree9bc645b0cb3442749458fc63e2feb04c0cb813ef /fxjs/cjs_publicmethods.cpp
parent0a2328e0eff7a11aa49b7da8f013e658153a7b1a (diff)
downloadpdfium-3a6d058740a9908a06efb9e9362df01acdee6ff8.tar.xz
Rename CJS_Return to CJS_Result.
"Return" is a verb, and "return" is a reserved-word at that, so avoid using it as part of a class name. Fully mechanical change apart from rename. Change-Id: I120e453e8ba001c4ab74a39e2da6aa6eb590835f Reviewed-on: https://pdfium-review.googlesource.com/40532 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/cjs_publicmethods.cpp')
-rw-r--r--fxjs/cjs_publicmethods.cpp192
1 files changed, 96 insertions, 96 deletions
diff --git a/fxjs/cjs_publicmethods.cpp b/fxjs/cjs_publicmethods.cpp
index 86a2a777b9..3cf70ccf3a 100644
--- a/fxjs/cjs_publicmethods.cpp
+++ b/fxjs/cjs_publicmethods.cpp
@@ -118,7 +118,7 @@ WideString CalcMergedString(const CJS_EventHandler* event,
return prefix + change + postfix;
}
-template <CJS_Return (*F)(CJS_Runtime*,
+template <CJS_Result (*F)(CJS_Runtime*,
const std::vector<v8::Local<v8::Value>>&)>
void JSGlobalFunc(const char* func_name_string,
const v8::FunctionCallbackInfo<v8::Value>& info) {
@@ -134,7 +134,7 @@ void JSGlobalFunc(const char* func_name_string,
for (int i = 0; i < info.Length(); ++i)
parameters.push_back(info[i]);
- CJS_Return result = (*F)(pRuntime, parameters);
+ CJS_Result result = (*F)(pRuntime, parameters);
if (result.HasError()) {
pRuntime->Error(
JSFormatErrorString(func_name_string, nullptr, result.Error()));
@@ -869,22 +869,22 @@ WideString CJS_PublicMethods::MakeFormatDate(double dDate,
// function AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency,
// bCurrencyPrepend)
-CJS_Return CJS_PublicMethods::AFNumber_Format(
+CJS_Result CJS_PublicMethods::AFNumber_Format(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
#if _FX_OS_ != _FX_OS_ANDROID_
if (params.size() != 6)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
if (!pEvent->m_pValue)
- return CJS_Return::Failure(L"No event handler");
+ return CJS_Result::Failure(L"No event handler");
WideString& Value = pEvent->Value();
ByteString strValue = StrTrim(Value.ToDefANSI());
if (strValue.IsEmpty())
- return CJS_Return::Success();
+ return CJS_Result::Success();
int iDec = abs(pRuntime->ToInt32(params[0]));
int iSepStyle = ValidStyleOrZero(pRuntime->ToInt32(params[1]));
@@ -961,7 +961,7 @@ CJS_Return CJS_PublicMethods::AFNumber_Format(
pRuntime->PutArrayElement(arColor, 2, pRuntime->NewNumber(0));
pRuntime->PutArrayElement(arColor, 3, pRuntime->NewNumber(0));
- CJS_Return result = fTarget->get_text_color(pRuntime);
+ CJS_Result result = fTarget->get_text_color(pRuntime);
CFX_Color crProp = CJS_Color::ConvertArrayToPWLColor(
pRuntime, pRuntime->ToArray(result.Return()));
CFX_Color crColor =
@@ -972,21 +972,21 @@ CJS_Return CJS_PublicMethods::AFNumber_Format(
}
}
#endif
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
// function AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, strCurrency,
// bCurrencyPrepend)
-CJS_Return CJS_PublicMethods::AFNumber_Keystroke(
+CJS_Result CJS_PublicMethods::AFNumber_Keystroke(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() < 2)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CJS_EventContext* pContext = pRuntime->GetCurrentEventContext();
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!pEvent->m_pValue)
- return CJS_Return::Failure(JSMessage::kBadObjectError);
+ return CJS_Result::Failure(JSMessage::kBadObjectError);
WideString& val = pEvent->Value();
WideString& wstrChange = pEvent->Change();
@@ -995,17 +995,17 @@ CJS_Return CJS_PublicMethods::AFNumber_Keystroke(
if (pEvent->WillCommit()) {
WideString swTemp = StrTrim(wstrValue);
if (swTemp.IsEmpty())
- return CJS_Return::Success();
+ return CJS_Result::Success();
NormalizeDecimalMarkW(&swTemp);
if (!IsNumber(swTemp)) {
pEvent->Rc() = false;
WideString sError = JSGetStringFromID(JSMessage::kInvalidInputError);
AlertIfPossible(pContext, sError);
- return CJS_Return::Failure(sError);
+ return CJS_Result::Failure(sError);
}
// It happens after the last keystroke and before validating,
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
WideString wstrSelected;
@@ -1019,7 +1019,7 @@ CJS_Return CJS_PublicMethods::AFNumber_Keystroke(
// can't insert "change" in front of sign position.
if (!wstrSelected.IsEmpty() && pEvent->SelStart() == 0) {
pEvent->Rc() = false;
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
}
@@ -1031,7 +1031,7 @@ CJS_Return CJS_PublicMethods::AFNumber_Keystroke(
if (wstrChange[i] == cSep) {
if (bHasSep) {
pEvent->Rc() = false;
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
bHasSep = true;
continue;
@@ -1039,16 +1039,16 @@ CJS_Return CJS_PublicMethods::AFNumber_Keystroke(
if (wstrChange[i] == L'-') {
if (bHasSign) {
pEvent->Rc() = false;
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
// sign's position is not correct
if (i != 0) {
pEvent->Rc() = false;
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
if (pEvent->SelStart() != 0) {
pEvent->Rc() = false;
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
bHasSign = true;
continue;
@@ -1056,31 +1056,31 @@ CJS_Return CJS_PublicMethods::AFNumber_Keystroke(
if (!std::iswdigit(wstrChange[i])) {
pEvent->Rc() = false;
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
}
val = CalcMergedString(pEvent, wstrValue, wstrChange);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
// function AFPercent_Format(nDec, sepStyle)
-CJS_Return CJS_PublicMethods::AFPercent_Format(
+CJS_Result CJS_PublicMethods::AFPercent_Format(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
#if _FX_OS_ != _FX_OS_ANDROID_
if (params.size() != 2)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
if (!pEvent->m_pValue)
- return CJS_Return::Failure(JSMessage::kBadObjectError);
+ return CJS_Result::Failure(JSMessage::kBadObjectError);
WideString& Value = pEvent->Value();
ByteString strValue = StrTrim(Value.ToDefANSI());
if (strValue.IsEmpty())
- return CJS_Return::Success();
+ return CJS_Result::Success();
int iDec = abs(pRuntime->ToInt32(params[0]));
int iSepStyle = ValidStyleOrZero(pRuntime->ToInt32(params[1]));
@@ -1141,32 +1141,32 @@ CJS_Return CJS_PublicMethods::AFPercent_Format(
strValue += '%';
Value = WideString::FromLocal(strValue.AsStringView());
#endif
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
// AFPercent_Keystroke(nDec, sepStyle)
-CJS_Return CJS_PublicMethods::AFPercent_Keystroke(
+CJS_Result CJS_PublicMethods::AFPercent_Keystroke(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
return AFNumber_Keystroke(pRuntime, params);
}
// function AFDate_FormatEx(cFormat)
-CJS_Return CJS_PublicMethods::AFDate_FormatEx(
+CJS_Result CJS_PublicMethods::AFDate_FormatEx(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CJS_EventContext* pContext = pRuntime->GetCurrentEventContext();
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!pEvent->m_pValue)
- return CJS_Return::Failure(JSMessage::kBadObjectError);
+ return CJS_Result::Failure(JSMessage::kBadObjectError);
WideString& val = pEvent->Value();
WideString strValue = val;
if (strValue.IsEmpty())
- return CJS_Return::Success();
+ return CJS_Result::Success();
WideString sFormat = pRuntime->ToWideString(params[0]);
double dDate;
@@ -1182,11 +1182,11 @@ CJS_Return CJS_PublicMethods::AFDate_FormatEx(
WideString swMsg = WideString::Format(
JSGetStringFromID(JSMessage::kParseDateError).c_str(), sFormat.c_str());
AlertIfPossible(pContext, swMsg);
- return CJS_Return::Failure(JSMessage::kParseDateError);
+ return CJS_Result::Failure(JSMessage::kParseDateError);
}
val = MakeFormatDate(dDate, sFormat);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
double CJS_PublicMethods::MakeInterDate(const WideString& strValue) {
@@ -1226,25 +1226,25 @@ double CJS_PublicMethods::MakeInterDate(const WideString& strValue) {
}
// AFDate_KeystrokeEx(cFormat)
-CJS_Return CJS_PublicMethods::AFDate_KeystrokeEx(
+CJS_Result CJS_PublicMethods::AFDate_KeystrokeEx(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 1) {
- return CJS_Return::Failure(
+ return CJS_Result::Failure(
WideString(L"AFDate_KeystrokeEx's parameter size not correct"));
}
CJS_EventContext* pContext = pRuntime->GetCurrentEventContext();
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!pEvent->WillCommit())
- return CJS_Return::Success();
+ return CJS_Result::Success();
if (!pEvent->m_pValue)
- return CJS_Return::Failure(JSMessage::kBadObjectError);
+ return CJS_Result::Failure(JSMessage::kBadObjectError);
const WideString& strValue = pEvent->Value();
if (strValue.IsEmpty())
- return CJS_Return::Success();
+ return CJS_Result::Success();
WideString sFormat = pRuntime->ToWideString(params[0]);
bool bWrongFormat = false;
@@ -1255,14 +1255,14 @@ CJS_Return CJS_PublicMethods::AFDate_KeystrokeEx(
AlertIfPossible(pContext, swMsg);
pEvent->Rc() = false;
}
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
-CJS_Return CJS_PublicMethods::AFDate_Format(
+CJS_Result CJS_PublicMethods::AFDate_Format(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
static constexpr const wchar_t* cFormats[] = {L"m/d",
L"m/d/yy",
@@ -1287,11 +1287,11 @@ CJS_Return CJS_PublicMethods::AFDate_Format(
}
// AFDate_KeystrokeEx(cFormat)
-CJS_Return CJS_PublicMethods::AFDate_Keystroke(
+CJS_Result CJS_PublicMethods::AFDate_Keystroke(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
static constexpr const wchar_t* cFormats[] = {L"m/d",
L"m/d/yy",
@@ -1316,11 +1316,11 @@ CJS_Return CJS_PublicMethods::AFDate_Keystroke(
}
// function AFTime_Format(ptf)
-CJS_Return CJS_PublicMethods::AFTime_Format(
+CJS_Result CJS_PublicMethods::AFTime_Format(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
static constexpr const wchar_t* cFormats[] = {L"HH:MM", L"h:MM tt",
L"HH:MM:ss", L"h:MM:ss tt"};
@@ -1332,11 +1332,11 @@ CJS_Return CJS_PublicMethods::AFTime_Format(
return AFDate_FormatEx(pRuntime, newParams);
}
-CJS_Return CJS_PublicMethods::AFTime_Keystroke(
+CJS_Result CJS_PublicMethods::AFTime_Keystroke(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
static constexpr const wchar_t* cFormats[] = {L"HH:MM", L"h:MM tt",
L"HH:MM:ss", L"h:MM:ss tt"};
@@ -1348,29 +1348,29 @@ CJS_Return CJS_PublicMethods::AFTime_Keystroke(
return AFDate_KeystrokeEx(pRuntime, newParams);
}
-CJS_Return CJS_PublicMethods::AFTime_FormatEx(
+CJS_Result CJS_PublicMethods::AFTime_FormatEx(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
return AFDate_FormatEx(pRuntime, params);
}
-CJS_Return CJS_PublicMethods::AFTime_KeystrokeEx(
+CJS_Result CJS_PublicMethods::AFTime_KeystrokeEx(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
return AFDate_KeystrokeEx(pRuntime, params);
}
// function AFSpecial_Format(psf)
-CJS_Return CJS_PublicMethods::AFSpecial_Format(
+CJS_Result CJS_PublicMethods::AFSpecial_Format(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
if (!pEvent->m_pValue)
- return CJS_Return::Failure(JSMessage::kBadObjectError);
+ return CJS_Result::Failure(JSMessage::kBadObjectError);
const WideString& wsSource = pEvent->Value();
WideString wsFormat;
@@ -1393,29 +1393,29 @@ CJS_Return CJS_PublicMethods::AFSpecial_Format(
}
pEvent->Value() = CJS_Util::printx(wsFormat, wsSource);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
// function AFSpecial_KeystrokeEx(mask)
-CJS_Return CJS_PublicMethods::AFSpecial_KeystrokeEx(
+CJS_Result CJS_PublicMethods::AFSpecial_KeystrokeEx(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() < 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CJS_EventContext* pContext = pRuntime->GetCurrentEventContext();
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!pEvent->m_pValue)
- return CJS_Return::Failure(JSMessage::kBadObjectError);
+ return CJS_Result::Failure(JSMessage::kBadObjectError);
const WideString& valEvent = pEvent->Value();
WideString wstrMask = pRuntime->ToWideString(params[0]);
if (wstrMask.IsEmpty())
- return CJS_Return::Success();
+ return CJS_Result::Success();
if (pEvent->WillCommit()) {
if (valEvent.IsEmpty())
- return CJS_Return::Success();
+ return CJS_Result::Success();
size_t iIndexMask = 0;
for (; iIndexMask < valEvent.GetLength(); ++iIndexMask) {
@@ -1428,12 +1428,12 @@ CJS_Return CJS_PublicMethods::AFSpecial_KeystrokeEx(
JSGetStringFromID(JSMessage::kInvalidInputError));
pEvent->Rc() = false;
}
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
WideString& wideChange = pEvent->Change();
if (wideChange.IsEmpty())
- return CJS_Return::Success();
+ return CJS_Result::Success();
WideString wChange = wideChange;
size_t iIndexMask = pEvent->SelStart();
@@ -1442,13 +1442,13 @@ CJS_Return CJS_PublicMethods::AFSpecial_KeystrokeEx(
if (combined_len > wstrMask.GetLength()) {
AlertIfPossible(pContext, JSGetStringFromID(JSMessage::kParamTooLongError));
pEvent->Rc() = false;
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
if (iIndexMask >= wstrMask.GetLength() && !wChange.IsEmpty()) {
AlertIfPossible(pContext, JSGetStringFromID(JSMessage::kParamTooLongError));
pEvent->Rc() = false;
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
for (size_t i = 0; i < wChange.GetLength(); ++i) {
@@ -1456,7 +1456,7 @@ CJS_Return CJS_PublicMethods::AFSpecial_KeystrokeEx(
AlertIfPossible(pContext,
JSGetStringFromID(JSMessage::kParamTooLongError));
pEvent->Rc() = false;
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
wchar_t wMask = wstrMask[iIndexMask];
if (!IsReservedMaskChar(wMask))
@@ -1464,25 +1464,25 @@ CJS_Return CJS_PublicMethods::AFSpecial_KeystrokeEx(
if (!MaskSatisfied(wChange[i], wMask)) {
pEvent->Rc() = false;
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
iIndexMask++;
}
wideChange = std::move(wChange);
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
// function AFSpecial_Keystroke(psf)
-CJS_Return CJS_PublicMethods::AFSpecial_Keystroke(
+CJS_Result CJS_PublicMethods::AFSpecial_Keystroke(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CJS_EventHandler* pEvent =
pRuntime->GetCurrentEventContext()->GetEventHandler();
if (!pEvent->m_pValue)
- return CJS_Return::Failure(JSMessage::kBadObjectError);
+ return CJS_Result::Failure(JSMessage::kBadObjectError);
const char* cFormat = "";
switch (pRuntime->ToInt32(params[0])) {
@@ -1508,11 +1508,11 @@ CJS_Return CJS_PublicMethods::AFSpecial_Keystroke(
return AFSpecial_KeystrokeEx(pRuntime, params2);
}
-CJS_Return CJS_PublicMethods::AFMergeChange(
+CJS_Result CJS_PublicMethods::AFMergeChange(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CJS_EventHandler* pEventHandler =
pRuntime->GetCurrentEventContext()->GetEventHandler();
@@ -1522,18 +1522,18 @@ CJS_Return CJS_PublicMethods::AFMergeChange(
swValue = pEventHandler->Value();
if (pEventHandler->WillCommit())
- return CJS_Return::Success(pRuntime->NewString(swValue.AsStringView()));
+ return CJS_Result::Success(pRuntime->NewString(swValue.AsStringView()));
- return CJS_Return::Success(pRuntime->NewString(
+ return CJS_Result::Success(pRuntime->NewString(
CalcMergedString(pEventHandler, swValue, pEventHandler->Change())
.AsStringView()));
}
-CJS_Return CJS_PublicMethods::AFParseDateEx(
+CJS_Result CJS_PublicMethods::AFParseDateEx(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 2)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
WideString sValue = pRuntime->ToWideString(params[0]);
WideString sFormat = pRuntime->ToWideString(params[1]);
@@ -1542,27 +1542,27 @@ CJS_Return CJS_PublicMethods::AFParseDateEx(
WideString swMsg = WideString::Format(
JSGetStringFromID(JSMessage::kParseDateError).c_str(), sFormat.c_str());
AlertIfPossible(pRuntime->GetCurrentEventContext(), swMsg);
- return CJS_Return::Failure(JSMessage::kParseDateError);
+ return CJS_Result::Failure(JSMessage::kParseDateError);
}
- return CJS_Return::Success(pRuntime->NewNumber(dDate));
+ return CJS_Result::Success(pRuntime->NewNumber(dDate));
}
-CJS_Return CJS_PublicMethods::AFSimple(
+CJS_Result CJS_PublicMethods::AFSimple(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 3)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
- return CJS_Return::Success(pRuntime->NewNumber(static_cast<double>(AF_Simple(
+ return CJS_Result::Success(pRuntime->NewNumber(static_cast<double>(AF_Simple(
pRuntime->ToWideString(params[0]).c_str(), pRuntime->ToDouble(params[1]),
pRuntime->ToDouble(params[2])))));
}
-CJS_Return CJS_PublicMethods::AFMakeNumber(
+CJS_Result CJS_PublicMethods::AFMakeNumber(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
WideString ws = pRuntime->ToWideString(params[0]);
NormalizeDecimalMarkW(&ws);
@@ -1570,19 +1570,19 @@ CJS_Return CJS_PublicMethods::AFMakeNumber(
v8::Local<v8::Value> val =
pRuntime->MaybeCoerceToNumber(pRuntime->NewString(ws.AsStringView()));
if (!val->IsNumber())
- return CJS_Return::Success(pRuntime->NewNumber(0));
+ return CJS_Result::Success(pRuntime->NewNumber(0));
- return CJS_Return::Success(val);
+ return CJS_Result::Success(val);
}
-CJS_Return CJS_PublicMethods::AFSimple_Calculate(
+CJS_Result CJS_PublicMethods::AFSimple_Calculate(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 2)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
if ((params[1].IsEmpty() || !params[1]->IsArray()) && !params[1]->IsString())
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CPDFSDK_InterForm* pReaderInterForm =
pRuntime->GetFormFillEnv()->GetInterForm();
@@ -1663,24 +1663,24 @@ CJS_Return CJS_PublicMethods::AFSimple_Calculate(
pRuntime->ToWideString(pRuntime->NewNumber(dValue));
}
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
// This function validates the current event to ensure that its value is
// within the specified range.
-CJS_Return CJS_PublicMethods::AFRange_Validate(
+CJS_Result CJS_PublicMethods::AFRange_Validate(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 4)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
CJS_EventContext* pContext = pRuntime->GetCurrentEventContext();
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!pEvent->m_pValue)
- return CJS_Return::Failure(JSMessage::kBadObjectError);
+ return CJS_Result::Failure(JSMessage::kBadObjectError);
if (pEvent->Value().IsEmpty())
- return CJS_Return::Success();
+ return CJS_Result::Success();
double dEentValue = atof(pEvent->Value().ToDefANSI().c_str());
bool bGreaterThan = pRuntime->ToBoolean(params[0]);
@@ -1711,14 +1711,14 @@ CJS_Return CJS_PublicMethods::AFRange_Validate(
AlertIfPossible(pContext, swMsg);
pEvent->Rc() = false;
}
- return CJS_Return::Success();
+ return CJS_Result::Success();
}
-CJS_Return CJS_PublicMethods::AFExtractNums(
+CJS_Result CJS_PublicMethods::AFExtractNums(
CJS_Runtime* pRuntime,
const std::vector<v8::Local<v8::Value>>& params) {
if (params.size() != 1)
- return CJS_Return::Failure(JSMessage::kParamError);
+ return CJS_Result::Failure(JSMessage::kParamError);
WideString str = pRuntime->ToWideString(params[0]);
if (str.GetLength() > 0 && IsDigitSeparatorOrDecimalMark(str[0]))
@@ -1742,7 +1742,7 @@ CJS_Return CJS_PublicMethods::AFExtractNums(
pRuntime->NewString(sPart.AsStringView()));
}
if (pRuntime->GetArrayLength(nums) > 0)
- return CJS_Return::Success(nums);
+ return CJS_Result::Success(nums);
- return CJS_Return::Success(pRuntime->NewUndefined());
+ return CJS_Result::Success(pRuntime->NewUndefined());
}