| Index: fpdfsdk/javascript/util.cpp
|
| diff --git a/fpdfsdk/javascript/util.cpp b/fpdfsdk/javascript/util.cpp
|
| index 50c4c56ee9572f544998843a18c9c9de07a8eb52..3967ceb0cb28d2b1fc6a10e06beae27361e2678e 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;
|
| }
|
|
|