Skip to content

Commit 2c52438

Browse files
committed
[fs linux]: Simplify terniary expressions to bool
1 parent 8e9067e commit 2c52438

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/xenia/base/filesystem_posix.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,7 @@ static int removeCallback(const char* fpath, const struct stat* sb,
8787

8888
bool DeleteFolder(const std::wstring& path) {
8989
return nftw(xe::to_string(path).c_str(), removeCallback, 64,
90-
FTW_DEPTH | FTW_PHYS) == 0
91-
? true
92-
: false;
90+
FTW_DEPTH | FTW_PHYS) == 0;
9391
}
9492

9593
static uint64_t convertUnixtimeToWinFiletime(const timespec& unixtime) {
@@ -120,7 +118,7 @@ bool CreateFile(const std::wstring& path) {
120118
}
121119

122120
bool DeleteFile(const std::wstring& path) {
123-
return (xe::to_string(path).c_str()) == 0 ? true : false;
121+
return xe::to_string(path).c_str() == nullptr;
124122
}
125123

126124
class PosixFileHandle : public FileHandle {
@@ -135,16 +133,16 @@ class PosixFileHandle : public FileHandle {
135133
size_t* out_bytes_read) override {
136134
ssize_t out = pread(handle_, buffer, buffer_length, file_offset);
137135
*out_bytes_read = out;
138-
return out >= 0 ? true : false;
136+
return out >= 0;
139137
}
140138
bool Write(size_t file_offset, const void* buffer, size_t buffer_length,
141139
size_t* out_bytes_written) override {
142140
ssize_t out = pwrite(handle_, buffer, buffer_length, file_offset);
143141
*out_bytes_written = out;
144-
return out >= 0 ? true : false;
142+
return out >= 0;
145143
}
146144
bool SetLength(size_t length) override {
147-
return ftruncate(handle_, length) >= 0 ? true : false;
145+
return ftruncate(handle_, length) >= 0;
148146
}
149147
void Flush() override { fsync(handle_); }
150148

0 commit comments

Comments
 (0)