summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorGlenn Rice <glennricster@gmail.com>2013-02-02 08:17:44 -0600
committerGlenn Rice <glennricster@gmail.com>2013-02-02 08:17:44 -0600
commitb13b5949054444bcce998a57784f53343a452121 (patch)
treee6dc0db4533630a7d65cbe845a6266896b0533d2 /Source/Core/Common
parentc8c75dc9a3a9746989dc345838a0f04299154fc8 (diff)
parentf7fa33f2d618206e6388cc023d17ceb6a04d6af2 (diff)
Merge branch 'compiler-warnings'
This shouldn't break anything so I will go ahead and merge it. Disc scrubbing is tested and works. There is a minor change to how the data is read by using the File::IOFile::ReadBytes method instead of directly using fread, but the data read is the same.
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Src/MemArena.cpp3
-rw-r--r--Source/Core/Common/Src/MemoryUtil.cpp3
-rw-r--r--Source/Core/Common/Src/StringUtil.cpp3
3 files changed, 6 insertions, 3 deletions
diff --git a/Source/Core/Common/Src/MemArena.cpp b/Source/Core/Common/Src/MemArena.cpp
index 26a332f161..1dcdef6672 100644
--- a/Source/Core/Common/Src/MemArena.cpp
+++ b/Source/Core/Common/Src/MemArena.cpp
@@ -43,7 +43,8 @@ void MemArena::GrabLowMemSpace(size_t size)
mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH;
fd = open(ram_temp_file, O_RDWR | O_CREAT, mode);
unlink(ram_temp_file);
- ftruncate(fd, size);
+ if (ftruncate(fd, size) < 0)
+ ERROR_LOG(MEMMAP, "Failed to allocate low memory space");
return;
#endif
}
diff --git a/Source/Core/Common/Src/MemoryUtil.cpp b/Source/Core/Common/Src/MemoryUtil.cpp
index ebfa380be4..0888746d42 100644
--- a/Source/Core/Common/Src/MemoryUtil.cpp
+++ b/Source/Core/Common/Src/MemoryUtil.cpp
@@ -117,7 +117,8 @@ void* AllocateAlignedMemory(size_t size,size_t alignment)
void* ptr = _aligned_malloc(size,alignment);
#else
void* ptr = NULL;
- posix_memalign(&ptr, alignment, size);
+ if (posix_memalign(&ptr, alignment, size) != 0)
+ ERROR_LOG(MEMMAP, "Failed to allocate aligned memory");
;
#endif
diff --git a/Source/Core/Common/Src/StringUtil.cpp b/Source/Core/Common/Src/StringUtil.cpp
index 664987d350..e5c70b2c6b 100644
--- a/Source/Core/Common/Src/StringUtil.cpp
+++ b/Source/Core/Common/Src/StringUtil.cpp
@@ -69,7 +69,8 @@ std::string StringFromFormat(const char* format, ...)
delete[] buf;
#else
va_start(args, format);
- vasprintf(&buf, format, args);
+ if (vasprintf(&buf, format, args) < 0)
+ ERROR_LOG(COMMON, "Unable to allocate memory for string");
va_end(args);
std::string temp = buf;