diff --git a/CMakeLists.txt b/CMakeLists.txt index fcb58a7e5b..18e8f1be72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -275,10 +275,6 @@ if(NOT MSVC) elseif(ANDROID) add_definitions(-fsigned-char) endif() - - if(WIN32) - add_definitions(-Wno-write-strings) - endif() else() # Disable warnings about MS-specific _s variants of libc functions add_definitions(-D_CRT_SECURE_NO_WARNINGS) diff --git a/Windows/W32Util/Misc.cpp b/Windows/W32Util/Misc.cpp index f7db70d477..7c2953b2d6 100644 --- a/Windows/W32Util/Misc.cpp +++ b/Windows/W32Util/Misc.cpp @@ -56,7 +56,7 @@ namespace W32Util void NiceSizeFormat(size_t size, char *out) { - char *sizes[] = {"B","KB","MB","GB","TB","PB","EB"}; + const char *sizes[] = {"B","KB","MB","GB","TB","PB","EB"}; int s = 0; int frac = 0; while (size>=1024) @@ -172,7 +172,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.pszText = columns[i].name; + lvc.pszText = (LPTSTR)columns[i].name; if (columns[i].flags & GLVC_CENTERED) lvc.fmt = LVCFMT_CENTER; @@ -385,4 +385,4 @@ void GenericListControl::SelectAll() int GenericListControl::GetSelectedIndex() { return ListView_GetNextItem(handle, -1, LVNI_SELECTED); -} \ No newline at end of file +} diff --git a/Windows/W32Util/Misc.h b/Windows/W32Util/Misc.h index 3602f6a45b..457874450e 100644 --- a/Windows/W32Util/Misc.h +++ b/Windows/W32Util/Misc.h @@ -16,7 +16,7 @@ namespace W32Util struct GenericListViewColumn { - wchar_t *name; + const wchar_t *name; float size; int flags; }; diff --git a/Windows/W32Util/TabControl.cpp b/Windows/W32Util/TabControl.cpp index b2a9545a66..3da65ff4b9 100644 --- a/Windows/W32Util/TabControl.cpp +++ b/Windows/W32Util/TabControl.cpp @@ -15,7 +15,7 @@ TabControl::TabControl(HWND handle, bool noDisplayArea) hasButtons = (GetWindowLong(handle,GWL_STYLE) & TCS_BUTTONS) != 0; } -HWND TabControl::AddTabWindow(wchar_t* className, wchar_t* title, DWORD style) +HWND TabControl::AddTabWindow(const wchar_t* className, const wchar_t *title, DWORD style) { TabInfo info; info.hasBorder = (style & WS_BORDER) != 0; @@ -50,13 +50,13 @@ HWND TabControl::AddTabWindow(wchar_t* className, wchar_t* title, DWORD style) return tabHandle; } -void TabControl::AddTabDialog(Dialog* dialog, wchar_t* title) +void TabControl::AddTabDialog(Dialog* dialog, const wchar_t* title) { HWND handle = dialog->GetDlgHandle(); AddTab(handle,title); } -void TabControl::AddTab(HWND handle, wchar_t* title) +void TabControl::AddTab(HWND handle, const wchar_t* title) { if (showTabTitles) AppendPageToControl(title); @@ -93,13 +93,13 @@ void TabControl::AddTab(HWND handle, wchar_t* title) ShowTab(index); } -int TabControl::AppendPageToControl(wchar_t* title) +int TabControl::AppendPageToControl(const wchar_t *title) { TCITEM tcItem; ZeroMemory (&tcItem,sizeof (tcItem)); tcItem.mask = TCIF_TEXT; tcItem.dwState = 0; - tcItem.pszText = title; + tcItem.pszText = (LPTSTR)title; tcItem.cchTextMax = (int)wcslen(tcItem.pszText)+1; tcItem.iImage = 0; @@ -304,4 +304,4 @@ LRESULT CALLBACK TabControl::wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } return (LRESULT)CallWindowProc((WNDPROC)tabControl->oldProc,hwnd,msg,wParam,lParam); -} \ No newline at end of file +} diff --git a/Windows/W32Util/TabControl.h b/Windows/W32Util/TabControl.h index 4640ec40c9..e6229166c4 100644 --- a/Windows/W32Util/TabControl.h +++ b/Windows/W32Util/TabControl.h @@ -11,9 +11,9 @@ class TabControl public: TabControl(HWND handle, bool noDisplayArea = false); void HandleNotify(LPARAM lParam); - HWND AddTabWindow(wchar_t* className, wchar_t* title, DWORD style = 0); - void AddTabDialog(Dialog* dialog, wchar_t* title); - void AddTab(HWND hwnd, wchar_t* title); + HWND AddTabWindow(const wchar_t* className, const wchar_t* title, DWORD style = 0); + void AddTabDialog(Dialog* dialog, const wchar_t* title); + void AddTab(HWND hwnd, const wchar_t* title); void ShowTab(int index, bool setControlIndex = true); void ShowTab(HWND pageHandle); void NextTab(bool cycle); @@ -33,7 +33,7 @@ public: private: static LRESULT CALLBACK wndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); void OnResize(); - int AppendPageToControl(wchar_t* title); + int AppendPageToControl(const wchar_t* title); struct TabInfo { @@ -52,4 +52,4 @@ private: int currentTab; bool hasButtons; bool noDisplayArea_; -}; \ No newline at end of file +}; diff --git a/Windows/WindowsHost.cpp b/Windows/WindowsHost.cpp index f6110b5493..ce306cbfe0 100644 --- a/Windows/WindowsHost.cpp +++ b/Windows/WindowsHost.cpp @@ -247,7 +247,7 @@ void WindowsHost::BootDone() { Core_EnableStepping(!g_Config.bAutoRun); } -static std::string SymbolMapFilename(const char *currentFilename, char* ext) { +static std::string SymbolMapFilename(const char *currentFilename, const char* ext) { FileInfo info; std::string result = currentFilename; @@ -256,9 +256,9 @@ static std::string SymbolMapFilename(const char *currentFilename, char* ext) { getFileInfo(currentFilename, &info); if (info.isDirectory) { #ifdef _WIN32 - char* slash = "\\"; + const char* slash = "\\"; #else - char* slash = "/"; + const char* slash = "/"; #endif if (!endsWith(result,slash)) result += slash;