summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/PublicMethods.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-02 14:37:54 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-02 14:37:55 -0700
commit4cf551577856f89103e162edc761def44ffb96fc (patch)
tree452684db6c2dd2b9aa697415ff4b752e59123b77 /fpdfsdk/javascript/PublicMethods.cpp
parent66bd67023f747c489d7144aaf4ca6222c686cd26 (diff)
downloadpdfium-4cf551577856f89103e162edc761def44ffb96fc.tar.xz
Remove FX_BOOL from fpdfsdk.
Review-Url: https://codereview.chromium.org/2453683011
Diffstat (limited to 'fpdfsdk/javascript/PublicMethods.cpp')
-rw-r--r--fpdfsdk/javascript/PublicMethods.cpp375
1 files changed, 183 insertions, 192 deletions
diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp
index 2310200084..0173bb3ff5 100644
--- a/fpdfsdk/javascript/PublicMethods.cpp
+++ b/fpdfsdk/javascript/PublicMethods.cpp
@@ -335,8 +335,8 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
int nYearSub = 99; // nYear - 2000;
- FX_BOOL bPm = FALSE;
- FX_BOOL bExit = FALSE;
+ bool bPm = false;
+ bool bExit = false;
bool bBadFormat = false;
int i = 0;
@@ -459,13 +459,13 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
switch (c) {
case 'm': {
CFX_WideString sMonth = ParseStringString(value, j, nSkip);
- FX_BOOL bFind = FALSE;
+ bool bFind = false;
for (int m = 0; m < 12; m++) {
if (sMonth.CompareNoCase(months[m]) == 0) {
nMonth = m + 1;
i += 3;
j += nSkip;
- bFind = TRUE;
+ bFind = true;
break;
}
}
@@ -491,7 +491,7 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
i += 4;
break;
case 'm': {
- FX_BOOL bFind = FALSE;
+ bool bFind = false;
CFX_WideString sMonth = ParseStringString(value, j, nSkip);
sMonth.MakeLower();
@@ -504,7 +504,7 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
nMonth = m + 1;
i += 4;
j += nSkip;
- bFind = TRUE;
+ bFind = true;
break;
}
}
@@ -523,7 +523,7 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
} else {
if (j >= value.GetLength() || format.GetAt(i) != value.GetAt(j)) {
bBadFormat = true;
- bExit = TRUE;
+ bExit = true;
}
i++;
j++;
@@ -531,17 +531,17 @@ double CJS_PublicMethods::MakeRegularDate(const CFX_WideString& value,
if (oldj == j) {
bBadFormat = true;
- bExit = TRUE;
+ bExit = true;
}
}
break;
default:
if (value.GetLength() <= j) {
- bExit = TRUE;
+ bExit = true;
} else if (format.GetAt(i) != value.GetAt(j)) {
bBadFormat = true;
- bExit = TRUE;
+ bExit = true;
}
i++;
@@ -723,33 +723,33 @@ CFX_WideString CJS_PublicMethods::MakeFormatDate(double dDate,
// function AFNumber_Format(nDec, sepStyle, negStyle, currStyle, strCurrency,
// bCurrencyPrepend)
-FX_BOOL CJS_PublicMethods::AFNumber_Format(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFNumber_Format(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
#if _FX_OS_ != _FX_ANDROID_
if (params.size() != 6) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CFX_WideString& Value = pEvent->Value();
CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value));
if (strValue.IsEmpty())
- return TRUE;
+ return true;
int iDec = params[0].ToInt(pRuntime);
int iSepStyle = params[1].ToInt(pRuntime);
int iNegStyle = params[2].ToInt(pRuntime);
// params[3] is iCurrStyle, it's not used.
CFX_WideString wstrCurrency = params[4].ToCFXWideString(pRuntime);
- FX_BOOL bCurrencyPrepend = params[5].ToBool(pRuntime);
+ bool bCurrencyPrepend = params[5].ToBool(pRuntime);
if (iDec < 0)
iDec = -iDec;
@@ -888,24 +888,23 @@ FX_BOOL CJS_PublicMethods::AFNumber_Format(IJS_Context* cc,
}
}
#endif
- return TRUE;
+ return true;
}
// function AFNumber_Keystroke(nDec, sepStyle, negStyle, currStyle, strCurrency,
// bCurrencyPrepend)
-FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFNumber_Keystroke(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (params.size() < 2)
- return FALSE;
+ return false;
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CFX_WideString& val = pEvent->Value();
CFX_WideString& wstrChange = pEvent->Change();
@@ -914,15 +913,15 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(
if (pEvent->WillCommit()) {
CFX_WideString swTemp = StrTrim(wstrValue);
if (swTemp.IsEmpty())
- return TRUE;
+ return true;
swTemp.Replace(L",", L".");
if (!IsNumber(swTemp.c_str())) {
- pEvent->Rc() = FALSE;
+ pEvent->Rc() = false;
sError = JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE);
AlertIfPossible(pContext, sError.c_str());
}
- return TRUE; // it happens after the last keystroke and before validating,
+ return true; // it happens after the last keystroke and before validating,
}
CFX_WideString wstrSelected;
@@ -935,9 +934,9 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(
if (bHasSign) {
// can't insert "change" in front to sign postion.
if (pEvent->SelStart() == 0) {
- FX_BOOL& bRc = pEvent->Rc();
- bRc = FALSE;
- return TRUE;
+ bool& bRc = pEvent->Rc();
+ bRc = false;
+ return true;
}
}
@@ -951,38 +950,38 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(
for (FX_STRSIZE i = 0; i < wstrChange.GetLength(); ++i) {
if (wstrChange[i] == cSep) {
if (bHasSep) {
- FX_BOOL& bRc = pEvent->Rc();
- bRc = FALSE;
- return TRUE;
+ bool& bRc = pEvent->Rc();
+ bRc = false;
+ return true;
}
- bHasSep = TRUE;
+ bHasSep = true;
continue;
}
if (wstrChange[i] == L'-') {
if (bHasSign) {
- FX_BOOL& bRc = pEvent->Rc();
- bRc = FALSE;
- return TRUE;
+ bool& bRc = pEvent->Rc();
+ bRc = false;
+ return true;
}
// sign's position is not correct
if (i != 0) {
- FX_BOOL& bRc = pEvent->Rc();
- bRc = FALSE;
- return TRUE;
+ bool& bRc = pEvent->Rc();
+ bRc = false;
+ return true;
}
if (pEvent->SelStart() != 0) {
- FX_BOOL& bRc = pEvent->Rc();
- bRc = FALSE;
- return TRUE;
+ bool& bRc = pEvent->Rc();
+ bRc = false;
+ return true;
}
- bHasSign = TRUE;
+ bHasSign = true;
continue;
}
if (!FXSYS_iswdigit(wstrChange[i])) {
- FX_BOOL& bRc = pEvent->Rc();
- bRc = FALSE;
- return TRUE;
+ bool& bRc = pEvent->Rc();
+ bRc = false;
+ return true;
}
}
@@ -991,15 +990,14 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(
if (pEvent->SelEnd() < wstrValue.GetLength())
wpostfix = wstrValue.Mid(pEvent->SelEnd());
val = wprefix + wstrChange + wpostfix;
- return TRUE;
+ return true;
}
// function AFPercent_Format(nDec, sepStyle)
-FX_BOOL CJS_PublicMethods::AFPercent_Format(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFPercent_Format(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
#if _FX_OS_ != _FX_ANDROID_
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1007,15 +1005,15 @@ FX_BOOL CJS_PublicMethods::AFPercent_Format(
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CFX_WideString& Value = pEvent->Value();
CFX_ByteString strValue = StrTrim(CFX_ByteString::FromUnicode(Value));
if (strValue.IsEmpty())
- return TRUE;
+ return true;
int iDec = params[0].ToInt(pRuntime);
if (iDec < 0)
@@ -1085,10 +1083,10 @@ FX_BOOL CJS_PublicMethods::AFPercent_Format(
strValue += "%";
Value = CFX_WideString::FromLocal(strValue.AsStringC());
#endif
- return TRUE;
+ return true;
}
// AFPercent_Keystroke(nDec, sepStyle)
-FX_BOOL CJS_PublicMethods::AFPercent_Keystroke(
+bool CJS_PublicMethods::AFPercent_Keystroke(
IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
@@ -1097,25 +1095,25 @@ FX_BOOL CJS_PublicMethods::AFPercent_Keystroke(
}
// function AFDate_FormatEx(cFormat)
-FX_BOOL CJS_PublicMethods::AFDate_FormatEx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFDate_FormatEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CFX_WideString& val = pEvent->Value();
CFX_WideString strValue = val;
if (strValue.IsEmpty())
- return TRUE;
+ return true;
CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
double dDate = 0.0f;
@@ -1133,11 +1131,11 @@ FX_BOOL CJS_PublicMethods::AFDate_FormatEx(IJS_Context* cc,
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
AlertIfPossible(pContext, swMsg.c_str());
- return FALSE;
+ return false;
}
val = MakeFormatDate(dDate, sFormat);
- return TRUE;
+ return true;
}
double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) {
@@ -1197,49 +1195,48 @@ double CJS_PublicMethods::MakeInterDate(const CFX_WideString& strValue) {
}
// AFDate_KeystrokeEx(cFormat)
-FX_BOOL CJS_PublicMethods::AFDate_KeystrokeEx(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFDate_KeystrokeEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (params.size() != 1) {
sError = L"AFDate_KeystrokeEx's parameters' size r not correct";
- return FALSE;
+ return false;
}
if (pEvent->WillCommit()) {
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CFX_WideString strValue = pEvent->Value();
if (strValue.IsEmpty())
- return TRUE;
+ return true;
CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
- bool bWrongFormat = FALSE;
+ bool bWrongFormat = false;
double dRet = MakeRegularDate(strValue, sFormat, &bWrongFormat);
if (bWrongFormat || JS_PortIsNan(dRet)) {
CFX_WideString swMsg;
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
AlertIfPossible(pContext, swMsg.c_str());
- pEvent->Rc() = FALSE;
- return TRUE;
+ pEvent->Rc() = false;
+ return true;
}
}
- return TRUE;
+ return true;
}
-FX_BOOL CJS_PublicMethods::AFDate_Format(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFDate_Format(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1269,14 +1266,13 @@ FX_BOOL CJS_PublicMethods::AFDate_Format(IJS_Context* cc,
}
// AFDate_KeystrokeEx(cFormat)
-FX_BOOL CJS_PublicMethods::AFDate_Keystroke(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFDate_Keystroke(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1306,13 +1302,13 @@ FX_BOOL CJS_PublicMethods::AFDate_Keystroke(
}
// function AFTime_Format(ptf)
-FX_BOOL CJS_PublicMethods::AFTime_Format(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFTime_Format(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1329,14 +1325,13 @@ FX_BOOL CJS_PublicMethods::AFTime_Format(IJS_Context* cc,
return AFDate_FormatEx(cc, newParams, vRet, sError);
}
-FX_BOOL CJS_PublicMethods::AFTime_Keystroke(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFTime_Keystroke(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1353,36 +1348,34 @@ FX_BOOL CJS_PublicMethods::AFTime_Keystroke(
return AFDate_KeystrokeEx(cc, newParams, vRet, sError);
}
-FX_BOOL CJS_PublicMethods::AFTime_FormatEx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFTime_FormatEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
return AFDate_FormatEx(cc, params, vRet, sError);
}
-FX_BOOL CJS_PublicMethods::AFTime_KeystrokeEx(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFTime_KeystrokeEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
return AFDate_KeystrokeEx(cc, params, vRet, sError);
}
// function AFSpecial_Format(psf)
-FX_BOOL CJS_PublicMethods::AFSpecial_Format(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFSpecial_Format(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CFX_WideString wsSource = pEvent->Value();
@@ -1406,11 +1399,11 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Format(
}
pEvent->Value() = util::printx(wsFormat, wsSource);
- return TRUE;
+ return true;
}
// function AFSpecial_KeystrokeEx(mask)
-FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx(
+bool CJS_PublicMethods::AFSpecial_KeystrokeEx(
IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
@@ -1421,20 +1414,20 @@ FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx(
if (params.size() < 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
CFX_WideString& valEvent = pEvent->Value();
CFX_WideString wstrMask = params[0].ToCFXWideString(pRuntime);
if (wstrMask.IsEmpty())
- return TRUE;
+ return true;
if (pEvent->WillCommit()) {
if (valEvent.IsEmpty())
- return TRUE;
+ return true;
FX_STRSIZE iIndexMask = 0;
for (; iIndexMask < valEvent.GetLength(); ++iIndexMask) {
@@ -1446,14 +1439,14 @@ FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx(
(iIndexMask != valEvent.GetLength() && wstrMask.GetLength() != 0)) {
AlertIfPossible(
pContext, JSGetStringFromID(IDS_STRING_JSAFNUMBER_KEYSTROKE).c_str());
- pEvent->Rc() = FALSE;
+ pEvent->Rc() = false;
}
- return TRUE;
+ return true;
}
CFX_WideString& wideChange = pEvent->Change();
if (wideChange.IsEmpty())
- return TRUE;
+ return true;
CFX_WideString wChange = wideChange;
FX_STRSIZE iIndexMask = pEvent->SelStart();
@@ -1462,53 +1455,53 @@ FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx(
if (combined_len > wstrMask.GetLength()) {
AlertIfPossible(pContext,
JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG).c_str());
- pEvent->Rc() = FALSE;
- return TRUE;
+ pEvent->Rc() = false;
+ return true;
}
if (iIndexMask >= wstrMask.GetLength() && !wChange.IsEmpty()) {
AlertIfPossible(pContext,
JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG).c_str());
- pEvent->Rc() = FALSE;
- return TRUE;
+ pEvent->Rc() = false;
+ return true;
}
for (FX_STRSIZE i = 0; i < wChange.GetLength(); ++i) {
if (iIndexMask >= wstrMask.GetLength()) {
AlertIfPossible(pContext,
JSGetStringFromID(IDS_STRING_JSPARAM_TOOLONG).c_str());
- pEvent->Rc() = FALSE;
- return TRUE;
+ pEvent->Rc() = false;
+ return true;
}
FX_WCHAR wMask = wstrMask[iIndexMask];
if (!isReservedMaskChar(wMask))
wChange.SetAt(i, wMask);
if (!maskSatisfied(wChange[i], wMask)) {
- pEvent->Rc() = FALSE;
- return TRUE;
+ pEvent->Rc() = false;
+ return true;
}
iIndexMask++;
}
wideChange = wChange;
- return TRUE;
+ return true;
}
// function AFSpecial_Keystroke(psf)
-FX_BOOL CJS_PublicMethods::AFSpecial_Keystroke(
+bool CJS_PublicMethods::AFSpecial_Keystroke(
IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
const char* cFormat = "";
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1535,13 +1528,13 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Keystroke(
return AFSpecial_KeystrokeEx(cc, params2, vRet, sError);
}
-FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFMergeChange(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
@@ -1554,7 +1547,7 @@ FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc,
if (pEventHandler->WillCommit()) {
vRet = CJS_Value(pRuntime, swValue.c_str());
- return TRUE;
+ return true;
}
CFX_WideString prefix, postfix;
@@ -1573,16 +1566,16 @@ FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc,
vRet =
CJS_Value(pRuntime, (prefix + pEventHandler->Change() + postfix).c_str());
- return TRUE;
+ return true;
}
-FX_BOOL CJS_PublicMethods::AFParseDateEx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFParseDateEx(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1596,20 +1589,20 @@ FX_BOOL CJS_PublicMethods::AFParseDateEx(IJS_Context* cc,
swMsg.Format(JSGetStringFromID(IDS_STRING_JSPARSEDATE).c_str(),
sFormat.c_str());
AlertIfPossible((CJS_Context*)cc, swMsg.c_str());
- return FALSE;
+ return false;
}
vRet = CJS_Value(pRuntime, dDate);
- return TRUE;
+ return true;
}
-FX_BOOL CJS_PublicMethods::AFSimple(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFSimple(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 3) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1618,16 +1611,16 @@ FX_BOOL CJS_PublicMethods::AFSimple(IJS_Context* cc,
params[1].ToDouble(pRuntime),
params[2].ToDouble(pRuntime))));
- return TRUE;
+ return true;
}
-FX_BOOL CJS_PublicMethods::AFMakeNumber(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFMakeNumber(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1637,23 +1630,22 @@ FX_BOOL CJS_PublicMethods::AFMakeNumber(IJS_Context* cc,
vRet.MaybeCoerceToNumber(pRuntime);
if (vRet.GetType() != CJS_Value::VT_number)
vRet = CJS_Value(pRuntime, 0);
- return TRUE;
+ return true;
}
-FX_BOOL CJS_PublicMethods::AFSimple_Calculate(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFSimple_Calculate(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 2) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Value params1 = params[1];
if (!params1.IsArrayObject() && params1.GetType() != CJS_Value::VT_string) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
@@ -1734,35 +1726,34 @@ FX_BOOL CJS_PublicMethods::AFSimple_Calculate(
if (pContext->GetEventHandler()->m_pValue)
pContext->GetEventHandler()->Value() = jsValue.ToCFXWideString(pRuntime);
- return TRUE;
+ return true;
}
/* This function validates the current event to ensure that its value is
** within the specified range. */
-FX_BOOL CJS_PublicMethods::AFRange_Validate(
- IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFRange_Validate(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 4) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
if (!pEvent->m_pValue)
- return FALSE;
+ return false;
if (pEvent->Value().IsEmpty())
- return TRUE;
+ return true;
double dEentValue =
atof(CFX_ByteString::FromUnicode(pEvent->Value()).c_str());
- FX_BOOL bGreaterThan = params[0].ToBool(pRuntime);
+ bool bGreaterThan = params[0].ToBool(pRuntime);
double dGreaterThan = params[1].ToDouble(pRuntime);
- FX_BOOL bLessThan = params[2].ToBool(pRuntime);
+ bool bLessThan = params[2].ToBool(pRuntime);
double dLessThan = params[3].ToDouble(pRuntime);
CFX_WideString swMsg;
@@ -1783,18 +1774,18 @@ FX_BOOL CJS_PublicMethods::AFRange_Validate(
if (!swMsg.IsEmpty()) {
AlertIfPossible(pContext, swMsg.c_str());
- pEvent->Rc() = FALSE;
+ pEvent->Rc() = false;
}
- return TRUE;
+ return true;
}
-FX_BOOL CJS_PublicMethods::AFExtractNums(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool CJS_PublicMethods::AFExtractNums(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
if (params.size() != 1) {
sError = JSGetStringFromID(IDS_STRING_JSPARAMERROR);
- return FALSE;
+ return false;
}
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
@@ -1828,5 +1819,5 @@ FX_BOOL CJS_PublicMethods::AFExtractNums(IJS_Context* cc,
else
vRet.SetNull(pRuntime);
- return TRUE;
+ return true;
}