Browse Source

general: Address a few more compiler warnings

Sam Edwards 7 years ago
parent
commit
159b43e563

+ 1 - 1
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;
   *len = 0;
 
 
   while (kappa > 0) {
   while (kappa > 0) {
-    uint32_t d;
+    uint32_t d = 0;
     switch (kappa) {
     switch (kappa) {
       case 10: d = p1 / 1000000000; p1 %= 1000000000; break;
       case 10: d = p1 / 1000000000; p1 %= 1000000000; break;
       case  9: d = p1 /  100000000; p1 %=  100000000; break;
       case  9: d = p1 /  100000000; p1 %=  100000000; break;

+ 1 - 1
panda/src/express/error_utils.cxx

@@ -191,7 +191,7 @@ string handle_socket_error() {
   return string(strerror(errno));
   return string(strerror(errno));
 #else
 #else
   int err = WSAGetLastError();
   int err = WSAGetLastError();
-  char *errmsg;
+  const char *errmsg;
   switch (err) {
   switch (err) {
     case 10022:
     case 10022:
       errmsg =  "An invalid argument was supplied";
       errmsg =  "An invalid argument was supplied";

+ 0 - 2
panda/src/express/windowsRegistry.cxx

@@ -34,8 +34,6 @@ set_string_value(const string &key, const string &name, const string &value,
   TextEncoder encoder;
   TextEncoder encoder;
   wstring wvalue = encoder.decode_text(value);
   wstring wvalue = encoder.decode_text(value);
 
 
-  bool okflag = true;
-
   // Now convert the string to Windows' idea of the correct wide-char
   // 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
   // encoding, so we can store it in the registry.  This might well be the
   // same string we just decoded from, but it might not.
   // same string we just decoded from, but it might not.

+ 1 - 1
panda/src/glstuff/glGraphicsStateGuardian_src.h

@@ -269,7 +269,7 @@ public:
   virtual int get_driver_shader_version_major();
   virtual int get_driver_shader_version_major();
   virtual int get_driver_shader_version_minor();
   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();
   virtual void reset();
 
 

+ 1 - 0
panda/src/pnmimagetypes/config_pnmimagetypes.cxx

@@ -269,6 +269,7 @@ init_libpnmimagetypes() {
 
 
   // And register with the PandaSystem.
   // And register with the PandaSystem.
   PandaSystem *ps = PandaSystem::get_global_ptr();
   PandaSystem *ps = PandaSystem::get_global_ptr();
+  (void)ps; // Suppress unused variable warning
 
 
 #ifdef HAVE_JPEG
 #ifdef HAVE_JPEG
   ps->add_system("libjpeg");
   ps->add_system("libjpeg");

+ 1 - 1
panda/src/text/textAssembler.cxx

@@ -1412,9 +1412,9 @@ assemble_row(TextAssembler::TextRow &row,
   bool underscore = false;
   bool underscore = false;
   PN_stdfloat underscore_start = 0.0f;
   PN_stdfloat underscore_start = 0.0f;
   const TextProperties *underscore_properties = nullptr;
   const TextProperties *underscore_properties = nullptr;
-  const ComputedProperties *prev_cprops = nullptr;
 
 
 #ifdef HAVE_HARFBUZZ
 #ifdef HAVE_HARFBUZZ
+  const ComputedProperties *prev_cprops = nullptr;
   hb_buffer_t *harfbuff = nullptr;
   hb_buffer_t *harfbuff = nullptr;
 #endif
 #endif
 
 

+ 0 - 2
panda/src/wgldisplay/wglGraphicsStateGuardian.cxx

@@ -123,7 +123,6 @@ get_properties(FrameBufferProperties &properties, HDC hdc, int pfnum) {
                              pfd.cBlueBits, pfd.cAlphaBits);
                              pfd.cBlueBits, pfd.cAlphaBits);
   }
   }
 
 
-  int mode = 0;
   if (pfd.dwFlags & PFD_DOUBLEBUFFER) {
   if (pfd.dwFlags & PFD_DOUBLEBUFFER) {
     properties.set_back_buffers(1);
     properties.set_back_buffers(1);
   }
   }
@@ -193,7 +192,6 @@ get_properties_advanced(FrameBufferProperties &properties,
   properties.clear();
   properties.clear();
   properties.set_all_specified();
   properties.set_all_specified();
 
 
-  int frame_buffer_mode = 0;
   if (ivalue_list[acceleration_i] == WGL_NO_ACCELERATION_ARB) {
   if (ivalue_list[acceleration_i] == WGL_NO_ACCELERATION_ARB) {
     properties.set_force_software(true);
     properties.set_force_software(true);
   } else {
   } else {

+ 1 - 1
panda/src/wgldisplay/wglGraphicsWindow.cxx

@@ -358,7 +358,7 @@ setup_colormap(const PIXELFORMATDESCRIPTOR &pixelformat) {
 #ifdef NOTIFY_DEBUG
 #ifdef NOTIFY_DEBUG
 
 
 // typedef enum {Software, MCD, ICD} OGLDriverType;
 // 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
  * Reports information about the selected pixel format descriptor, along with

+ 2 - 2
panda/src/windisplay/winGraphicsPipe.cxx

@@ -261,7 +261,7 @@ WinGraphicsPipe() {
       windisplay_cat.debug() << "Using EnumDisplaySettings to fetch display information.\n";
       windisplay_cat.debug() << "Using EnumDisplaySettings to fetch display information.\n";
     }
     }
     pvector<DisplayMode> display_modes;
     pvector<DisplayMode> display_modes;
-    DEVMODE dm = {0};
+    DEVMODE dm{};
     dm.dmSize = sizeof(dm);
     dm.dmSize = sizeof(dm);
     for (int i = 0; EnumDisplaySettings(NULL, i, &dm) != 0; ++i) {
     for (int i = 0; EnumDisplaySettings(NULL, i, &dm) != 0; ++i) {
       DisplayMode mode;
       DisplayMode mode;
@@ -293,7 +293,7 @@ WinGraphicsPipe() {
   version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
   version_info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
   if (GetVersionEx(&version_info)) {
   if (GetVersionEx(&version_info)) {
     if (windisplay_cat.is_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() << string;
       windisplay_cat.info() << "  " << version_info.szCSDVersion << "\n";
       windisplay_cat.info() << "  " << version_info.szCSDVersion << "\n";
     }
     }

+ 3 - 4
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
 // These static variables contain pointers to the touch input functions, which
 // are dynamically extracted from USER32.DLL
 // 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_REGISTERTOUCHWINDOW pRegisterTouchWindow = 0;
 static PFN_GETTOUCHINPUTINFO pGetTouchInputInfo = 0;
 static PFN_GETTOUCHINPUTINFO pGetTouchInputInfo = 0;
@@ -1292,7 +1292,6 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
       << msg << ", " << wparam << ", " << lparam << ")\n";
       << msg << ", " << wparam << ", " << lparam << ")\n";
   }
   }
   WindowProperties properties;
   WindowProperties properties;
-  int button = -1;
 
 
   switch (msg) {
   switch (msg) {
   case WM_MOUSEMOVE:
   case WM_MOUSEMOVE: