From 7d9f7aee0271050d05eb5bc2ea0c1a53bf6f16fa Mon Sep 17 00:00:00 2001 From: Sven Eberhardt Date: Tue, 1 Sep 2015 22:18:39 -0400 Subject: [PATCH] Fix some unused variables and integer type conversions. --- src/editor/C4ConsoleWin32.cpp | 1 + src/game/ClonkMain.cpp | 2 +- src/platform/C4CrashHandlerWin32.cpp | 6 +++--- src/platform/C4WindowWin32.cpp | 8 ++++---- src/platform/StdJoystick.cpp | 8 -------- 5 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/editor/C4ConsoleWin32.cpp b/src/editor/C4ConsoleWin32.cpp index 98d9e0bb0..f9cc33829 100644 --- a/src/editor/C4ConsoleWin32.cpp +++ b/src/editor/C4ConsoleWin32.cpp @@ -715,6 +715,7 @@ void C4ConsoleGUI::DisplayInfoText(C4ConsoleGUI::InfoTextType type, StdStrBuf& t break; default: assert(false); + return; } SetDlgItemTextW(hWindow,dialog_item,text.GetWideChar()); UpdateWindow(GetDlgItem(hWindow,dialog_item)); diff --git a/src/game/ClonkMain.cpp b/src/game/ClonkMain.cpp index a0a18c460..01c944a11 100644 --- a/src/game/ClonkMain.cpp +++ b/src/game/ClonkMain.cpp @@ -154,7 +154,7 @@ static void crash_handler(int signo, siginfo_t * si, void *) case SIGTERM: write(logfd, "SIGTERM", sizeof ("SIGTERM") - 1); break; } char hex[sizeof(void *) * 2]; - int i; intptr_t x = reinterpret_cast(si->si_addr); + intptr_t x = reinterpret_cast(si->si_addr); switch (signo) { case SIGILL: case SIGFPE: case SIGSEGV: case SIGBUS: case SIGTRAP: diff --git a/src/platform/C4CrashHandlerWin32.cpp b/src/platform/C4CrashHandlerWin32.cpp index b2bb535d4..bd3be8555 100644 --- a/src/platform/C4CrashHandlerWin32.cpp +++ b/src/platform/C4CrashHandlerWin32.cpp @@ -172,7 +172,7 @@ namespace { LOG_DYNAMIC_TEXT("Additional information for the exception:\n Assertion that failed: " ASSERTION_INFO_FORMAT "\n File: " ASSERTION_INFO_FORMAT "\n Line: %d\n", reinterpret_cast(exc->ExceptionRecord->ExceptionInformation[0]), reinterpret_cast(exc->ExceptionRecord->ExceptionInformation[1]), - exc->ExceptionRecord->ExceptionInformation[2]); + (int) exc->ExceptionRecord->ExceptionInformation[2]); break; } @@ -317,11 +317,11 @@ namespace { } else if (image_base > 0) { - LOG_DYNAMIC_TEXT("+%#lx", static_cast(frame.AddrPC.Offset - image_base)); + LOG_DYNAMIC_TEXT("+%#lx", static_cast(frame.AddrPC.Offset - image_base)); } else { - LOG_DYNAMIC_TEXT("%#lx", static_cast(frame.AddrPC.Offset)); + LOG_DYNAMIC_TEXT("%#lx", static_cast(frame.AddrPC.Offset)); } DWORD disp; line->SizeOfStruct = sizeof(*line); diff --git a/src/platform/C4WindowWin32.cpp b/src/platform/C4WindowWin32.cpp index 042cc9239..47947f8c2 100644 --- a/src/platform/C4WindowWin32.cpp +++ b/src/platform/C4WindowWin32.cpp @@ -708,7 +708,7 @@ bool C4Window::RestorePosition(const char *szWindowName, const char *szSubKey, b void C4Window::SetTitle(const char *szToTitle) { - if (hWindow) SetWindowTextW(hWindow, szToTitle ? GetWideChar(szToTitle) : L""); + if (hWindow) SetWindowTextW(hWindow, (!szToTitle) ? L"" : GetWideChar(szToTitle)); } bool C4Window::GetSize(C4Rect * pRect) @@ -727,7 +727,7 @@ void C4Window::SetSize(unsigned int cx, unsigned int cy) if (hWindow) { // If bordered, add border size - RECT rect = {0, 0, cx, cy}; + RECT rect = { 0, 0, static_cast(cx), static_cast(cy) }; ::AdjustWindowRectEx(&rect, GetWindowLong(hWindow, GWL_STYLE), FALSE, GetWindowLong(hWindow, GWL_EXSTYLE)); cx = rect.right - rect.left; cy = rect.bottom - rect.top; @@ -828,7 +828,7 @@ bool C4AbstractApp::FlushMessages() void C4AbstractApp::SetLastErrorFromOS() { LPWSTR buffer = 0; - DWORD rv = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, + FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, 0, ::GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast(&buffer), 0, 0); sLastError.Take(StdStrBuf(buffer)); LocalFree(buffer); @@ -925,7 +925,7 @@ bool C4AbstractApp::SetVideoMode(unsigned int iXRes, unsigned int iYRes, unsigne SetLastErrorFromOS(); return false; } - int orientation = dmode.dmDisplayOrientation; + unsigned long orientation = dmode.dmDisplayOrientation; if (iXRes == -1 && iYRes == -1) { dspMode=dmode; diff --git a/src/platform/StdJoystick.cpp b/src/platform/StdJoystick.cpp index 4061dcea8..21f88b714 100644 --- a/src/platform/StdJoystick.cpp +++ b/src/platform/StdJoystick.cpp @@ -20,14 +20,6 @@ #include "C4Include.h" #include -static uint32_t dwStdGamepadAxis1 = 0; -static uint32_t dwStdGamepadAxis2 = 1; - -static uint32_t dwStdGamepadMaxX = 0; -static uint32_t dwStdGamepadMinX = 0; -static uint32_t dwStdGamepadMaxY = 0; -static uint32_t dwStdGamepadMinY = 0; - #include #include