summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/util.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/util.cpp
parent66bd67023f747c489d7144aaf4ca6222c686cd26 (diff)
downloadpdfium-4cf551577856f89103e162edc761def44ffb96fc.tar.xz
Remove FX_BOOL from fpdfsdk.
Review-Url: https://codereview.chromium.org/2453683011
Diffstat (limited to 'fpdfsdk/javascript/util.cpp')
-rw-r--r--fpdfsdk/javascript/util.cpp77
1 files changed, 38 insertions, 39 deletions
diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp
index 50c4c56ee9..3967ceb0cb 100644
--- a/fpdfsdk/javascript/util.cpp
+++ b/fpdfsdk/javascript/util.cpp
@@ -75,7 +75,7 @@ const TbConvert TbConvertTable[] = {
};
int ParseDataType(std::wstring* sFormat) {
- bool bPercent = FALSE;
+ bool bPercent = false;
for (size_t i = 0; i < sFormat->length(); ++i) {
wchar_t c = (*sFormat)[i];
if (c == L'%') {
@@ -114,14 +114,14 @@ util::util(CJS_Object* pJSObject) : CJS_EmbedObj(pJSObject) {}
util::~util() {}
-FX_BOOL util::printf(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool util::printf(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
int iSize = params.size();
if (iSize < 1)
- return FALSE;
+ return false;
std::wstring c_ConvChar(params[0].ToCFXWideString(pRuntime).c_str());
std::vector<std::wstring> c_strConvers;
int iOffset = 0;
@@ -174,16 +174,16 @@ FX_BOOL util::printf(IJS_Context* cc,
c_strResult.erase(c_strResult.begin());
vRet = CJS_Value(pRuntime, c_strResult.c_str());
- return TRUE;
+ return true;
}
-FX_BOOL util::printd(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool util::printd(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
int iSize = params.size();
if (iSize < 2)
- return FALSE;
+ return false;
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
CJS_Value p1 = params[0];
@@ -191,12 +191,12 @@ FX_BOOL util::printd(IJS_Context* cc,
CJS_Date jsDate;
if (!p2.ConvertToDate(pRuntime, jsDate)) {
sError = JSGetStringFromID(IDS_STRING_JSPRINT1);
- return FALSE;
+ return false;
}
if (!jsDate.IsValidDate(pRuntime)) {
sError = JSGetStringFromID(IDS_STRING_JSPRINT2);
- return FALSE;
+ return false;
}
if (p1.GetType() == CJS_Value::VT_number) {
@@ -224,17 +224,17 @@ FX_BOOL util::printd(IJS_Context* cc,
break;
default:
sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR);
- return FALSE;
+ return false;
}
vRet = CJS_Value(pRuntime, swResult.c_str());
- return TRUE;
+ return true;
}
if (p1.GetType() == CJS_Value::VT_string) {
if (iSize > 2 && params[2].ToBool(pRuntime)) {
sError = JSGetStringFromID(IDS_STRING_JSNOTSUPPORT);
- return FALSE; // currently, it doesn't support XFAPicture.
+ return false; // currently, it doesn't support XFAPicture.
}
// Convert PDF-style format specifiers to wcsftime specifiers. Remove any
@@ -300,21 +300,20 @@ FX_BOOL util::printd(IJS_Context* cc,
wcsftime(buf, 64, cFormat.c_str(), &time);
cFormat = buf;
vRet = CJS_Value(pRuntime, cFormat.c_str());
- return TRUE;
+ return true;
}
sError = JSGetStringFromID(IDS_STRING_JSTYPEERROR);
- return FALSE;
+ return false;
}
-
-FX_BOOL util::printx(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool util::printx(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);
@@ -322,7 +321,7 @@ FX_BOOL util::printx(IJS_Context* cc,
params[1].ToCFXWideString(pRuntime))
.c_str());
- return TRUE;
+ return true;
}
enum CaseMode { kPreserveCase, kUpperCase, kLowerCase };
@@ -426,14 +425,14 @@ CFX_WideString util::printx(const CFX_WideString& wsFormat,
return wsResult;
}
-FX_BOOL util::scand(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool util::scand(IJS_Context* cc,
+ const std::vector<CJS_Value>& params,
+ CJS_Value& vRet,
+ CFX_WideString& sError) {
CJS_Runtime* pRuntime = CJS_Runtime::FromContext(cc);
int iSize = params.size();
if (iSize < 2)
- return FALSE;
+ return false;
CFX_WideString sFormat = params[0].ToCFXWideString(pRuntime);
CFX_WideString sDate = params[1].ToCFXWideString(pRuntime);
@@ -448,26 +447,26 @@ FX_BOOL util::scand(IJS_Context* cc,
vRet.SetNull(pRuntime);
}
- return TRUE;
+ return true;
}
-FX_BOOL util::byteToChar(IJS_Context* cc,
- const std::vector<CJS_Value>& params,
- CJS_Value& vRet,
- CFX_WideString& sError) {
+bool util::byteToChar(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);
int arg = params[0].ToInt(pRuntime);
if (arg < 0 || arg > 255) {
sError = JSGetStringFromID(IDS_STRING_JSVALUEERROR);
- return FALSE;
+ return false;
}
CFX_WideString wStr(static_cast<FX_WCHAR>(arg));
vRet = CJS_Value(pRuntime, wStr.c_str());
- return TRUE;
+ return true;
}