summaryrefslogtreecommitdiff
path: root/core/src/fxcrt/fx_basic_util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fxcrt/fx_basic_util.cpp')
-rw-r--r--core/src/fxcrt/fx_basic_util.cpp80
1 files changed, 40 insertions, 40 deletions
diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp
index 26eeacce1b..1343374111 100644
--- a/core/src/fxcrt/fx_basic_util.cpp
+++ b/core/src/fxcrt/fx_basic_util.cpp
@@ -26,7 +26,7 @@ void FX_PRIVATEDATA::FreeData()
m_pCallback(m_pData);
}
}
-void CFX_PrivateData::AddData(void* pModuleId, void* pData, PD_CALLBACK_FREEDATA callback, FX_BOOL bSelfDestruct)
+void CFX_PrivateData::AddData(void* pModuleId, void* pData, PD_CALLBACK_FREEDATA callback, bool bSelfDestruct)
{
if (pModuleId == NULL) {
return;
@@ -46,26 +46,26 @@ void CFX_PrivateData::AddData(void* pModuleId, void* pData, PD_CALLBACK_FREEDATA
}
void CFX_PrivateData::SetPrivateData(void* pModuleId, void* pData, PD_CALLBACK_FREEDATA callback)
{
- AddData(pModuleId, pData, callback, FALSE);
+ AddData(pModuleId, pData, callback, false);
}
void CFX_PrivateData::SetPrivateObj(void* pModuleId, CFX_DestructObject* pObj)
{
- AddData(pModuleId, pObj, NULL, TRUE);
+ AddData(pModuleId, pObj, NULL, true);
}
-FX_BOOL CFX_PrivateData::RemovePrivateData(void* pModuleId)
+bool CFX_PrivateData::RemovePrivateData(void* pModuleId)
{
if (pModuleId == NULL) {
- return FALSE;
+ return false;
}
FX_PRIVATEDATA* pList = m_DataList.GetData();
int count = m_DataList.GetSize();
for (int i = 0; i < count; i ++) {
if (pList[i].m_pModuleId == pModuleId) {
m_DataList.RemoveAt(i);
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
void* CFX_PrivateData::GetPrivateData(void* pModuleId)
{
@@ -90,18 +90,18 @@ void CFX_PrivateData::ClearAll()
}
m_DataList.RemoveAll();
}
-void FX_atonum(const CFX_ByteStringC& strc, FX_BOOL& bInteger, void* pData)
+void FX_atonum(const CFX_ByteStringC& strc, bool& bInteger, void* pData)
{
if (FXSYS_memchr(strc.GetPtr(), '.', strc.GetLength()) == NULL) {
- bInteger = TRUE;
+ bInteger = true;
int cc = 0, integer = 0;
const FX_CHAR* str = strc.GetCStr();
int len = strc.GetLength();
- FX_BOOL bNegative = FALSE;
+ bool bNegative = false;
if (str[0] == '+') {
cc++;
} else if (str[0] == '-') {
- bNegative = TRUE;
+ bNegative = true;
cc++;
}
while (cc < len) {
@@ -119,7 +119,7 @@ void FX_atonum(const CFX_ByteStringC& strc, FX_BOOL& bInteger, void* pData)
}
*(int*)pData = integer;
} else {
- bInteger = FALSE;
+ bInteger = false;
*(FX_FLOAT*)pData = FX_atof(strc);
}
}
@@ -129,13 +129,13 @@ FX_FLOAT FX_atof(const CFX_ByteStringC& strc)
return 0.0;
}
int cc = 0;
- FX_BOOL bNegative = FALSE;
+ bool bNegative = false;
const FX_CHAR* str = strc.GetCStr();
int len = strc.GetLength();
if (str[0] == '+') {
cc++;
} else if (str[0] == '-') {
- bNegative = TRUE;
+ bNegative = true;
cc++;
}
while (cc < len) {
@@ -187,13 +187,13 @@ void FXSYS_vsnprintf(char *str, size_t size, const char* fmt, va_list ap)
}
#endif // _FXM_PLATFORM_WINDOWS_ && _MSC_VER < 1900
-static FX_BOOL FX_IsDigit(uint8_t ch)
+static bool FX_IsDigit(uint8_t ch)
{
- return (ch >= '0' && ch <= '9') ? TRUE : FALSE;
+ return (ch >= '0' && ch <= '9') ? true : false;
}
-static FX_BOOL FX_IsXDigit(uint8_t ch)
+static bool FX_IsXDigit(uint8_t ch)
{
- return (FX_IsDigit(ch) || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')) ? TRUE : FALSE;
+ return (FX_IsDigit(ch) || (ch >= 'A' && ch <= 'F') || (ch >= 'a' && ch <= 'f')) ? true : false;
}
static uint8_t FX_MakeUpper(uint8_t ch)
{
@@ -299,7 +299,7 @@ class CFindFileData
public:
virtual ~CFindFileData() {}
HANDLE m_Handle;
- FX_BOOL m_bEnd;
+ bool m_bEnd;
};
class CFindFileDataA : public CFindFileData
{
@@ -332,7 +332,7 @@ void* FX_OpenFolder(const FX_CHAR* path)
delete pData;
return NULL;
}
- pData->m_bEnd = FALSE;
+ pData->m_bEnd = false;
return pData;
#else
DIR* dir = opendir(path);
@@ -352,82 +352,82 @@ void* FX_OpenFolder(const FX_WCHAR* path)
delete pData;
return NULL;
}
- pData->m_bEnd = FALSE;
+ pData->m_bEnd = false;
return pData;
#else
DIR* dir = opendir(CFX_ByteString::FromUnicode(path));
return dir;
#endif
}
-FX_BOOL FX_GetNextFile(void* handle, CFX_ByteString& filename, FX_BOOL& bFolder)
+bool FX_GetNextFile(void* handle, CFX_ByteString& filename, bool& bFolder)
{
if (handle == NULL) {
- return FALSE;
+ return false;
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#ifndef _WIN32_WCE
CFindFileDataA* pData = (CFindFileDataA*)handle;
if (pData->m_bEnd) {
- return FALSE;
+ return false;
}
filename = pData->m_FindData.cFileName;
bFolder = pData->m_FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
if (!FindNextFileA(pData->m_Handle, &pData->m_FindData)) {
- pData->m_bEnd = TRUE;
+ pData->m_bEnd = true;
}
- return TRUE;
+ return true;
#else
CFindFileDataW* pData = (CFindFileDataW*)handle;
if (pData->m_bEnd) {
- return FALSE;
+ return false;
}
filename = CFX_ByteString::FromUnicode(pData->m_FindData.cFileName);
bFolder = pData->m_FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
if (!FindNextFileW(pData->m_Handle, &pData->m_FindData)) {
- pData->m_bEnd = TRUE;
+ pData->m_bEnd = true;
}
- return TRUE;
+ return true;
#endif
#elif defined(__native_client__)
abort();
- return FALSE;
+ return false;
#else
struct dirent *de = readdir((DIR*)handle);
if (de == NULL) {
- return FALSE;
+ return false;
}
filename = de->d_name;
bFolder = de->d_type == DT_DIR;
- return TRUE;
+ return true;
#endif
}
-FX_BOOL FX_GetNextFile(void* handle, CFX_WideString& filename, FX_BOOL& bFolder)
+bool FX_GetNextFile(void* handle, CFX_WideString& filename, bool& bFolder)
{
if (handle == NULL) {
- return FALSE;
+ return false;
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
CFindFileDataW* pData = (CFindFileDataW*)handle;
if (pData->m_bEnd) {
- return FALSE;
+ return false;
}
filename = pData->m_FindData.cFileName;
bFolder = pData->m_FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY;
if (!FindNextFileW(pData->m_Handle, &pData->m_FindData)) {
- pData->m_bEnd = TRUE;
+ pData->m_bEnd = true;
}
- return TRUE;
+ return true;
#elif defined(__native_client__)
abort();
- return FALSE;
+ return false;
#else
struct dirent *de = readdir((DIR*)handle);
if (de == NULL) {
- return FALSE;
+ return false;
}
filename = CFX_WideString::FromLocal(de->d_name);
bFolder = de->d_type == DT_DIR;
- return TRUE;
+ return true;
#endif
}
void FX_CloseFolder(void* handle)