diff options
| author | Glenn Rice <glennricster@gmail.com> | 2013-02-02 08:17:44 -0600 |
|---|---|---|
| committer | Glenn Rice <glennricster@gmail.com> | 2013-02-02 08:17:44 -0600 |
| commit | b13b5949054444bcce998a57784f53343a452121 (patch) | |
| tree | e6dc0db4533630a7d65cbe845a6266896b0533d2 /Source/Core | |
| parent | c8c75dc9a3a9746989dc345838a0f04299154fc8 (diff) | |
| parent | f7fa33f2d618206e6388cc023d17ceb6a04d6af2 (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')
| -rw-r--r-- | Source/Core/Common/Src/MemArena.cpp | 3 | ||||
| -rw-r--r-- | Source/Core/Common/Src/MemoryUtil.cpp | 3 | ||||
| -rw-r--r-- | Source/Core/Common/Src/StringUtil.cpp | 3 | ||||
| -rw-r--r-- | Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp | 10 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/CompressedBlob.cpp | 2 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/DiscScrubber.cpp | 6 | ||||
| -rw-r--r-- | Source/Core/DiscIO/Src/DiscScrubber.h | 2 |
7 files changed, 16 insertions, 13 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; diff --git a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp index 64d1dc79ba..bb939f4a06 100644 --- a/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp +++ b/Source/Core/Core/Src/IPC_HLE/WII_IPC_HLE.cpp @@ -382,18 +382,18 @@ void ExecuteCommand(u32 _Address) } else { - IWII_IPC_HLE_Device* _pDevice = CreateFileIO(DeviceID, DeviceName); - CmdSuccess = _pDevice->Open(_Address, Mode); + pDevice = CreateFileIO(DeviceID, DeviceName); + CmdSuccess = pDevice->Open(_Address, Mode); INFO_LOG(WII_IPC_FILEIO, "IOP: Open File (Device=%s, ID=%08x, Mode=%i)", - _pDevice->GetDeviceName().c_str(), DeviceID, Mode); + pDevice->GetDeviceName().c_str(), DeviceID, Mode); if (Memory::Read_U32(_Address + 4) == (u32)DeviceID) { - g_FdMap[DeviceID] = _pDevice; + g_FdMap[DeviceID] = pDevice; } else { - delete _pDevice; + delete pDevice; } } diff --git a/Source/Core/DiscIO/Src/CompressedBlob.cpp b/Source/Core/DiscIO/Src/CompressedBlob.cpp index 48ce8f10f3..c4b1aa1385 100644 --- a/Source/Core/DiscIO/Src/CompressedBlob.cpp +++ b/Source/Core/DiscIO/Src/CompressedBlob.cpp @@ -222,7 +222,7 @@ bool CompressFileToBlob(const char* infile, const char* outfile, u32 sub_type, // u64 size = header.block_size; std::fill(in_buf, in_buf + header.block_size, 0); if (scrubbing) - DiscScrubber::GetNextBlock(inf.GetHandle(), in_buf); + DiscScrubber::GetNextBlock(inf, in_buf); else inf.ReadBytes(in_buf, header.block_size); z_stream z; diff --git a/Source/Core/DiscIO/Src/DiscScrubber.cpp b/Source/Core/DiscIO/Src/DiscScrubber.cpp index 841c8283cc..9ea4a1911d 100644 --- a/Source/Core/DiscIO/Src/DiscScrubber.cpp +++ b/Source/Core/DiscIO/Src/DiscScrubber.cpp @@ -127,7 +127,7 @@ bool SetupScrub(const char* filename, int block_size) return success; } -void GetNextBlock(FILE* in, u8* buffer) +void GetNextBlock(File::IOFile& in, u8* buffer) { u64 CurrentOffset = m_BlockCount * m_BlockSize; u64 i = CurrentOffset / CLUSTER_SIZE; @@ -136,12 +136,12 @@ void GetNextBlock(FILE* in, u8* buffer) { DEBUG_LOG(DISCIO, "Freeing 0x%016llx", CurrentOffset); std::fill(buffer, buffer + m_BlockSize, 0xFF); - fseeko(in, m_BlockSize, SEEK_CUR); + in.Seek(m_BlockSize, SEEK_CUR); } else { DEBUG_LOG(DISCIO, "Used 0x%016llx", CurrentOffset); - fread(buffer, m_BlockSize, 1, in); + in.ReadBytes(buffer, m_BlockSize); } m_BlockCount++; diff --git a/Source/Core/DiscIO/Src/DiscScrubber.h b/Source/Core/DiscIO/Src/DiscScrubber.h index 2b17c7b2f4..d1d053f734 100644 --- a/Source/Core/DiscIO/Src/DiscScrubber.h +++ b/Source/Core/DiscIO/Src/DiscScrubber.h @@ -38,7 +38,7 @@ namespace DiscScrubber { bool SetupScrub(const char* filename, int block_size); -void GetNextBlock(FILE* in, u8* buffer); +void GetNextBlock(File::IOFile& in, u8* buffer); void Cleanup(); } // namespace DiscScrubber |
