Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Unified Diff: fpdfsdk/src/javascript/util.cpp

Issue 1252613002: FX_BOOL considered harmful. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Manual edits. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/javascript/report.cpp ('k') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/util.cpp
diff --git a/fpdfsdk/src/javascript/util.cpp b/fpdfsdk/src/javascript/util.cpp
index c4f03093a790451bd3e3679e040dcaac2bba4bf8..6365b9be41f2960441f08a459372b343582cb737 100644
--- a/fpdfsdk/src/javascript/util.cpp
+++ b/fpdfsdk/src/javascript/util.cpp
@@ -99,7 +99,7 @@ const stru_TbConvert fcTable[] = {
int util::ParstDataType(std::wstring* sFormat)
{
size_t i = 0;
- bool bPercent = FALSE;
+ bool bPercent = false;
for (i=0; i<sFormat->length(); ++i)
{
wchar_t c = (*sFormat)[i];
@@ -137,11 +137,11 @@ int util::ParstDataType(std::wstring* sFormat)
return -1;
}
-FX_BOOL util::printf(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
+bool util::printf(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
int iSize = params.size();
if (iSize < 1)
- return FALSE;
+ return false;
std::wstring c_ConvChar(params[0].ToCFXWideString().c_str());
std::vector<std::wstring> c_strConvers;
int iOffset = 0;
@@ -199,16 +199,16 @@ FX_BOOL util::printf(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
c_strResult.erase(c_strResult.begin());
vRet = c_strResult.c_str();
- return TRUE;
+ return true;
}
-FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
+bool util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
v8::Isolate* isolate = GetIsolate(cc);
int iSize = params.size();
if (iSize < 2)
- return FALSE;
+ return false;
CJS_Value p1(isolate);
p1 = params[0];
@@ -218,13 +218,13 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
if (!p2.ConvertToDate(jsDate))
{
sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPRINT1);
- return FALSE;
+ return false;
}
if (!jsDate.IsValidDate())
{
sError = JSGetStringFromID((CJS_Context*)cc, IDS_STRING_JSPRINT2);
- return FALSE;
+ return false;
}
if (p1.GetType() == VT_number)
@@ -262,11 +262,11 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
jsDate.GetSeconds());
break;
default:
- return FALSE;
+ return false;
}
vRet = swResult.c_str();
- return TRUE;
+ return true;
}
else if (p1.GetType() == VT_string)
{
@@ -280,7 +280,7 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
if (bXFAPicture)
{
- return FALSE; //currently, it doesn't support XFAPicture.
+ return false; //currently, it doesn't support XFAPicture.
}
int iIndex;
@@ -365,9 +365,9 @@ FX_BOOL util::printd(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
cFormat = buf;
vRet = cFormat.c_str();
//rtRet = strFormat.GetBuffer(strFormat.GetLength()+1);
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void util::printd(const std::wstring &cFormat2, CJS_Date jsDate, bool bXFAPicture, std::wstring &cPurpose)
@@ -460,11 +460,11 @@ void util::printd(const std::wstring &cFormat2, CJS_Date jsDate, bool bXFAPictur
cPurpose = cFormat;
}
-FX_BOOL util::printx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
+bool util::printx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
int iSize = params.size();
if (iSize<2)
- return FALSE;
+ return false;
CFX_WideString sFormat = params[0].ToCFXWideString();
CFX_WideString sSource = params[1].ToCFXWideString();
std::string cFormat = CFX_ByteString::FromUnicode(sFormat).c_str();
@@ -472,7 +472,7 @@ FX_BOOL util::printx(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
std::string cDest;
printx(cFormat,cSource,cDest);
vRet = cDest.c_str();
- return TRUE;
+ return true;
}
void util::printx(const std::string &cFormat,const std::string &cSource2,std::string &cPurpose)
@@ -574,19 +574,19 @@ void util::printx(const std::string &cFormat,const std::string &cSource2,std::st
}
}
-FX_BOOL util::scand(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
+bool util::scand(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
v8::Isolate* isolate = GetIsolate(cc);
int iSize = params.size();
if (iSize < 2)
- return FALSE;
+ return false;
CFX_WideString sFormat = params[0].ToCFXWideString();
CFX_WideString sDate = params[1].ToCFXWideString();
double dDate = JS_GetDateTime();
if (sDate.GetLength() > 0)
{
- FX_BOOL bWrongFormat = FALSE;
+ bool bWrongFormat = false;
dDate = CJS_PublicMethods::MakeRegularDate(sDate,sFormat,bWrongFormat);
}
@@ -600,7 +600,7 @@ FX_BOOL util::scand(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value&
vRet.SetNull();
}
- return TRUE;
+ return true;
}
int64_t FX_atoi64(const char *nptr)
@@ -631,15 +631,15 @@ int64_t FX_atoi64(const char *nptr)
return total; /* return result, negated if necessary */
}
-FX_BOOL util::byteToChar(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
+bool util::byteToChar(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
int iSize = params.size();
if (iSize == 0)
- return FALSE;
+ return false;
int nByte = params[0].ToInt();
unsigned char cByte = (unsigned char)nByte;
CFX_WideString csValue;
csValue.Format(L"%c", cByte);
vRet = csValue.c_str();
- return TRUE;
+ return true;
}
« no previous file with comments | « fpdfsdk/src/javascript/report.cpp ('k') | fpdfsdk/src/jsapi/fxjs_v8.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698