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

Unified Diff: core/fxcrt/fxcrt_posix.cpp

Issue 2450183003: Fix some FX_BOOL / int noise in fxcrt. (Closed)
Patch Set: moar Created 4 years, 2 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 | « core/fxcrt/fxcrt_posix.h ('k') | core/fxcrt/fxcrt_stream.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcrt/fxcrt_posix.cpp
diff --git a/core/fxcrt/fxcrt_posix.cpp b/core/fxcrt/fxcrt_posix.cpp
index b5efdc28f46c539335016e7ece4010e00135a627..a96f164c7f16c1b188fa383b976814434970aed3 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);
}
« no previous file with comments | « core/fxcrt/fxcrt_posix.h ('k') | core/fxcrt/fxcrt_stream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698