Przeglądaj źródła

general: Resolve a few compiler warnings

- display: GraphicsWindowProc should have a virtual destructor,
           as it's meant to be subclassed.

- express: set_matrix_view helper should always fail an assert
           when 'size' is wrong, even on release builds.

- express: Fix filename capitalization on some #includes.
           They're normally Windows-only, where case doesn't
           matter, but it's better to be consistent.

- gobj: Fix typo.

- particlesystem: Remove BaseParticle::_last_position.
                  Last position is tracked by PhysicsObject now.

- windisplay: Heed warnings about casting bool to (PVOID).
              Also, per MSDN docs, SPI_SETMOUSETRAILS uses the
              uiParam argument and ignores pvParam, so pass the
              _saved_mouse_trails value in that way.
Sam Edwards 7 lat temu
rodzic
commit
6f62396373

+ 1 - 0
panda/src/display/graphicsWindowProc.h

@@ -32,6 +32,7 @@ class GraphicsWindow;
 class EXPCL_PANDA_DISPLAY GraphicsWindowProc {
 public:
   GraphicsWindowProc();
+  virtual ~GraphicsWindowProc() = default;
 #if defined(__WIN32__) || defined(_WIN32)
   virtual LONG wnd_proc(GraphicsWindow* graphicsWindow, HWND hwnd,
                         UINT msg, WPARAM wparam, LPARAM lparam);

+ 1 - 1
panda/src/express/pointerToArray_ext.I

@@ -38,7 +38,7 @@ INLINE void set_matrix_view(Py_buffer &view, int flags, int length, int size, bo
   } else if (size == 4 && double_prec) {
     mat_size = sizeof(UnalignedLMatrix4d);
   } else {
-    assert(false);
+    nassertv_always(false);
   }
 
   view.len = length * mat_size;

+ 5 - 5
panda/src/express/pointerToArray_ext.h

@@ -97,11 +97,11 @@ __getbuffer__(PyObject *self, Py_buffer *view, int flags) const;
 
 #ifdef _MSC_VER
 // Ugh... MSVC needs this because they still don't have a decent linker.
-#include "PTA_uchar.h"
-#include "PTA_ushort.h"
-#include "PTA_float.h"
-#include "PTA_double.h"
-#include "PTA_int.h"
+#include "pta_uchar.h"
+#include "pta_ushort.h"
+#include "pta_float.h"
+#include "pta_double.h"
+#include "pta_int.h"
 
 template class EXPORT_THIS Extension<PTA_uchar>;
 template class EXPORT_THIS Extension<PTA_ushort>;

+ 1 - 1
panda/src/gobj/textureStage.cxx

@@ -84,7 +84,7 @@ operator = (const TextureStage &other) {
   _combine_rgb_operand2 = other._combine_rgb_operand2;
   _combine_alpha_mode = other._combine_alpha_mode;
   _combine_alpha_source0 = other._combine_alpha_source0;
-  _combine_alpha_operand0 = _combine_alpha_operand0;
+  _combine_alpha_operand0 = other._combine_alpha_operand0;
   _combine_alpha_source1 = other._combine_alpha_source1;
   _combine_alpha_operand1 = other._combine_alpha_operand1;
   _combine_alpha_source2 = other._combine_alpha_source2;

+ 0 - 1
panda/src/particlesystem/baseParticle.cxx

@@ -68,7 +68,6 @@ write(std::ostream &out, int indent) const {
   out.width(indent+2); out<<""; out<<"_lifespan "<<_lifespan<<"\n";
   out.width(indent+2); out<<""; out<<"_alive "<<_alive<<"\n";
   out.width(indent+2); out<<""; out<<"_index "<<_index<<"\n";
-  out.width(indent+2); out<<""; out<<"_last_position "<<_last_position<<"\n";
   PhysicsObject::write(out, indent+2);
   #endif //] NDEBUG
 }

+ 0 - 2
panda/src/particlesystem/baseParticle.h

@@ -62,8 +62,6 @@ private:
   PN_stdfloat _lifespan;
   bool _alive;
   int _index;
-
-  LPoint3 _last_position;
 };
 
 #include "baseParticle.I"

+ 4 - 4
panda/src/windisplay/winGraphicsWindow.cxx

@@ -2210,12 +2210,12 @@ update_cursor_window(WinGraphicsWindow *to_window) {
     // We are leaving a graphics window; we should restore the Win2000
     // effects.
     if (_got_saved_params) {
-      SystemParametersInfo(SPI_SETMOUSETRAILS, 0,
-                           (PVOID)_saved_mouse_trails, 0);
+      SystemParametersInfo(SPI_SETMOUSETRAILS, _saved_mouse_trails,
+                           0, 0);
       SystemParametersInfo(SPI_SETCURSORSHADOW, 0,
-                           (PVOID)_saved_cursor_shadow, 0);
+                           _saved_cursor_shadow ? (PVOID)1 : nullptr, 0);
       SystemParametersInfo(SPI_SETMOUSEVANISH, 0,
-                           (PVOID)_saved_mouse_vanish, 0);
+                           _saved_mouse_vanish ? (PVOID)1 : nullptr, 0);
       _got_saved_params = false;
     }