diff --git a/Common/FileUtil.cpp b/Common/FileUtil.cpp index d18ccecad4..185e970d93 100644 --- a/Common/FileUtil.cpp +++ b/Common/FileUtil.cpp @@ -26,8 +26,10 @@ #include #include -#include "FileUtil.h" -#include "StringUtils.h" + +#include "Common/FileUtil.h" +#include "Common/StringUtils.h" +#include "Common/SysError.h" #ifdef _WIN32 #include "CommonWindows.h" @@ -245,8 +247,7 @@ bool IsDirectory(const std::string &filename) struct stat file_info; int result = stat(copy.c_str(), &file_info); if (result < 0) { - WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", - fn.c_str(), GetLastErrorMsg()); + WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", fn.c_str(), GetLastErrorMsg().c_str()); return false; } return S_ISDIR(file_info.st_mode); @@ -273,14 +274,13 @@ bool Delete(const std::string &filename) { #ifdef _WIN32 if (!DeleteFile(ConvertUTF8ToWString(filename).c_str())) { - WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", - filename.c_str(), GetLastErrorMsg()); + WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", filename.c_str(), GetLastErrorMsg().c_str()); return false; } #else if (unlink(filename.c_str()) == -1) { WARN_LOG(COMMON, "Delete: unlink failed on %s: %s", - filename.c_str(), GetLastErrorMsg()); + filename.c_str(), GetLastErrorMsg().c_str()); return false; } #endif @@ -389,7 +389,7 @@ bool DeleteDir(const std::string &filename) if (rmdir(filename.c_str()) == 0) return true; #endif - ERROR_LOG(COMMON, "DeleteDir: %s: %s", filename.c_str(), GetLastErrorMsg()); + ERROR_LOG(COMMON, "DeleteDir: %s: %s", filename.c_str(), GetLastErrorMsg().c_str()); return false; } @@ -409,7 +409,7 @@ bool Rename(const std::string &srcFilename, const std::string &destFilename) return true; #endif ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s", - srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); + srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); return false; } @@ -428,7 +428,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) return true; #endif ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", - srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); + srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); return false; #else @@ -442,7 +442,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) if (!input) { ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s", - srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); + srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); return false; } @@ -452,7 +452,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) { fclose(input); ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s", - srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); + srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); return false; } @@ -467,7 +467,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) { ERROR_LOG(COMMON, "Copy: failed reading from source, %s --> %s: %s", - srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); + srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); fclose(input); fclose(output); return false; @@ -480,7 +480,7 @@ bool Copy(const std::string &srcFilename, const std::string &destFilename) { ERROR_LOG(COMMON, "Copy: failed writing to output, %s --> %s: %s", - srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg()); + srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); fclose(input); fclose(output); return false; @@ -622,14 +622,12 @@ u64 GetFileSize(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) { - ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", - f, GetLastErrorMsg()); + ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", f, GetLastErrorMsg().c_str()); return 0; } u64 size = ftello(f); if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0)) { - ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", - f, GetLastErrorMsg()); + ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", f, GetLastErrorMsg().c_str()); return 0; } return size; @@ -642,8 +640,7 @@ bool CreateEmptyFile(const std::string &filename) FILE *pFile = OpenCFile(filename, "wb"); if (!pFile) { - ERROR_LOG(COMMON, "CreateEmptyFile: failed %s: %s", - filename.c_str(), GetLastErrorMsg()); + ERROR_LOG(COMMON, "CreateEmptyFile: failed %s: %s", filename.c_str(), GetLastErrorMsg().c_str()); return false; } fclose(pFile); diff --git a/Common/MemoryUtil.cpp b/Common/MemoryUtil.cpp index c834444563..a6f5d5e919 100644 --- a/Common/MemoryUtil.cpp +++ b/Common/MemoryUtil.cpp @@ -23,6 +23,7 @@ #include "Common/Log.h" #include "Common/MemoryUtil.h" #include "Common/StringUtils.h" +#include "Common/SysError.h" #ifdef _WIN32 #include "Common/CommonWindows.h" @@ -257,7 +258,7 @@ void FreeMemoryPages(void *ptr, size_t size) { size = (size + page_size - 1) & (~(page_size - 1)); #ifdef _WIN32 if (!VirtualFree(ptr, 0, MEM_RELEASE)) { - ERROR_LOG(MEMMAP, "FreeMemoryPages failed!\n%s", GetLastErrorMsg()); + ERROR_LOG(MEMMAP, "FreeMemoryPages failed!\n%s", GetLastErrorMsg().c_str()); } #else munmap(ptr, size); @@ -302,13 +303,13 @@ bool ProtectMemoryPages(const void* ptr, size_t size, uint32_t memProtFlags) { #if PPSSPP_PLATFORM(UWP) DWORD oldValue; if (!VirtualProtectFromApp((void *)ptr, size, protect, &oldValue)) { - ERROR_LOG(MEMMAP, "WriteProtectMemory failed!\n%s", GetLastErrorMsg()); + ERROR_LOG(MEMMAP, "WriteProtectMemory failed!\n%s", GetLastErrorMsg().c_str()); return false; } #else DWORD oldValue; if (!VirtualProtect((void *)ptr, size, protect, &oldValue)) { - ERROR_LOG(MEMMAP, "WriteProtectMemory failed!\n%s", GetLastErrorMsg()); + ERROR_LOG(MEMMAP, "WriteProtectMemory failed!\n%s", GetLastErrorMsg().c_str()); return false; } #endif diff --git a/Windows/RawInput.cpp b/Windows/RawInput.cpp index 36d639a4ba..861fa393cd 100644 --- a/Windows/RawInput.cpp +++ b/Windows/RawInput.cpp @@ -27,6 +27,7 @@ #include "Windows/MainWindow.h" #include "Windows/WindowsHost.h" #include "Common/CommonFuncs.h" +#include "Common/SysError.h" #include "Core/Config.h" #ifndef HID_USAGE_PAGE_GENERIC @@ -194,7 +195,7 @@ namespace WindowsRawInput { dev[2].dwFlags = 0; if (!RegisterRawInputDevices(dev, 3, sizeof(RAWINPUTDEVICE))) { - WARN_LOG(SYSTEM, "Unable to register raw input devices: %s", GetLastErrorMsg()); + WARN_LOG(SYSTEM, "Unable to register raw input devices: %s", GetLastErrorMsg().c_str()); } } @@ -283,7 +284,7 @@ namespace WindowsRawInput { LRESULT ProcessChar(HWND hWnd, WPARAM wParam, LPARAM lParam) { KeyInput key; - key.keyCode = wParam; // Note that this is NOT a NKCODE but a Unicode character! + key.keyCode = (int)wParam; // Note that this is NOT a NKCODE but a Unicode character! key.flags = KEY_CHAR; key.deviceId = DEVICE_ID_KEYBOARD; NativeKey(key); diff --git a/Windows/TouchInputHandler.cpp b/Windows/TouchInputHandler.cpp index b4f4bd38c7..3622dac160 100644 --- a/Windows/TouchInputHandler.cpp +++ b/Windows/TouchInputHandler.cpp @@ -5,10 +5,11 @@ #include #include "base/display.h" +#include "base/NativeApp.h" #include "Common/CommonWindows.h" #include "Common/CommonFuncs.h" #include "Common/Log.h" -#include "base/NativeApp.h" +#include "Common/SysError.h" #include "Windows/MainWindow.h" TouchInputHandler::TouchInputHandler() { @@ -95,7 +96,7 @@ void TouchInputHandler::handleTouchEvent(HWND hWnd, UINT message, WPARAM wParam, } closeTouch(touchInputData); } else { - WARN_LOG(SYSTEM, "Failed to read input data: %s", GetLastErrorMsg()); + WARN_LOG(SYSTEM, "Failed to read input data: %s", GetLastErrorMsg().c_str()); } delete [] inputs; } diff --git a/Windows/W32Util/Misc.cpp b/Windows/W32Util/Misc.cpp index c4f9ec1310..aa3e9e432b 100644 --- a/Windows/W32Util/Misc.cpp +++ b/Windows/W32Util/Misc.cpp @@ -201,7 +201,7 @@ GenericListControl::GenericListControl(HWND hwnd, const GenericListViewDef& def) int totalListSize = rect.right-rect.left; for (int i = 0; i < columnCount; i++) { - lvc.cx = columns[i].size * totalListSize; + lvc.cx = (int)(columns[i].size * totalListSize); lvc.pszText = (LPTSTR)columns[i].name; if (columns[i].flags & GLVC_CENTERED) diff --git a/ext/native/gfx/d3d9_shader.cpp b/ext/native/gfx/d3d9_shader.cpp index 2fdec6c41f..bdc0b252e7 100644 --- a/ext/native/gfx/d3d9_shader.cpp +++ b/ext/native/gfx/d3d9_shader.cpp @@ -3,6 +3,7 @@ #include "ppsspp_config.h" #include "d3d9_shader.h" #include "Common/CommonFuncs.h" +#include "Common/SysError.h" #if PPSSPP_API(D3DX9) #include "thin3d/d3dx9_loader.h"