From 159b43e5639b7afb2611573efcea71000bf93be5 Mon Sep 17 00:00:00 2001 From: Sam Edwards Date: Thu, 31 May 2018 19:05:25 -0600 Subject: [PATCH] general: Address a few more compiler warnings --- dtool/src/dtoolbase/pdtoa.cxx | 2 +- panda/src/express/error_utils.cxx | 2 +- panda/src/express/windowsRegistry.cxx | 2 -- panda/src/glstuff/glGraphicsStateGuardian_src.h | 2 +- panda/src/pnmimagetypes/config_pnmimagetypes.cxx | 1 + panda/src/text/textAssembler.cxx | 2 +- panda/src/wgldisplay/wglGraphicsStateGuardian.cxx | 2 -- panda/src/wgldisplay/wglGraphicsWindow.cxx | 2 +- panda/src/windisplay/winGraphicsPipe.cxx | 4 ++-- panda/src/windisplay/winGraphicsWindow.cxx | 7 +++---- 10 files changed, 11 insertions(+), 15 deletions(-) diff --git a/dtool/src/dtoolbase/pdtoa.cxx b/dtool/src/dtoolbase/pdtoa.cxx index 2ef158f4ac..bc50d6ff92 100644 --- a/dtool/src/dtoolbase/pdtoa.cxx +++ b/dtool/src/dtoolbase/pdtoa.cxx @@ -259,7 +259,7 @@ inline static void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, cha *len = 0; while (kappa > 0) { - uint32_t d; + uint32_t d = 0; switch (kappa) { case 10: d = p1 / 1000000000; p1 %= 1000000000; break; case 9: d = p1 / 100000000; p1 %= 100000000; break; diff --git a/panda/src/express/error_utils.cxx b/panda/src/express/error_utils.cxx index bae1da4a31..8a1ec79331 100644 --- a/panda/src/express/error_utils.cxx +++ b/panda/src/express/error_utils.cxx @@ -191,7 +191,7 @@ string handle_socket_error() { return string(strerror(errno)); #else int err = WSAGetLastError(); - char *errmsg; + const char *errmsg; switch (err) { case 10022: errmsg = "An invalid argument was supplied"; diff --git a/panda/src/express/windowsRegistry.cxx b/panda/src/express/windowsRegistry.cxx index 183a3a9c0d..a803234a6c 100644 --- a/panda/src/express/windowsRegistry.cxx +++ b/panda/src/express/windowsRegistry.cxx @@ -34,8 +34,6 @@ set_string_value(const string &key, const string &name, const string &value, TextEncoder encoder; wstring wvalue = encoder.decode_text(value); - bool okflag = true; - // Now convert the string to Windows' idea of the correct wide-char // encoding, so we can store it in the registry. This might well be the // same string we just decoded from, but it might not. diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index ab1d27a2a4..15ecebe439 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -269,7 +269,7 @@ public: virtual int get_driver_shader_version_major(); virtual int get_driver_shader_version_minor(); - static void debug_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, GLvoid *userParam); + static void APIENTRY debug_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *message, GLvoid *userParam); virtual void reset(); diff --git a/panda/src/pnmimagetypes/config_pnmimagetypes.cxx b/panda/src/pnmimagetypes/config_pnmimagetypes.cxx index b115aa5213..7661696980 100644 --- a/panda/src/pnmimagetypes/config_pnmimagetypes.cxx +++ b/panda/src/pnmimagetypes/config_pnmimagetypes.cxx @@ -269,6 +269,7 @@ init_libpnmimagetypes() { // And register with the PandaSystem. PandaSystem *ps = PandaSystem::get_global_ptr(); + (void)ps; // Suppress unused variable warning #ifdef HAVE_JPEG ps->add_system("libjpeg"); diff --git a/panda/src/text/textAssembler.cxx b/panda/src/text/textAssembler.cxx index 6abe29d7a0..86fb8c8434 100644 --- a/panda/src/text/textAssembler.cxx +++ b/panda/src/text/textAssembler.cxx @@ -1412,9 +1412,9 @@ assemble_row(TextAssembler::TextRow &row, bool underscore = false; PN_stdfloat underscore_start = 0.0f; const TextProperties *underscore_properties = nullptr; - const ComputedProperties *prev_cprops = nullptr; #ifdef HAVE_HARFBUZZ + const ComputedProperties *prev_cprops = nullptr; hb_buffer_t *harfbuff = nullptr; #endif diff --git a/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx b/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx index 9d916129a4..aca8f44577 100644 --- a/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx +++ b/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx @@ -123,7 +123,6 @@ get_properties(FrameBufferProperties &properties, HDC hdc, int pfnum) { pfd.cBlueBits, pfd.cAlphaBits); } - int mode = 0; if (pfd.dwFlags & PFD_DOUBLEBUFFER) { properties.set_back_buffers(1); } @@ -193,7 +192,6 @@ get_properties_advanced(FrameBufferProperties &properties, properties.clear(); properties.set_all_specified(); - int frame_buffer_mode = 0; if (ivalue_list[acceleration_i] == WGL_NO_ACCELERATION_ARB) { properties.set_force_software(true); } else { diff --git a/panda/src/wgldisplay/wglGraphicsWindow.cxx b/panda/src/wgldisplay/wglGraphicsWindow.cxx index 06fc3d3ed4..a2aad595c7 100644 --- a/panda/src/wgldisplay/wglGraphicsWindow.cxx +++ b/panda/src/wgldisplay/wglGraphicsWindow.cxx @@ -358,7 +358,7 @@ setup_colormap(const PIXELFORMATDESCRIPTOR &pixelformat) { #ifdef NOTIFY_DEBUG // typedef enum {Software, MCD, ICD} OGLDriverType; -static char *OGLDrvStrings[3] = {"Software","MCD","ICD"}; +static const char *OGLDrvStrings[3] = {"Software","MCD","ICD"}; /** * Reports information about the selected pixel format descriptor, along with diff --git a/panda/src/windisplay/winGraphicsPipe.cxx b/panda/src/windisplay/winGraphicsPipe.cxx index cf76e06296..1861c7d303 100644 --- a/panda/src/windisplay/winGraphicsPipe.cxx +++ b/panda/src/windisplay/winGraphicsPipe.cxx @@ -261,7 +261,7 @@ WinGraphicsPipe() { windisplay_cat.debug() << "Using EnumDisplaySettings to fetch display information.\n"; } pvector display_modes; - DEVMODE dm = {0}; + DEVMODE dm{}; dm.dmSize = sizeof(dm); for (int i = 0; EnumDisplaySettings(NULL, i, &dm) != 0; ++i) { DisplayMode mode; @@ -293,7 +293,7 @@ WinGraphicsPipe() { version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); if (GetVersionEx(&version_info)) { if (windisplay_cat.is_info()) { - sprintf(string, "OS version: %d.%d.%d.%d\n", version_info.dwMajorVersion, version_info.dwMinorVersion, version_info.dwPlatformId, version_info.dwBuildNumber); + sprintf(string, "OS version: %lu.%lu.%lu.%lu\n", version_info.dwMajorVersion, version_info.dwMinorVersion, version_info.dwPlatformId, version_info.dwBuildNumber); windisplay_cat.info() << string; windisplay_cat.info() << " " << version_info.szCSDVersion << "\n"; } diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index f8fa283020..767dd9a4eb 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -69,9 +69,9 @@ static const char * const errorbox_title = "Panda3D Error"; // These static variables contain pointers to the touch input functions, which // are dynamically extracted from USER32.DLL -typedef WINUSERAPI BOOL (WINAPI *PFN_REGISTERTOUCHWINDOW)(IN HWND hWnd, IN ULONG ulFlags); -typedef WINUSERAPI BOOL (WINAPI *PFN_GETTOUCHINPUTINFO)(IN HTOUCHINPUT hTouchInput, IN UINT cInputs, OUT PTOUCHINPUT pInputs, IN int cbSize); -typedef WINUSERAPI BOOL (WINAPI *PFN_CLOSETOUCHINPUTHANDLE)(IN HTOUCHINPUT hTouchInput); +typedef BOOL (WINAPI *PFN_REGISTERTOUCHWINDOW)(IN HWND hWnd, IN ULONG ulFlags); +typedef BOOL (WINAPI *PFN_GETTOUCHINPUTINFO)(IN HTOUCHINPUT hTouchInput, IN UINT cInputs, OUT PTOUCHINPUT pInputs, IN int cbSize); +typedef BOOL (WINAPI *PFN_CLOSETOUCHINPUTHANDLE)(IN HTOUCHINPUT hTouchInput); static PFN_REGISTERTOUCHWINDOW pRegisterTouchWindow = 0; static PFN_GETTOUCHINPUTINFO pGetTouchInputInfo = 0; @@ -1292,7 +1292,6 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { << msg << ", " << wparam << ", " << lparam << ")\n"; } WindowProperties properties; - int button = -1; switch (msg) { case WM_MOUSEMOVE: