summaryrefslogtreecommitdiff
path: root/Source/Core/Common/FileUtil.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2014-08-30 18:20:13 -0400
committerLioncash <mathew1800@gmail.com>2014-08-30 18:20:13 -0400
commit2c7bcd0d048c2e298a5d1e94cb493c6d879f6dd9 (patch)
tree0159e4c50212488aca33dcff7dbe09ed4e251eed /Source/Core/Common/FileUtil.cpp
parent77aef014a0352d819e8ea63bafb6262b9af485cb (diff)
parenteb535be8741fd8672b5db972ca43360ca14a9a78 (diff)
Merge pull request #911 from lioncash/braces
Clean up brace placements within the project.
Diffstat (limited to 'Source/Core/Common/FileUtil.cpp')
-rw-r--r--Source/Core/Common/FileUtil.cpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/Source/Core/Common/FileUtil.cpp b/Source/Core/Common/FileUtil.cpp
index e84bc6c50b..bac3814185 100644
--- a/Source/Core/Common/FileUtil.cpp
+++ b/Source/Core/Common/FileUtil.cpp
@@ -95,7 +95,8 @@ bool IsDirectory(const std::string &filename)
int result = stat64(copy.c_str(), &file_info);
#endif
- if (result < 0) {
+ if (result < 0)
+ {
WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s",
filename.c_str(), GetLastErrorMsg());
return false;
@@ -133,7 +134,8 @@ bool Delete(const std::string &filename)
return false;
}
#else
- if (unlink(filename.c_str()) == -1) {
+ if (unlink(filename.c_str()) == -1)
+ {
WARN_LOG(COMMON, "Delete: unlink failed on %s: %s",
filename.c_str(), GetLastErrorMsg());
return false;
@@ -413,7 +415,8 @@ u64 GetSize(const std::string &filename)
u64 GetSize(const int fd)
{
struct stat64 buf;
- if (fstat64(fd, &buf) != 0) {
+ if (fstat64(fd, &buf) != 0)
+ {
ERROR_LOG(COMMON, "GetSize: stat failed %i: %s",
fd, GetLastErrorMsg());
return 0;
@@ -426,17 +429,21 @@ u64 GetSize(FILE *f)
{
// can't use off_t here because it can be 32-bit
u64 pos = ftello(f);
- if (fseeko(f, 0, SEEK_END) != 0) {
+ if (fseeko(f, 0, SEEK_END) != 0)
+ {
ERROR_LOG(COMMON, "GetSize: seek failed %p: %s",
f, GetLastErrorMsg());
return 0;
}
+
u64 size = ftello(f);
- if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0)) {
+ if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0))
+ {
ERROR_LOG(COMMON, "GetSize: seek failed %p: %s",
f, GetLastErrorMsg());
return 0;
}
+
return size;
}
@@ -658,8 +665,8 @@ std::string GetCurrentDir()
{
char *dir;
// Get the current working directory (getcwd uses malloc)
- if (!(dir = __getcwd(nullptr, 0))) {
-
+ if (!(dir = __getcwd(nullptr, 0)))
+ {
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s",
GetLastErrorMsg());
return nullptr;