summaryrefslogtreecommitdiff
path: root/core/src/fxcrt/fxcrt_posix.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-07-27 11:55:29 -0700
committerTom Sepez <tsepez@chromium.org>2015-07-27 11:55:29 -0700
commitff46aaf499edcf153ee2f57c7016587aa96dcfa0 (patch)
tree0a0d92713af476897899b126d180cc6294433d10 /core/src/fxcrt/fxcrt_posix.cpp
parentaafeff816e22c1333c17d8a0eb4fe8927c28142d (diff)
downloadpdfium-ff46aaf499edcf153ee2f57c7016587aa96dcfa0.tar.xz
FX Bool considered harmful, part 3
Try to reland this patch after fixing underlying issues that caused it to be reverted. fx_system.h is the only manual edit. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1258093002 .
Diffstat (limited to 'core/src/fxcrt/fxcrt_posix.cpp')
-rw-r--r--core/src/fxcrt/fxcrt_posix.cpp38
1 files changed, 19 insertions, 19 deletions
diff --git a/core/src/fxcrt/fxcrt_posix.cpp b/core/src/fxcrt/fxcrt_posix.cpp
index 84646efd5c..eb7213e5b0 100644
--- a/core/src/fxcrt/fxcrt_posix.cpp
+++ b/core/src/fxcrt/fxcrt_posix.cpp
@@ -34,17 +34,17 @@ CFXCRT_FileAccess_Posix::~CFXCRT_FileAccess_Posix()
{
Close();
}
-FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode)
+bool CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName, FX_DWORD dwMode)
{
if (m_nFD > -1) {
- return FALSE;
+ return false;
}
int32_t nFlags, nMasks;
FXCRT_Posix_GetFileMode(dwMode, nFlags, nMasks);
m_nFD = open(fileName.GetCStr(), nFlags, nMasks);
return m_nFD > -1;
}
-FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_WideStringC& fileName, FX_DWORD dwMode)
+bool CFXCRT_FileAccess_Posix::Open(const CFX_WideStringC& fileName, FX_DWORD dwMode)
{
return Open(FX_UTF8Encode(fileName), dwMode);
}
@@ -121,48 +121,48 @@ size_t CFXCRT_FileAccess_Posix::WritePos(const void* pBuffer, size_t szBuffer, F
}
return Write(pBuffer, szBuffer);
}
-FX_BOOL CFXCRT_FileAccess_Posix::Flush()
+bool CFXCRT_FileAccess_Posix::Flush()
{
if (m_nFD < 0) {
- return FALSE;
+ return false;
}
return fsync(m_nFD) > -1;
}
-FX_BOOL CFXCRT_FileAccess_Posix::Truncate(FX_FILESIZE szFile)
+bool CFXCRT_FileAccess_Posix::Truncate(FX_FILESIZE szFile)
{
if (m_nFD < 0) {
- return FALSE;
+ return false;
}
return !ftruncate(m_nFD, szFile);
}
-FX_BOOL FX_File_Exist(const CFX_ByteStringC& fileName)
+bool FX_File_Exist(const CFX_ByteStringC& fileName)
{
return access(fileName.GetCStr(), F_OK) > -1;
}
-FX_BOOL FX_File_Exist(const CFX_WideStringC& fileName)
+bool FX_File_Exist(const CFX_WideStringC& fileName)
{
return FX_File_Exist(FX_UTF8Encode(fileName));
}
-FX_BOOL FX_File_Delete(const CFX_ByteStringC& fileName)
+bool FX_File_Delete(const CFX_ByteStringC& fileName)
{
return remove(fileName.GetCStr()) > -1;
}
-FX_BOOL FX_File_Delete(const CFX_WideStringC& fileName)
+bool FX_File_Delete(const CFX_WideStringC& fileName)
{
return FX_File_Delete(FX_UTF8Encode(fileName));
}
-FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst)
+bool FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst)
{
CFXCRT_FileAccess_Posix src, dst;
if (!src.Open(fileNameSrc, FX_FILEMODE_ReadOnly)) {
- return FALSE;
+ return false;
}
FX_FILESIZE size = src.GetSize();
if (!size) {
- return FALSE;
+ return false;
}
if (!dst.Open(fileNameDst, FX_FILEMODE_Truncate)) {
- return FALSE;
+ return false;
}
size_t num = 0;
uint8_t* pBuffer = FX_Alloc(uint8_t, 32768);
@@ -174,17 +174,17 @@ FX_BOOL FX_File_Copy(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC&
num = src.Read(pBuffer, 32768);
}
FX_Free(pBuffer);
- return TRUE;
+ return true;
}
-FX_BOOL FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst)
+bool FX_File_Copy(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst)
{
return FX_File_Copy(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst));
}
-FX_BOOL FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst)
+bool FX_File_Move(const CFX_ByteStringC& fileNameSrc, const CFX_ByteStringC& fileNameDst)
{
return rename(fileNameSrc.GetCStr(), fileNameDst.GetCStr());
}
-FX_BOOL FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst)
+bool FX_File_Move(const CFX_WideStringC& fileNameSrc, const CFX_WideStringC& fileNameDst)
{
return FX_File_Move(FX_UTF8Encode(fileNameSrc), FX_UTF8Encode(fileNameDst));
}