summaryrefslogtreecommitdiff
path: root/core/fxcrt/fxcrt_posix.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-10-26 15:33:58 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-26 15:33:58 -0700
commitf39074c0ae47a84c496782f8b75bcce1e1cfdf59 (patch)
tree077b7f12bff3c4aa4d53c6b74fa32e613cc73a27 /core/fxcrt/fxcrt_posix.cpp
parente5cb0b191aed020da99757c117dae014ea65c6ba (diff)
downloadpdfium-f39074c0ae47a84c496782f8b75bcce1e1cfdf59.tar.xz
Fix some FX_BOOL / int noise in fxcrt.chromium/2902
Review-Url: https://codereview.chromium.org/2450183003
Diffstat (limited to 'core/fxcrt/fxcrt_posix.cpp')
-rw-r--r--core/fxcrt/fxcrt_posix.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/core/fxcrt/fxcrt_posix.cpp b/core/fxcrt/fxcrt_posix.cpp
index b5efdc28f4..a96f164c7f 100644
--- a/core/fxcrt/fxcrt_posix.cpp
+++ b/core/fxcrt/fxcrt_posix.cpp
@@ -36,20 +36,24 @@ CFXCRT_FileAccess_Posix::CFXCRT_FileAccess_Posix() : m_nFD(-1) {}
CFXCRT_FileAccess_Posix::~CFXCRT_FileAccess_Posix() {
Close();
}
-FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName,
- uint32_t dwMode) {
- if (m_nFD > -1) {
- return FALSE;
- }
- int32_t nFlags, nMasks;
+
+bool CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName,
+ uint32_t dwMode) {
+ if (m_nFD > -1)
+ return false;
+
+ int32_t nFlags;
+ int32_t nMasks;
FXCRT_Posix_GetFileMode(dwMode, nFlags, nMasks);
m_nFD = open(fileName.c_str(), nFlags, nMasks);
return m_nFD > -1;
}
-FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_WideStringC& fileName,
- uint32_t dwMode) {
+
+bool CFXCRT_FileAccess_Posix::Open(const CFX_WideStringC& fileName,
+ uint32_t dwMode) {
return Open(FX_UTF8Encode(fileName).AsStringC(), dwMode);
}
+
void CFXCRT_FileAccess_Posix::Close() {
if (m_nFD < 0) {
return;
@@ -115,16 +119,18 @@ size_t CFXCRT_FileAccess_Posix::WritePos(const void* pBuffer,
}
return Write(pBuffer, szBuffer);
}
-FX_BOOL CFXCRT_FileAccess_Posix::Flush() {
- if (m_nFD < 0) {
- return FALSE;
- }
+
+bool CFXCRT_FileAccess_Posix::Flush() {
+ if (m_nFD < 0)
+ return false;
+
return fsync(m_nFD) > -1;
}
-FX_BOOL CFXCRT_FileAccess_Posix::Truncate(FX_FILESIZE szFile) {
- if (m_nFD < 0) {
- return FALSE;
- }
+
+bool CFXCRT_FileAccess_Posix::Truncate(FX_FILESIZE szFile) {
+ if (m_nFD < 0)
+ return false;
+
return !ftruncate(m_nFD, szFile);
}