Browse Source

general: fix many compilation warnings in GCC 8

rdb 7 years ago
parent
commit
886e1c2f16
68 changed files with 218 additions and 322 deletions
  1. 1 1
      contrib/src/rplight/internalLightManager.cxx
  2. 1 1
      contrib/src/rplight/pointerSlotStorage.h
  3. 1 1
      contrib/src/rplight/rpLight.I
  4. 1 1
      contrib/src/rplight/rpLight.h
  5. 3 3
      contrib/src/rplight/shadowAtlas.cxx
  6. 1 1
      direct/src/dcparser/dcLexer.cxx.prebuilt
  7. 1 1
      direct/src/dcparser/dcLexer.lxx
  8. 4 0
      dtool/src/interrogatedb/py_panda.I
  9. 0 13
      dtool/src/interrogatedb/py_wrappers.cxx
  10. 3 3
      panda/src/bullet/bulletBodyNode.cxx
  11. 1 2
      panda/src/bullet/bulletGhostNode.cxx
  12. 1 1
      panda/src/bullet/bulletHelper.cxx
  13. 1 1
      panda/src/bullet/bulletSoftBodyNode.cxx
  14. 5 5
      panda/src/bullet/bulletTriangleMesh.cxx
  15. 1 1
      panda/src/bullet/bulletWheel.I
  16. 20 20
      panda/src/bullet/bulletWorld.cxx
  17. 3 3
      panda/src/collide/collisionPolygon.I
  18. 2 2
      panda/src/collide/collisionPolygon.h
  19. 1 1
      panda/src/display/graphicsStateGuardian.cxx
  20. 1 1
      panda/src/egg/lexer.cxx.prebuilt
  21. 1 1
      panda/src/egg/lexer.lxx
  22. 1 1
      panda/src/egldisplay/eglGraphicsWindow.cxx
  23. 3 3
      panda/src/express/patchfile.cxx
  24. 1 1
      panda/src/ffmpeg/ffmpegAudioCursor.cxx
  25. 1 1
      panda/src/glstuff/glGeomMunger_src.cxx
  26. 4 4
      panda/src/glstuff/glGraphicsBuffer_src.cxx
  27. 10 5
      panda/src/glstuff/glGraphicsStateGuardian_src.cxx
  28. 10 7
      panda/src/glstuff/glShaderContext_src.cxx
  29. 1 1
      panda/src/glstuff/glShaderContext_src.h
  30. 1 1
      panda/src/gobj/geomLinestrips.cxx
  31. 1 3
      panda/src/gobj/geomVertexArrayFormat.cxx
  32. 3 3
      panda/src/gobj/geomVertexData.I
  33. 6 6
      panda/src/gobj/geomVertexData.cxx
  34. 2 2
      panda/src/gobj/geomVertexData.h
  35. 1 1
      panda/src/gobj/geomVertexReader.cxx
  36. 1 1
      panda/src/gobj/geomVertexWriter.cxx
  37. 6 6
      panda/src/gobj/shader.cxx
  38. 3 3
      panda/src/gobj/texture.cxx
  39. 0 27
      panda/src/linmath/lsimpleMatrix.I
  40. 0 3
      panda/src/linmath/lsimpleMatrix.h
  41. 2 2
      panda/src/ode/odeTriMeshData.cxx
  42. 6 6
      panda/src/parametrics/nurbsSurfaceResult.cxx
  43. 2 2
      panda/src/particlesystem/spriteParticleRenderer.cxx
  44. 1 1
      panda/src/pgraph/camera.I
  45. 2 2
      panda/src/pgraph/geomTransformer.cxx
  46. 1 1
      panda/src/pgraphnodes/shaderGenerator.cxx
  47. 1 1
      panda/src/physics/physicsObject.cxx
  48. 1 1
      panda/src/pipeline/pipeline.cxx
  49. 25 20
      panda/src/pnmimage/pfmFile.cxx
  50. 1 1
      panda/src/pnmimage/pnmimage_base.h
  51. 2 2
      panda/src/pnmimagetypes/pnmFileTypeTGA.cxx
  52. 0 14
      panda/src/pstatclient/pStatCollector.I
  53. 4 4
      panda/src/pstatclient/pStatCollector.h
  54. 10 10
      panda/src/putil/bitArray.cxx
  55. 4 4
      panda/src/putil/doubleBitMask.I
  56. 7 38
      panda/src/putil/factoryBase.cxx
  57. 9 10
      panda/src/putil/factoryBase.h
  58. 0 39
      panda/src/putil/factoryParams.I
  59. 6 6
      panda/src/putil/factoryParams.h
  60. 2 2
      panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx
  61. 3 3
      panda/src/tinydisplay/ztriangle.h
  62. 13 3
      panda/src/tinydisplay/ztriangle_two.h
  63. 1 1
      panda/src/x11display/x11GraphicsWindow.cxx
  64. 3 3
      pandatool/src/objegg/objToEggConverter.cxx
  65. 1 1
      pandatool/src/vrml/vrmlLexer.cxx.prebuilt
  66. 1 1
      pandatool/src/vrml/vrmlLexer.lxx
  67. 1 1
      pandatool/src/xfile/xLexer.cxx.prebuilt
  68. 1 1
      pandatool/src/xfile/xLexer.lxx

+ 1 - 1
contrib/src/rplight/internalLightManager.cxx

@@ -135,7 +135,7 @@ void InternalLightManager::setup_shadows(RPLight* light) {
   }
   }
 
 
   // Init all sources
   // Init all sources
-  for (int i = 0; i < num_sources; ++i) {
+  for (size_t i = 0; i < num_sources; ++i) {
     ShadowSource* source = light->get_shadow_source(i);
     ShadowSource* source = light->get_shadow_source(i);
 
 
     // Set the source as dirty, so it gets updated in the beginning
     // Set the source as dirty, so it gets updated in the beginning

+ 1 - 1
contrib/src/rplight/pointerSlotStorage.h

@@ -170,7 +170,7 @@ public:
     _num_entries--;
     _num_entries--;
 
 
     // Update maximum index
     // Update maximum index
-    if (slot == _max_index) {
+    if ((int)slot == _max_index) {
       while (_max_index >= 0 && !_data[_max_index--]);
       while (_max_index >= 0 && !_data[_max_index--]);
     }
     }
   }
   }

+ 1 - 1
contrib/src/rplight/rpLight.I

@@ -33,7 +33,7 @@
  *
  *
  * @return Amount of shadow sources
  * @return Amount of shadow sources
  */
  */
-inline int RPLight::get_num_shadow_sources() const {
+inline size_t RPLight::get_num_shadow_sources() const {
   return _shadow_sources.size();
   return _shadow_sources.size();
 }
 }
 
 

+ 1 - 1
contrib/src/rplight/rpLight.h

@@ -57,7 +57,7 @@ public:
   virtual void update_shadow_sources() = 0;
   virtual void update_shadow_sources() = 0;
   virtual void write_to_command(GPUCommand &cmd);
   virtual void write_to_command(GPUCommand &cmd);
 
 
-  inline int get_num_shadow_sources() const;
+  inline size_t get_num_shadow_sources() const;
   inline ShadowSource* get_shadow_source(size_t index) const;
   inline ShadowSource* get_shadow_source(size_t index) const;
   inline void clear_shadow_sources();
   inline void clear_shadow_sources();
 
 

+ 3 - 3
contrib/src/rplight/shadowAtlas.cxx

@@ -173,12 +173,12 @@ LVecBase4i ShadowAtlas::find_and_reserve_region(size_t tile_width, size_t tile_h
 void ShadowAtlas::free_region(const LVecBase4i& region) {
 void ShadowAtlas::free_region(const LVecBase4i& region) {
   // Out of bounds check, can't hurt
   // Out of bounds check, can't hurt
   nassertv(region.get_x() >= 0 && region.get_y() >= 0);
   nassertv(region.get_x() >= 0 && region.get_y() >= 0);
-  nassertv(region.get_x() + region.get_z() <= _num_tiles && region.get_y() + region.get_w() <= _num_tiles);
+  nassertv(region.get_x() + region.get_z() <= (int)_num_tiles && region.get_y() + region.get_w() <= (int)_num_tiles);
 
 
   _num_used_tiles -= region.get_z() * region.get_w();
   _num_used_tiles -= region.get_z() * region.get_w();
 
 
-  for (size_t x = 0; x < region.get_z(); ++x) {
-    for (size_t y = 0; y < region.get_w(); ++y) {
+  for (int x = 0; x < region.get_z(); ++x) {
+    for (int y = 0; y < region.get_w(); ++y) {
       // Could do an assert here, that the tile should have been used (=true) before
       // Could do an assert here, that the tile should have been used (=true) before
       set_tile(region.get_x() + x, region.get_y() + y, false);
       set_tile(region.get_x() + x, region.get_y() + y, false);
     }
     }

+ 1 - 1
direct/src/dcparser/dcLexer.cxx.prebuilt

@@ -744,7 +744,7 @@ input_chars(char *buffer, int &result, int max_size) {
 // Define this macro carefully, since different flex versions call it
 // Define this macro carefully, since different flex versions call it
 // with a different type for result.
 // with a different type for result.
 #define YY_INPUT(buffer, result, max_size) { \
 #define YY_INPUT(buffer, result, max_size) { \
-  int int_result; \
+  int int_result = 0; \
   input_chars((buffer), int_result, (max_size)); \
   input_chars((buffer), int_result, (max_size)); \
   (result) = int_result; \
   (result) = int_result; \
 }
 }

+ 1 - 1
direct/src/dcparser/dcLexer.lxx

@@ -169,7 +169,7 @@ input_chars(char *buffer, int &result, int max_size) {
 // Define this macro carefully, since different flex versions call it
 // Define this macro carefully, since different flex versions call it
 // with a different type for result.
 // with a different type for result.
 #define YY_INPUT(buffer, result, max_size) { \
 #define YY_INPUT(buffer, result, max_size) { \
-  int int_result; \
+  int int_result = 0; \
   input_chars((buffer), int_result, (max_size)); \
   input_chars((buffer), int_result, (max_size)); \
   (result) = int_result; \
   (result) = int_result; \
 }
 }

+ 4 - 0
dtool/src/interrogatedb/py_panda.I

@@ -31,6 +31,8 @@ DtoolInstance_GetPointer(PyObject *self, T *&into) {
       if (_IS_FINAL(T)) {
       if (_IS_FINAL(T)) {
         if (DtoolInstance_TYPE(self) == target_class) {
         if (DtoolInstance_TYPE(self) == target_class) {
           into = (T *)DtoolInstance_VOID_PTR(self);
           into = (T *)DtoolInstance_VOID_PTR(self);
+        } else {
+          return false;
         }
         }
       } else {
       } else {
         into = (T *)DtoolInstance_UPCAST(self, *target_class);
         into = (T *)DtoolInstance_UPCAST(self, *target_class);
@@ -52,6 +54,8 @@ DtoolInstance_GetPointer(PyObject *self, T *&into, Dtool_PyTypedObject &target_c
     if (_IS_FINAL(T)) {
     if (_IS_FINAL(T)) {
       if (DtoolInstance_TYPE(self) == &target_class) {
       if (DtoolInstance_TYPE(self) == &target_class) {
         into = (T *)DtoolInstance_VOID_PTR(self);
         into = (T *)DtoolInstance_VOID_PTR(self);
+      } else {
+        return false;
       }
       }
     } else {
     } else {
       into = (T *)DtoolInstance_UPCAST(self, target_class);
       into = (T *)DtoolInstance_UPCAST(self, target_class);

+ 0 - 13
dtool/src/interrogatedb/py_wrappers.cxx

@@ -1209,19 +1209,6 @@ static PyObject *Dtool_MappingWrapper_Keys_repr(PyObject *self) {
   return result;
   return result;
 }
 }
 
 
-static PySequenceMethods Dtool_MappingWrapper_Keys_SequenceMethods = {
-  Dtool_SequenceWrapper_length,
-  nullptr, // sq_concat
-  nullptr, // sq_repeat
-  Dtool_MappingWrapper_Items_getitem,
-  nullptr, // sq_slice
-  nullptr, // sq_ass_item
-  nullptr, // sq_ass_slice
-  Dtool_MappingWrapper_contains,
-  nullptr, // sq_inplace_concat
-  nullptr, // sq_inplace_repeat
-};
-
 PyTypeObject Dtool_MappingWrapper_Keys_Type = {
 PyTypeObject Dtool_MappingWrapper_Keys_Type = {
   PyVarObject_HEAD_INIT(nullptr, 0)
   PyVarObject_HEAD_INIT(nullptr, 0)
   "sequence wrapper",
   "sequence wrapper",

+ 3 - 3
panda/src/bullet/bulletBodyNode.cxx

@@ -784,7 +784,7 @@ add_shapes_from_collision_solids(CollisionNode *cnode) {
 
 
   PT(BulletTriangleMesh) mesh = nullptr;
   PT(BulletTriangleMesh) mesh = nullptr;
 
 
-  for (int j=0; j<cnode->get_num_solids(); j++) {
+  for (size_t j = 0; j < cnode->get_num_solids(); ++j) {
     CPT(CollisionSolid) solid = cnode->get_solid(j);
     CPT(CollisionSolid) solid = cnode->get_solid(j);
     TypeHandle type = solid->get_type();
     TypeHandle type = solid->get_type();
 
 
@@ -819,9 +819,9 @@ add_shapes_from_collision_solids(CollisionNode *cnode) {
          mesh = new BulletTriangleMesh();
          mesh = new BulletTriangleMesh();
       }
       }
 
 
-      for (int i=2; i < polygon->get_num_points(); i++ ) {
+      for (size_t i = 2; i < polygon->get_num_points(); ++i) {
         LPoint3 p1 = polygon->get_point(0);
         LPoint3 p1 = polygon->get_point(0);
-        LPoint3 p2 = polygon->get_point(i-1);
+        LPoint3 p2 = polygon->get_point(i - 1);
         LPoint3 p3 = polygon->get_point(i);
         LPoint3 p3 = polygon->get_point(i);
 
 
         mesh->do_add_triangle(p1, p2, p3, true);
         mesh->do_add_triangle(p1, p2, p3, true);

+ 1 - 2
panda/src/bullet/bulletGhostNode.cxx

@@ -97,8 +97,7 @@ do_transform_changed() {
     if (ts->has_scale()) {
     if (ts->has_scale()) {
       LVecBase3 scale = ts->get_scale();
       LVecBase3 scale = ts->get_scale();
       if (!scale.almost_equal(LVecBase3(1.0f, 1.0f, 1.0f))) {
       if (!scale.almost_equal(LVecBase3(1.0f, 1.0f, 1.0f))) {
-        for (int i=0; i < _shapes.size(); i++) {
-          PT(BulletShape) shape = _shapes[i];
+        for (BulletShape *shape : _shapes) {
           shape->do_set_local_scale(scale);
           shape->do_set_local_scale(scale);
         }
         }
       }
       }

+ 1 - 1
panda/src/bullet/bulletHelper.cxx

@@ -83,7 +83,7 @@ from_collision_solids(NodePath &np, bool clear) {
 bool BulletHelper::
 bool BulletHelper::
 is_tangible(CollisionNode *cnode) {
 is_tangible(CollisionNode *cnode) {
 
 
-  for (int j=0; j<cnode->get_num_solids(); j++) {
+  for (size_t j = 0; j < cnode->get_num_solids(); ++j) {
     CPT(CollisionSolid) solid = cnode->get_solid(j);
     CPT(CollisionSolid) solid = cnode->get_solid(j);
     if (solid->is_tangible()) {
     if (solid->is_tangible()) {
         return true;
         return true;

+ 1 - 1
panda/src/bullet/bulletSoftBodyNode.cxx

@@ -883,7 +883,7 @@ make_tri_mesh(BulletSoftBodyWorldInfo &info, const Geom *geom, bool randomizeCon
   }
   }
 
 
   // Read indices
   // Read indices
-  for (int i=0; i<geom->get_num_primitives(); i++) {
+  for (size_t i = 0; i < geom->get_num_primitives(); ++i) {
 
 
     CPT(GeomPrimitive) prim = geom->get_primitive(i);
     CPT(GeomPrimitive) prim = geom->get_primitive(i);
     prim = prim->decompose();
     prim = prim->decompose();

+ 5 - 5
panda/src/bullet/bulletTriangleMesh.cxx

@@ -55,7 +55,7 @@ LPoint3 BulletTriangleMesh::
 get_vertex(size_t index) const {
 get_vertex(size_t index) const {
   LightMutexHolder holder(BulletWorld::get_global_lock());
   LightMutexHolder holder(BulletWorld::get_global_lock());
 
 
-  nassertr(index < _vertices.size(), LPoint3::zero());
+  nassertr(index < (size_t)_vertices.size(), LPoint3::zero());
   const btVector3 &vertex = _vertices[index];
   const btVector3 &vertex = _vertices[index];
   return LPoint3(vertex[0], vertex[1], vertex[2]);
   return LPoint3(vertex[0], vertex[1], vertex[2]);
 }
 }
@@ -68,7 +68,7 @@ get_triangle(size_t index) const {
   LightMutexHolder holder(BulletWorld::get_global_lock());
   LightMutexHolder holder(BulletWorld::get_global_lock());
 
 
   index *= 3;
   index *= 3;
-  nassertr(index + 2 < _indices.size(), LVecBase3i::zero());
+  nassertr(index + 2 < (size_t)_indices.size(), LVecBase3i::zero());
   return LVecBase3i(_indices[index], _indices[index + 1], _indices[index + 2]);
   return LVecBase3i(_indices[index], _indices[index + 1], _indices[index + 2]);
 }
 }
 
 
@@ -228,7 +228,7 @@ add_geom(const Geom *geom, bool remove_duplicate_vertices, const TransformState
       }
       }
     }
     }
 
 
-    for (int k = 0; k < geom->get_num_primitives(); ++k) {
+    for (size_t k = 0; k < geom->get_num_primitives(); ++k) {
       CPT(GeomPrimitive) prim = geom->get_primitive(k);
       CPT(GeomPrimitive) prim = geom->get_primitive(k);
       prim = prim->decompose();
       prim = prim->decompose();
 
 
@@ -271,7 +271,7 @@ add_geom(const Geom *geom, bool remove_duplicate_vertices, const TransformState
     }
     }
 
 
     // Add triangles
     // Add triangles
-    for (int k = 0; k < geom->get_num_primitives(); ++k) {
+    for (size_t k = 0; k < geom->get_num_primitives(); ++k) {
       CPT(GeomPrimitive) prim = geom->get_primitive(k);
       CPT(GeomPrimitive) prim = geom->get_primitive(k);
       prim = prim->decompose();
       prim = prim->decompose();
 
 
@@ -367,7 +367,7 @@ write(std::ostream &out, int indent_level) const {
   indent(out, indent_level) << get_type() << ":" << endl;
   indent(out, indent_level) << get_type() << ":" << endl;
 
 
   const IndexedMeshArray &array = _mesh.getIndexedMeshArray();
   const IndexedMeshArray &array = _mesh.getIndexedMeshArray();
-  for (size_t i = 0; i < array.size(); ++i) {
+  for (int i = 0; i < array.size(); ++i) {
     indent(out, indent_level + 2) << "IndexedMesh " << i << ":" << endl;
     indent(out, indent_level + 2) << "IndexedMesh " << i << ":" << endl;
     const btIndexedMesh &mesh = array[0];
     const btIndexedMesh &mesh = array[0];
     indent(out, indent_level + 4) << "num triangles:" << mesh.m_numTriangles << endl;
     indent(out, indent_level + 4) << "num triangles:" << mesh.m_numTriangles << endl;

+ 1 - 1
panda/src/bullet/bulletWheel.I

@@ -34,7 +34,7 @@ INLINE BulletWheelRaycastInfo::
 INLINE BulletWheel BulletWheel::
 INLINE BulletWheel BulletWheel::
 empty() {
 empty() {
 
 
-  btWheelInfoConstructionInfo ci;
+  btWheelInfoConstructionInfo ci {};
   btWheelInfo info(ci);
   btWheelInfo info(ci);
 
 
   return BulletWheel(info);
   return BulletWheel(info);

+ 20 - 20
panda/src/bullet/bulletWorld.cxx

@@ -42,7 +42,7 @@ BulletWorld::
 BulletWorld() {
 BulletWorld() {
 
 
   // Init groups filter matrix
   // Init groups filter matrix
-  for (int i=0; i<32; i++) {
+  for (size_t i = 0; i < 32; ++i) {
     _filter_cb2._collide[i].clear();
     _filter_cb2._collide[i].clear();
     _filter_cb2._collide[i].set_bit(i);
     _filter_cb2._collide[i].set_bit(i);
   }
   }
@@ -253,20 +253,20 @@ do_physics(PN_stdfloat dt, int max_substeps, PN_stdfloat stepsize) {
 void BulletWorld::
 void BulletWorld::
 do_sync_p2b(PN_stdfloat dt, int num_substeps) {
 do_sync_p2b(PN_stdfloat dt, int num_substeps) {
 
 
-  for (int i=0; i < _bodies.size(); i++) {
-    _bodies[i]->do_sync_p2b();
+  for (BulletRigidBodyNode *body : _bodies) {
+    body->do_sync_p2b();
   }
   }
 
 
-  for (int i=0; i < _softbodies.size(); i++) {
-    _softbodies[i]->do_sync_p2b();
+  for (BulletSoftBodyNode *softbody : _softbodies) {
+    softbody->do_sync_p2b();
   }
   }
 
 
-  for (int i=0; i < _ghosts.size(); i++) {
-    _ghosts[i]->do_sync_p2b();
+  for (BulletGhostNode *ghost : _ghosts) {
+    ghost->do_sync_p2b();
   }
   }
 
 
-  for (int i=0; i < _characters.size(); i++) {
-    _characters[i]->do_sync_p2b(dt, num_substeps);
+  for (BulletBaseCharacterControllerNode *character : _characters) {
+    character->do_sync_p2b(dt, num_substeps);
   }
   }
 }
 }
 
 
@@ -276,24 +276,24 @@ do_sync_p2b(PN_stdfloat dt, int num_substeps) {
 void BulletWorld::
 void BulletWorld::
 do_sync_b2p() {
 do_sync_b2p() {
 
 
-  for (int i=0; i < _vehicles.size(); i++) {
-    _vehicles[i]->do_sync_b2p();
+  for (BulletVehicle *vehicle : _vehicles) {
+    vehicle->do_sync_b2p();
   }
   }
 
 
-  for (int i=0; i < _bodies.size(); i++) {
-    _bodies[i]->do_sync_b2p();
+  for (BulletRigidBodyNode *body : _bodies) {
+    body->do_sync_b2p();
   }
   }
 
 
-  for (int i=0; i < _softbodies.size(); i++) {
-    _softbodies[i]->do_sync_b2p();
+  for (BulletSoftBodyNode *softbody : _softbodies) {
+    softbody->do_sync_b2p();
   }
   }
 
 
-  for (int i=0; i < _ghosts.size(); i++) {
-    _ghosts[i]->do_sync_b2p();
+  for (BulletGhostNode *ghost : _ghosts) {
+    ghost->do_sync_b2p();
   }
   }
 
 
-  for (int i=0; i < _characters.size(); i++) {
-    _characters[i]->do_sync_b2p();
+  for (BulletBaseCharacterControllerNode *character : _characters) {
+    character->do_sync_b2p();
   }
   }
 }
 }
 
 
@@ -1273,7 +1273,7 @@ needBroadphaseCollision(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1) co
 
 
 // cout << mask0 << "   " << mask1 << endl;
 // cout << mask0 << "   " << mask1 << endl;
 
 
-  for (int i=0; i<32; i++) {
+  for (size_t i = 0; i < 32; ++i) {
     if (mask0.get_bit(i)) {
     if (mask0.get_bit(i)) {
       if ((_collide[i] & mask1) != 0)
       if ((_collide[i] & mask1) != 0)
 // cout << "collide: i=" << i << " _collide[i]" << _collide[i] << endl;
 // cout << "collide: i=" << i << " _collide[i]" << _collide[i] << endl;

+ 3 - 3
panda/src/collide/collisionPolygon.I

@@ -57,7 +57,7 @@ CollisionPolygon() {
 /**
 /**
  * Returns the number of vertices of the CollisionPolygon.
  * Returns the number of vertices of the CollisionPolygon.
  */
  */
-INLINE int CollisionPolygon::
+INLINE size_t CollisionPolygon::
 get_num_points() const {
 get_num_points() const {
   return _points.size();
   return _points.size();
 }
 }
@@ -66,8 +66,8 @@ get_num_points() const {
  * Returns the nth vertex of the CollisionPolygon, expressed in 3-D space.
  * Returns the nth vertex of the CollisionPolygon, expressed in 3-D space.
  */
  */
 INLINE LPoint3 CollisionPolygon::
 INLINE LPoint3 CollisionPolygon::
-get_point(int n) const {
-  nassertr(n >= 0 && n < (int)_points.size(), LPoint3::zero());
+get_point(size_t n) const {
+  nassertr(n < _points.size(), LPoint3::zero());
   LMatrix4 to_3d_mat;
   LMatrix4 to_3d_mat;
   rederive_to_3d_mat(to_3d_mat);
   rederive_to_3d_mat(to_3d_mat);
   return to_3d(_points[n]._p, to_3d_mat);
   return to_3d(_points[n]._p, to_3d_mat);

+ 2 - 2
panda/src/collide/collisionPolygon.h

@@ -45,8 +45,8 @@ public:
 PUBLISHED:
 PUBLISHED:
   virtual LPoint3 get_collision_origin() const;
   virtual LPoint3 get_collision_origin() const;
 
 
-  INLINE int get_num_points() const;
-  INLINE LPoint3 get_point(int n) const;
+  INLINE size_t get_num_points() const;
+  INLINE LPoint3 get_point(size_t n) const;
   MAKE_SEQ(get_points, get_num_points, get_point);
   MAKE_SEQ(get_points, get_num_points, get_point);
 
 
 
 

+ 1 - 1
panda/src/display/graphicsStateGuardian.cxx

@@ -763,7 +763,7 @@ get_geom_munger(const RenderState *state, Thread *current_thread) {
     // multiple times during a frame.  Also, this might well be the only GSG
     // multiple times during a frame.  Also, this might well be the only GSG
     // in the world anyway.
     // in the world anyway.
     int mi = state->_last_mi;
     int mi = state->_last_mi;
-    if (mi >= 0 && mi < mungers.get_num_entries() && mungers.get_key(mi) == _id) {
+    if (mi >= 0 && (size_t)mi < mungers.get_num_entries() && mungers.get_key(mi) == _id) {
       PT(GeomMunger) munger = mungers.get_data(mi);
       PT(GeomMunger) munger = mungers.get_data(mi);
       if (munger->is_registered()) {
       if (munger->is_registered()) {
         return munger;
         return munger;

+ 1 - 1
panda/src/egg/lexer.cxx.prebuilt

@@ -1145,7 +1145,7 @@ input_chars(char *buffer, int &result, int max_size) {
 // Define this macro carefully, since different flex versions call it
 // Define this macro carefully, since different flex versions call it
 // with a different type for result.
 // with a different type for result.
 #define YY_INPUT(buffer, result, max_size) { \
 #define YY_INPUT(buffer, result, max_size) { \
-  int int_result; \
+  int int_result = 0; \
   input_chars((buffer), int_result, (max_size)); \
   input_chars((buffer), int_result, (max_size)); \
   (result) = int_result; \
   (result) = int_result; \
 }
 }

+ 1 - 1
panda/src/egg/lexer.lxx

@@ -200,7 +200,7 @@ input_chars(char *buffer, int &result, int max_size) {
 // Define this macro carefully, since different flex versions call it
 // Define this macro carefully, since different flex versions call it
 // with a different type for result.
 // with a different type for result.
 #define YY_INPUT(buffer, result, max_size) { \
 #define YY_INPUT(buffer, result, max_size) { \
-  int int_result; \
+  int int_result = 0; \
   input_chars((buffer), int_result, (max_size)); \
   input_chars((buffer), int_result, (max_size)); \
   (result) = int_result; \
   (result) = int_result; \
 }
 }

+ 1 - 1
panda/src/egldisplay/eglGraphicsWindow.cxx

@@ -84,7 +84,7 @@ move_pointer(int device, int x, int y) {
     return true;
     return true;
   } else {
   } else {
     // Move a raw mouse.
     // Move a raw mouse.
-    if ((device < 1)||(device >= _input_devices.size())) {
+    if (device < 1 || (size_t)device >= _input_devices.size()) {
       return false;
       return false;
     }
     }
     _input_devices[device].set_pointer_in_window(x, y);
     _input_devices[device].set_pointer_in_window(x, y);

+ 3 - 3
panda/src/express/patchfile.cxx

@@ -1111,7 +1111,7 @@ compute_mf_patches(ostream &write_stream,
                             index_orig, index_new)) {
                             index_orig, index_new)) {
       return false;
       return false;
     }
     }
-    nassertr(_add_pos + _cache_add_data.size() + _cache_copy_length == offset_new + mf_new.get_index_end(), false);
+    nassertr(_add_pos + _cache_add_data.size() + _cache_copy_length == offset_new + (uint32_t)mf_new.get_index_end(), false);
   }
   }
 
 
   // Now walk through each subfile in the new multifile.  If a particular
   // Now walk through each subfile in the new multifile.  If a particular
@@ -1120,7 +1120,7 @@ compute_mf_patches(ostream &write_stream,
   // removed, we simply don't add it (we'll never even notice this case).
   // removed, we simply don't add it (we'll never even notice this case).
   int new_num_subfiles = mf_new.get_num_subfiles();
   int new_num_subfiles = mf_new.get_num_subfiles();
   for (int ni = 0; ni < new_num_subfiles; ++ni) {
   for (int ni = 0; ni < new_num_subfiles; ++ni) {
-    nassertr(_add_pos + _cache_add_data.size() + _cache_copy_length == offset_new + mf_new.get_subfile_internal_start(ni), false);
+    nassertr(_add_pos + _cache_add_data.size() + _cache_copy_length == offset_new + (uint32_t)mf_new.get_subfile_internal_start(ni), false);
     string name = mf_new.get_subfile_name(ni);
     string name = mf_new.get_subfile_name(ni);
     int oi = mf_orig.find_subfile(name);
     int oi = mf_orig.find_subfile(name);
 
 
@@ -1517,7 +1517,7 @@ patch_subfile(ostream &write_stream,
               const Filename &filename,
               const Filename &filename,
               IStreamWrapper &stream_orig, streampos orig_start, streampos orig_end,
               IStreamWrapper &stream_orig, streampos orig_start, streampos orig_end,
               IStreamWrapper &stream_new, streampos new_start, streampos new_end) {
               IStreamWrapper &stream_new, streampos new_start, streampos new_end) {
-  nassertr(_add_pos + _cache_add_data.size() + _cache_copy_length == offset_new + new_start, false);
+  nassertr(_add_pos + _cache_add_data.size() + _cache_copy_length == offset_new + (uint32_t)new_start, false);
 
 
   size_t new_size = new_end - new_start;
   size_t new_size = new_end - new_start;
   size_t orig_size = orig_end - orig_start;
   size_t orig_size = orig_end - orig_start;

+ 1 - 1
panda/src/ffmpeg/ffmpegAudioCursor.cxx

@@ -307,7 +307,7 @@ reload_buffer() {
 
 
   // First, let's fill the codec's input buffer with as many packets as it'll
   // First, let's fill the codec's input buffer with as many packets as it'll
   // take:
   // take:
-  int ret;
+  int ret = 0;
   while (_packet->data != nullptr) {
   while (_packet->data != nullptr) {
     ret = avcodec_send_packet(_audio_ctx, _packet);
     ret = avcodec_send_packet(_audio_ctx, _packet);
 
 

+ 1 - 1
panda/src/glstuff/glGeomMunger_src.cxx

@@ -400,7 +400,7 @@ premunge_format_impl(const GeomVertexFormat *orig) {
       CPT(GeomVertexArrayFormat) orig_a = new_format->get_array(i);
       CPT(GeomVertexArrayFormat) orig_a = new_format->get_array(i);
       if (orig_a->count_unused_space() != 0) {
       if (orig_a->count_unused_space() != 0) {
         PT(GeomVertexArrayFormat) new_a = new GeomVertexArrayFormat;
         PT(GeomVertexArrayFormat) new_a = new GeomVertexArrayFormat;
-        for (size_t j = 0; j < orig_a->get_num_columns(); ++j) {
+        for (int j = 0; j < orig_a->get_num_columns(); ++j) {
           const GeomVertexColumn *column = orig_a->get_column(j);
           const GeomVertexColumn *column = orig_a->get_column(j);
           new_a->add_column(column->get_name(), column->get_num_components(),
           new_a->add_column(column->get_name(), column->get_num_components(),
                             column->get_numeric_type(), column->get_contents(),
                             column->get_numeric_type(), column->get_contents(),

+ 4 - 4
panda/src/glstuff/glGraphicsBuffer_src.cxx

@@ -1297,7 +1297,7 @@ set_size(int x, int y) {
  */
  */
 void CLP(GraphicsBuffer)::
 void CLP(GraphicsBuffer)::
 select_target_tex_page(int page) {
 select_target_tex_page(int page) {
-  nassertv(page >= 0 && page < _fbo.size());
+  nassertv(page >= 0 && (size_t)page < _fbo.size());
 
 
   CLP(GraphicsStateGuardian) *glgsg = (CLP(GraphicsStateGuardian) *)_gsg.p();
   CLP(GraphicsStateGuardian) *glgsg = (CLP(GraphicsStateGuardian) *)_gsg.p();
 
 
@@ -1574,10 +1574,10 @@ close_buffer() {
   report_my_gl_errors();
   report_my_gl_errors();
 
 
   // Delete the FBO itself.
   // Delete the FBO itself.
-  for (int i = 0; i < _fbo.size(); ++i) {
-    glgsg->_glDeleteFramebuffers(1, &_fbo[i]);
+  if (!_fbo.empty()) {
+    glgsg->_glDeleteFramebuffers(_fbo.size(), _fbo.data());
+    _fbo.clear();
   }
   }
-  _fbo.clear();
 
 
   report_my_gl_errors();
   report_my_gl_errors();
 
 

+ 10 - 5
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -4374,9 +4374,9 @@ unbind_buffers() {
   if (_current_vertex_buffers.size() > 1 && _supports_multi_bind) {
   if (_current_vertex_buffers.size() > 1 && _supports_multi_bind) {
     _glBindVertexBuffers(0, _current_vertex_buffers.size(), nullptr, nullptr, nullptr);
     _glBindVertexBuffers(0, _current_vertex_buffers.size(), nullptr, nullptr, nullptr);
   } else {
   } else {
-    for (int i = 0; i < _current_vertex_buffers.size(); ++i) {
+    for (size_t i = 0; i < _current_vertex_buffers.size(); ++i) {
       if (_current_vertex_buffers[i] != 0) {
       if (_current_vertex_buffers[i] != 0) {
-        _glBindVertexBuffer(i, 0, 0, 0);
+        _glBindVertexBuffer((GLuint)i, 0, 0, 0);
       }
       }
     }
     }
   }
   }
@@ -13309,7 +13309,10 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
 
 
   GLint wrap_u, wrap_v, wrap_w;
   GLint wrap_u, wrap_v, wrap_w;
   GLint minfilter, magfilter;
   GLint minfilter, magfilter;
+
+#ifndef OPENGLES
   GLfloat border_color[4];
   GLfloat border_color[4];
+#endif
 
 
 #ifdef OPENGLES
 #ifdef OPENGLES
   if (true) {
   if (true) {
@@ -13803,11 +13806,13 @@ do_extract_texture_data(CLP(TextureContext) *gtc) {
     tex->set_wrap_u(get_panda_wrap_mode(wrap_u));
     tex->set_wrap_u(get_panda_wrap_mode(wrap_u));
     tex->set_wrap_v(get_panda_wrap_mode(wrap_v));
     tex->set_wrap_v(get_panda_wrap_mode(wrap_v));
     tex->set_wrap_w(get_panda_wrap_mode(wrap_w));
     tex->set_wrap_w(get_panda_wrap_mode(wrap_w));
-    tex->set_border_color(LColor(border_color[0], border_color[1],
-                                 border_color[2], border_color[3]));
-
     tex->set_minfilter(get_panda_filter_type(minfilter));
     tex->set_minfilter(get_panda_filter_type(minfilter));
     //tex->set_magfilter(get_panda_filter_type(magfilter));
     //tex->set_magfilter(get_panda_filter_type(magfilter));
+
+#ifndef OPENGLES
+    tex->set_border_color(LColor(border_color[0], border_color[1],
+                                 border_color[2], border_color[3]));
+#endif
   }
   }
 
 
   PTA_uchar image;
   PTA_uchar image;

+ 10 - 7
panda/src/glstuff/glShaderContext_src.cxx

@@ -352,7 +352,7 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext
       StorageBlock block;
       StorageBlock block;
       block._name = InternalName::make(block_name_cstr);
       block._name = InternalName::make(block_name_cstr);
       block._binding_index = values[0];
       block._binding_index = values[0];
-      block._min_size = values[1];
+      block._min_size = (GLuint)values[1];
       _storage_blocks.push_back(block);
       _storage_blocks.push_back(block);
     }
     }
   }
   }
@@ -681,6 +681,9 @@ reflect_uniform_block(int i, const char *name, char *name_buffer, GLsizei name_b
       break;
       break;
     }
     }
 
 
+    (void)numeric_type;
+    (void)contents;
+    (void)num_components;
     // GeomVertexColumn column(InternalName::make(name_buffer),
     // GeomVertexColumn column(InternalName::make(name_buffer),
     // num_components, numeric_type, contents, offsets[ui], 4, param_size,
     // num_components, numeric_type, contents, offsets[ui], 4, param_size,
     // astrides[ui]); block_format.add_column(column);
     // astrides[ui]); block_format.add_column(column);
@@ -1986,7 +1989,7 @@ issue_parameters(int altered) {
   if (altered & (Shader::SSD_shaderinputs | Shader::SSD_frame)) {
   if (altered & (Shader::SSD_shaderinputs | Shader::SSD_frame)) {
 
 
     // If we have an osg_FrameNumber input, set it now.
     // If we have an osg_FrameNumber input, set it now.
-    if ((altered | Shader::SSD_frame) != 0 && _frame_number_loc >= 0) {
+    if ((altered & Shader::SSD_frame) != 0 && _frame_number_loc >= 0) {
       _glgsg->_glUniform1i(_frame_number_loc, _frame_number);
       _glgsg->_glUniform1i(_frame_number_loc, _frame_number);
     }
     }
 
 
@@ -2169,7 +2172,7 @@ update_transform_table(const TransformTable *table) {
 #endif
 #endif
     }
     }
   }
   }
-  for (; i < _transform_table_size; ++i) {
+  for (; i < (size_t)_transform_table_size; ++i) {
     matrices[i] = LMatrix4f::ident_mat();
     matrices[i] = LMatrix4f::ident_mat();
   }
   }
 
 
@@ -2237,7 +2240,7 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) {
     // Use experimental new separated formatbinding state.
     // Use experimental new separated formatbinding state.
     const GeomVertexDataPipelineReader *data_reader = _glgsg->_data_reader;
     const GeomVertexDataPipelineReader *data_reader = _glgsg->_data_reader;
 
 
-    for (int ai = 0; ai < data_reader->get_num_arrays(); ++ai) {
+    for (size_t ai = 0; ai < data_reader->get_num_arrays(); ++ai) {
       array_reader = data_reader->get_array_reader(ai);
       array_reader = data_reader->get_array_reader(ai);
 
 
       // Make sure the vertex buffer is up-to-date.
       // Make sure the vertex buffer is up-to-date.
@@ -2294,7 +2297,7 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) {
     int start, stride, num_values;
     int start, stride, num_values;
     size_t nvarying = _shader->_var_spec.size();
     size_t nvarying = _shader->_var_spec.size();
 
 
-    GLuint max_p = 0;
+    GLint max_p = 0;
 
 
     for (size_t i = 0; i < nvarying; ++i) {
     for (size_t i = 0; i < nvarying; ++i) {
       const Shader::ShaderVarSpec &bind = _shader->_var_spec[i];
       const Shader::ShaderVarSpec &bind = _shader->_var_spec[i];
@@ -2312,7 +2315,7 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) {
         }
         }
       }
       }
 
 
-      GLuint p = bind._id._seqno;
+      GLint p = bind._id._seqno;
       max_p = max(max_p, p + 1);
       max_p = max(max_p, p + 1);
 
 
       // Don't apply vertex colors if they are disabled with a ColorAttrib.
       // Don't apply vertex colors if they are disabled with a ColorAttrib.
@@ -2401,7 +2404,7 @@ disable_shader_texture_bindings() {
 
 
   DO_PSTATS_STUFF(_glgsg->_texture_state_pcollector.add_level(1));
   DO_PSTATS_STUFF(_glgsg->_texture_state_pcollector.add_level(1));
 
 
-  for (int i = 0; i < _shader->_tex_spec.size(); ++i) {
+  for (size_t i = 0; i < _shader->_tex_spec.size(); ++i) {
 #ifndef OPENGLES
 #ifndef OPENGLES
     // Check if bindless was used, if so, there's nothing to unbind.
     // Check if bindless was used, if so, there's nothing to unbind.
     if (_glgsg->_supports_bindless_texture) {
     if (_glgsg->_supports_bindless_texture) {

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

@@ -99,7 +99,7 @@ private:
   struct StorageBlock {
   struct StorageBlock {
     CPT(InternalName) _name;
     CPT(InternalName) _name;
     GLuint _binding_index;
     GLuint _binding_index;
-    GLint _min_size;
+    GLuint _min_size;
   };
   };
   typedef pvector<StorageBlock> StorageBlocks;
   typedef pvector<StorageBlock> StorageBlocks;
   StorageBlocks _storage_blocks;
   StorageBlocks _storage_blocks;

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

@@ -145,7 +145,7 @@ make_adjacency() const {
 
 
     // Add the actual vertices in the strip.
     // Add the actual vertices in the strip.
     adj->add_vertex(v0);
     adj->add_vertex(v0);
-    int v1;
+    int v1 = v0;
     while (vi < end) {
     while (vi < end) {
       v1 = from.get_vertex(vi++);
       v1 = from.get_vertex(vi++);
       adj->add_vertex(v1);
       adj->add_vertex(v1);

+ 1 - 3
panda/src/gobj/geomVertexArrayFormat.cxx

@@ -557,9 +557,7 @@ get_format_string(bool pad) const {
   int fi = 0;
   int fi = 0;
   int offset = 0;
   int offset = 0;
 
 
-  for (int ci = 0; ci < get_num_columns(); ++ci) {
-    const GeomVertexColumn *column = get_column(ci);
-
+  for (const GeomVertexColumn *column : _columns) {
     if (offset < column->get_start()) {
     if (offset < column->get_start()) {
       // Add padding bytes to fill the gap.
       // Add padding bytes to fill the gap.
       int pad = column->get_start() - offset;
       int pad = column->get_start() - offset;

+ 3 - 3
panda/src/gobj/geomVertexData.I

@@ -677,7 +677,7 @@ has_column(const InternalName *name) const {
 /**
 /**
  *
  *
  */
  */
-INLINE int GeomVertexDataPipelineBase::
+INLINE size_t GeomVertexDataPipelineBase::
 get_num_arrays() const {
 get_num_arrays() const {
   return _cdata->_arrays.size();
   return _cdata->_arrays.size();
 }
 }
@@ -686,8 +686,8 @@ get_num_arrays() const {
  *
  *
  */
  */
 INLINE CPT(GeomVertexArrayData) GeomVertexDataPipelineBase::
 INLINE CPT(GeomVertexArrayData) GeomVertexDataPipelineBase::
-get_array(int i) const {
-  nassertr(i >= 0 && i < (int)_cdata->_arrays.size(), nullptr);
+get_array(size_t i) const {
+  nassertr(i < _cdata->_arrays.size(), nullptr);
   return _cdata->_arrays[i].get_read_pointer();
   return _cdata->_arrays[i].get_read_pointer();
 }
 }
 
 

+ 6 - 6
panda/src/gobj/geomVertexData.cxx

@@ -344,7 +344,7 @@ void GeomVertexData::
 clear_rows() {
 clear_rows() {
   Thread *current_thread = Thread::get_current_thread();
   Thread *current_thread = Thread::get_current_thread();
   CDWriter cdata(_cycler, true, current_thread);
   CDWriter cdata(_cycler, true, current_thread);
-  nassertv(cdata->_format->get_num_arrays() == (int)cdata->_arrays.size());
+  nassertv(cdata->_format->get_num_arrays() == cdata->_arrays.size());
 
 
   Arrays::iterator ai;
   Arrays::iterator ai;
   for (ai = cdata->_arrays.begin();
   for (ai = cdata->_arrays.begin();
@@ -2243,7 +2243,7 @@ get_num_bytes() const {
  */
  */
 int GeomVertexDataPipelineReader::
 int GeomVertexDataPipelineReader::
 get_num_rows() const {
 get_num_rows() const {
-  nassertr(_cdata->_format->get_num_arrays() == (int)_cdata->_arrays.size(), 0);
+  nassertr(_cdata->_format->get_num_arrays() == _cdata->_arrays.size(), 0);
   nassertr(_got_array_readers, 0);
   nassertr(_got_array_readers, 0);
 
 
   if (_cdata->_format->get_num_arrays() == 0) {
   if (_cdata->_format->get_num_arrays() == 0) {
@@ -2395,7 +2395,7 @@ make_array_readers() {
  */
  */
 int GeomVertexDataPipelineWriter::
 int GeomVertexDataPipelineWriter::
 get_num_rows() const {
 get_num_rows() const {
-  nassertr(_cdata->_format->get_num_arrays() == (int)_cdata->_arrays.size(), 0);
+  nassertr(_cdata->_format->get_num_arrays() == _cdata->_arrays.size(), 0);
   nassertr(_got_array_writers, 0);
   nassertr(_got_array_writers, 0);
 
 
   if (_cdata->_format->get_num_arrays() == 0) {
   if (_cdata->_format->get_num_arrays() == 0) {
@@ -2414,7 +2414,7 @@ get_num_rows() const {
 bool GeomVertexDataPipelineWriter::
 bool GeomVertexDataPipelineWriter::
 set_num_rows(int n) {
 set_num_rows(int n) {
   nassertr(_got_array_writers, false);
   nassertr(_got_array_writers, false);
-  nassertr(_cdata->_format->get_num_arrays() == (int)_cdata->_arrays.size(), false);
+  nassertr(_cdata->_format->get_num_arrays() == _cdata->_arrays.size(), false);
 
 
   bool any_changed = false;
   bool any_changed = false;
 
 
@@ -2510,7 +2510,7 @@ set_num_rows(int n) {
 bool GeomVertexDataPipelineWriter::
 bool GeomVertexDataPipelineWriter::
 unclean_set_num_rows(int n) {
 unclean_set_num_rows(int n) {
   nassertr(_got_array_writers, false);
   nassertr(_got_array_writers, false);
-  nassertr(_cdata->_format->get_num_arrays() == (int)_cdata->_arrays.size(), false);
+  nassertr(_cdata->_format->get_num_arrays() == _cdata->_arrays.size(), false);
 
 
   bool any_changed = false;
   bool any_changed = false;
 
 
@@ -2537,7 +2537,7 @@ unclean_set_num_rows(int n) {
 bool GeomVertexDataPipelineWriter::
 bool GeomVertexDataPipelineWriter::
 reserve_num_rows(int n) {
 reserve_num_rows(int n) {
   nassertr(_got_array_writers, false);
   nassertr(_got_array_writers, false);
-  nassertr(_cdata->_format->get_num_arrays() == (int)_cdata->_arrays.size(), false);
+  nassertr(_cdata->_format->get_num_arrays() == _cdata->_arrays.size(), false);
 
 
   bool any_changed = false;
   bool any_changed = false;
 
 

+ 2 - 2
panda/src/gobj/geomVertexData.h

@@ -419,8 +419,8 @@ public:
   INLINE bool has_column(const InternalName *name) const;
   INLINE bool has_column(const InternalName *name) const;
 
 
   INLINE UsageHint get_usage_hint() const;
   INLINE UsageHint get_usage_hint() const;
-  INLINE int get_num_arrays() const;
-  INLINE CPT(GeomVertexArrayData) get_array(int i) const;
+  INLINE size_t get_num_arrays() const;
+  INLINE CPT(GeomVertexArrayData) get_array(size_t i) const;
   INLINE const TransformTable *get_transform_table() const;
   INLINE const TransformTable *get_transform_table() const;
   INLINE CPT(TransformBlendTable) get_transform_blend_table() const;
   INLINE CPT(TransformBlendTable) get_transform_blend_table() const;
   INLINE const SliderTable *get_slider_table() const;
   INLINE const SliderTable *get_slider_table() const;

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

@@ -102,7 +102,7 @@ set_vertex_column(int array, const GeomVertexColumn *column,
 #ifndef NDEBUG
 #ifndef NDEBUG
   _array = -1;
   _array = -1;
   _packer = nullptr;
   _packer = nullptr;
-  nassertr(array >= 0 && array < _vertex_data->get_num_arrays(), false);
+  nassertr(array >= 0 && (size_t)array < _vertex_data->get_num_arrays(), false);
 #endif
 #endif
 
 
   _array = array;
   _array = array;

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

@@ -133,7 +133,7 @@ set_vertex_column(int array, const GeomVertexColumn *column,
 #ifndef NDEBUG
 #ifndef NDEBUG
   _array = -1;
   _array = -1;
   _packer = nullptr;
   _packer = nullptr;
-  nassertr(array >= 0 && array < _vertex_data->get_num_arrays(), false);
+  nassertr(array >= 0 && (size_t)array < _vertex_data->get_num_arrays(), false);
 #endif
 #endif
 
 
   _array = array;
   _array = array;

+ 6 - 6
panda/src/gobj/shader.cxx

@@ -2652,7 +2652,7 @@ r_preprocess_source(ostream &out, const Filename &fn,
     }
     }
 
 
     char pragma[64];
     char pragma[64];
-    int nread = 0;
+    size_t nread = 0;
     // What kind of directive is it?
     // What kind of directive is it?
     if (strcmp(directive, "pragma") == 0 &&
     if (strcmp(directive, "pragma") == 0 &&
         sscanf(line.c_str(), " # pragma %63s", pragma) == 1) {
         sscanf(line.c_str(), " # pragma %63s", pragma) == 1) {
@@ -2661,13 +2661,13 @@ r_preprocess_source(ostream &out, const Filename &fn,
         Filename incfn, source_dir;
         Filename incfn, source_dir;
         {
         {
           char incfile[2048];
           char incfile[2048];
-          if (sscanf(line.c_str(), " # pragma%*[ \t]include \"%2047[^\"]\" %n", incfile, &nread) == 1
+          if (sscanf(line.c_str(), " # pragma%*[ \t]include \"%2047[^\"]\" %zn", incfile, &nread) == 1
               && nread == line.size()) {
               && nread == line.size()) {
             // A regular include, with double quotes.  Probably a local file.
             // A regular include, with double quotes.  Probably a local file.
             source_dir = full_fn.get_dirname();
             source_dir = full_fn.get_dirname();
             incfn = incfile;
             incfn = incfile;
 
 
-          } else if (sscanf(line.c_str(), " # pragma%*[ \t]include <%2047[^\"]> %n", incfile, &nread) == 1
+          } else if (sscanf(line.c_str(), " # pragma%*[ \t]include <%2047[^\"]> %zn", incfile, &nread) == 1
               && nread == line.size()) {
               && nread == line.size()) {
             // Angled includes are also OK, but we don't search in the directory
             // Angled includes are also OK, but we don't search in the directory
             // of the source file.
             // of the source file.
@@ -2696,7 +2696,7 @@ r_preprocess_source(ostream &out, const Filename &fn,
 
 
       } else if (strcmp(pragma, "once") == 0) {
       } else if (strcmp(pragma, "once") == 0) {
         // Do a stricter syntax check, just to be extra safe.
         // Do a stricter syntax check, just to be extra safe.
-        if (sscanf(line.c_str(), " # pragma%*[ \t]once %n", &nread) != 0 ||
+        if (sscanf(line.c_str(), " # pragma%*[ \t]once %zn", &nread) != 0 ||
             nread != line.size()) {
             nread != line.size()) {
           shader_cat.error()
           shader_cat.error()
             << "Malformed #pragma once at line " << lineno
             << "Malformed #pragma once at line " << lineno
@@ -2788,7 +2788,7 @@ r_preprocess_source(ostream &out, const Filename &fn,
       Filename incfn;
       Filename incfn;
       {
       {
         char incfile[2048];
         char incfile[2048];
-        if (sscanf(line.c_str(), " # include%*[ \t]\"%2047[^\"]\" %n", incfile, &nread) != 1
+        if (sscanf(line.c_str(), " # include%*[ \t]\"%2047[^\"]\" %zn", incfile, &nread) != 1
             || nread != line.size()) {
             || nread != line.size()) {
           // Couldn't parse it.
           // Couldn't parse it.
           shader_cat.error()
           shader_cat.error()
@@ -2815,7 +2815,7 @@ r_preprocess_source(ostream &out, const Filename &fn,
     } else if (ext_google_line > 0 && strcmp(directive, "line") == 0) {
     } else if (ext_google_line > 0 && strcmp(directive, "line") == 0) {
       // It's a #line directive.  See if it uses a string instead of number.
       // It's a #line directive.  See if it uses a string instead of number.
       char filestr[2048];
       char filestr[2048];
-      if (sscanf(line.c_str(), " # line%*[ \t]%d%*[ \t]\"%2047[^\"]\" %n", &lineno, filestr, &nread) == 2
+      if (sscanf(line.c_str(), " # line%*[ \t]%d%*[ \t]\"%2047[^\"]\" %zn", &lineno, filestr, &nread) == 2
           && nread == line.size()) {
           && nread == line.size()) {
         // Warn about extension use if requested.
         // Warn about extension use if requested.
         if (ext_google_line == 1) {
         if (ext_google_line == 1) {

+ 3 - 3
panda/src/gobj/texture.cxx

@@ -4224,7 +4224,7 @@ do_read_ktx(CData *cdata, istream &in, const string &filename, bool header_only)
   }
   }
 
 
   // See: https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
   // See: https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
-  uint32_t gl_type, type_size, gl_format, internal_format, gl_base_format,
+  uint32_t gl_type, /*type_size,*/ gl_format, internal_format, gl_base_format,
     width, height, depth, num_array_elements, num_faces, num_mipmap_levels,
     width, height, depth, num_array_elements, num_faces, num_mipmap_levels,
     kvdata_size;
     kvdata_size;
 
 
@@ -4232,7 +4232,7 @@ do_read_ktx(CData *cdata, istream &in, const string &filename, bool header_only)
   if (ktx.get_uint32() == 0x04030201) {
   if (ktx.get_uint32() == 0x04030201) {
     big_endian = false;
     big_endian = false;
     gl_type = ktx.get_uint32();
     gl_type = ktx.get_uint32();
-    type_size = ktx.get_uint32();
+    /*type_size = */ktx.get_uint32();
     gl_format = ktx.get_uint32();
     gl_format = ktx.get_uint32();
     internal_format = ktx.get_uint32();
     internal_format = ktx.get_uint32();
     gl_base_format = ktx.get_uint32();
     gl_base_format = ktx.get_uint32();
@@ -4246,7 +4246,7 @@ do_read_ktx(CData *cdata, istream &in, const string &filename, bool header_only)
   } else {
   } else {
     big_endian = true;
     big_endian = true;
     gl_type = ktx.get_be_uint32();
     gl_type = ktx.get_be_uint32();
-    type_size = ktx.get_be_uint32();
+    /*type_size = */ktx.get_be_uint32();
     gl_format = ktx.get_be_uint32();
     gl_format = ktx.get_be_uint32();
     internal_format = ktx.get_be_uint32();
     internal_format = ktx.get_be_uint32();
     gl_base_format = ktx.get_be_uint32();
     gl_base_format = ktx.get_be_uint32();

+ 0 - 27
panda/src/linmath/lsimpleMatrix.I

@@ -11,33 +11,6 @@
  * @date 2011-12-15
  * @date 2011-12-15
  */
  */
 
 
-/**
- *
- */
-template <class FloatType, int NumRows, int NumCols>
-INLINE LSimpleMatrix<FloatType, NumRows, NumCols>::
-LSimpleMatrix() {
-  // No default initialization.
-}
-
-/**
- *
- */
-template <class FloatType, int NumRows, int NumCols>
-INLINE LSimpleMatrix<FloatType, NumRows, NumCols>::
-LSimpleMatrix(const LSimpleMatrix<FloatType, NumRows, NumCols> &copy) {
-  memcpy(_array, copy._array, sizeof(_array));
-}
-
-/**
- *
- */
-template <class FloatType, int NumRows, int NumCols>
-INLINE void LSimpleMatrix<FloatType, NumRows, NumCols>::
-operator = (const LSimpleMatrix<FloatType, NumRows, NumCols> &copy) {
-  memcpy(_array, copy._array, sizeof(_array));
-}
-
 /**
 /**
  *
  *
  */
  */

+ 0 - 3
panda/src/linmath/lsimpleMatrix.h

@@ -28,9 +28,6 @@
 template <class FloatType, int NumRows, int NumCols>
 template <class FloatType, int NumRows, int NumCols>
 class LSimpleMatrix {
 class LSimpleMatrix {
 public:
 public:
-  INLINE LSimpleMatrix();
-  INLINE LSimpleMatrix(const LSimpleMatrix<FloatType, NumRows, NumCols> &copy);
-  INLINE void operator = (const LSimpleMatrix<FloatType, NumRows, NumCols> &copy);
   INLINE const FloatType &operator () (int row, int col) const;
   INLINE const FloatType &operator () (int row, int col) const;
   INLINE FloatType &operator () (int row, int col);
   INLINE FloatType &operator () (int row, int col);
   INLINE const FloatType &operator () (int col) const;
   INLINE const FloatType &operator () (int col) const;

+ 2 - 2
panda/src/ode/odeTriMeshData.cxx

@@ -221,7 +221,7 @@ process_geom(const Geom *geom) {
 
 
   CPT(GeomVertexData) vData = geom->get_vertex_data();
   CPT(GeomVertexData) vData = geom->get_vertex_data();
 
 
-  for (int i = 0; i < geom->get_num_primitives(); ++i) {
+  for (size_t i = 0; i < geom->get_num_primitives(); ++i) {
     process_primitive(geom->get_primitive(i), vData);
     process_primitive(geom->get_primitive(i), vData);
   }
   }
 }
 }
@@ -308,7 +308,7 @@ analyze(const Geom *geom) {
     return;
     return;
   }
   }
 
 
-  for (int i = 0; i < geom->get_num_primitives(); ++i) {
+  for (size_t i = 0; i < geom->get_num_primitives(); ++i) {
     analyze(geom->get_primitive(i));
     analyze(geom->get_primitive(i));
   }
   }
 }
 }

+ 6 - 6
panda/src/parametrics/nurbsSurfaceResult.cxx

@@ -62,10 +62,10 @@ NurbsSurfaceResult(const NurbsBasisVector &u_basis,
       // Create four geometry matrices from our (up to) sixteen involved
       // Create four geometry matrices from our (up to) sixteen involved
       // vertices.
       // vertices.
       LMatrix4 geom_x, geom_y, geom_z, geom_w;
       LMatrix4 geom_x, geom_y, geom_z, geom_w;
-      memset(&geom_x, 0, sizeof(geom_x));
-      memset(&geom_y, 0, sizeof(geom_y));
-      memset(&geom_z, 0, sizeof(geom_z));
-      memset(&geom_w, 0, sizeof(geom_w));
+      geom_x.fill(0);
+      geom_y.fill(0);
+      geom_z.fill(0);
+      geom_w.fill(0);
 
 
       for (int uni = 0; uni < 4; uni++) {
       for (int uni = 0; uni < 4; uni++) {
         for (int vni = 0; vni < 4; vni++) {
         for (int vni = 0; vni < 4; vni++) {
@@ -178,7 +178,7 @@ eval_segment_extended_point(int ui, int vi, PN_stdfloat u, PN_stdfloat v, int d)
   int vn = _v_basis.get_vertex_index(vi);
   int vn = _v_basis.get_vertex_index(vi);
 
 
   LMatrix4 geom;
   LMatrix4 geom;
-  memset(&geom, 0, sizeof(geom));
+  geom.fill(0);
 
 
   for (int uni = 0; uni < 4; uni++) {
   for (int uni = 0; uni < 4; uni++) {
     for (int vni = 0; vni < 4; vni++) {
     for (int vni = 0; vni < 4; vni++) {
@@ -223,7 +223,7 @@ eval_segment_extended_points(int ui, int vi, PN_stdfloat u, PN_stdfloat v, int d
 
 
   for (int n = 0; n < num_values; n++) {
   for (int n = 0; n < num_values; n++) {
     LMatrix4 geom;
     LMatrix4 geom;
-    memset(&geom, 0, sizeof(geom));
+    geom.fill(0);
 
 
     for (int uni = 0; uni < 4; uni++) {
     for (int uni = 0; uni < 4; uni++) {
       for (int vni = 0; vni < 4; vni++) {
       for (int vni = 0; vni < 4; vni++) {

+ 2 - 2
panda/src/particlesystem/spriteParticleRenderer.cxx

@@ -294,7 +294,7 @@ add_from_node(const NodePath &node_path, bool size_from_texels, bool resize) {
       GeomVertexReader texcoord(geom->get_vertex_data(),
       GeomVertexReader texcoord(geom->get_vertex_data(),
                                 InternalName::get_texcoord());
                                 InternalName::get_texcoord());
       if (texcoord.has_column()) {
       if (texcoord.has_column()) {
-        for (int pi = 0; pi < geom->get_num_primitives(); ++pi) {
+        for (size_t pi = 0; pi < geom->get_num_primitives(); ++pi) {
           primitive = geom->get_primitive(pi);
           primitive = geom->get_primitive(pi);
           for (int vi = 0; vi < primitive->get_num_vertices(); ++vi) {
           for (int vi = 0; vi < primitive->get_num_vertices(); ++vi) {
             int vert = primitive->get_vertex(vi);
             int vert = primitive->get_vertex(vi);
@@ -338,7 +338,7 @@ add_from_node(const NodePath &node_path, bool size_from_texels, bool resize) {
       GeomVertexReader vertex(geom->get_vertex_data(),
       GeomVertexReader vertex(geom->get_vertex_data(),
                               InternalName::get_vertex());
                               InternalName::get_vertex());
       if (vertex.has_column()) {
       if (vertex.has_column()) {
-        for (int pi = 0; pi < geom->get_num_primitives(); ++pi) {
+        for (size_t pi = 0; pi < geom->get_num_primitives(); ++pi) {
           primitive = geom->get_primitive(pi);
           primitive = geom->get_primitive(pi);
           for (int vi = 0; vi < primitive->get_num_vertices(); ++vi) {
           for (int vi = 0; vi < primitive->get_num_vertices(); ++vi) {
             int vert = primitive->get_vertex(vi);
             int vert = primitive->get_vertex(vi);

+ 1 - 1
panda/src/pgraph/camera.I

@@ -64,7 +64,7 @@ get_num_display_regions() const {
  */
  */
 INLINE DisplayRegion *Camera::
 INLINE DisplayRegion *Camera::
 get_display_region(size_t n) const {
 get_display_region(size_t n) const {
-  nassertr(n < (int)_display_regions.size(), nullptr);
+  nassertr(n < _display_regions.size(), nullptr);
   return _display_regions[n];
   return _display_regions[n];
 }
 }
 
 

+ 2 - 2
panda/src/pgraph/geomTransformer.cxx

@@ -1479,7 +1479,7 @@ remove_unused_vertices(const GeomVertexData *vdata) {
   PT(GeomVertexData) new_vdata = new GeomVertexData(*vdata);
   PT(GeomVertexData) new_vdata = new GeomVertexData(*vdata);
   new_vdata->unclean_set_num_rows(new_num_vertices);
   new_vdata->unclean_set_num_rows(new_num_vertices);
 
 
-  int num_arrays = vdata->get_num_arrays();
+  size_t num_arrays = vdata->get_num_arrays();
   nassertv(num_arrays == new_vdata->get_num_arrays());
   nassertv(num_arrays == new_vdata->get_num_arrays());
 
 
   GeomVertexDataPipelineReader reader(vdata, current_thread);
   GeomVertexDataPipelineReader reader(vdata, current_thread);
@@ -1487,7 +1487,7 @@ remove_unused_vertices(const GeomVertexData *vdata) {
   GeomVertexDataPipelineWriter writer(new_vdata, true, current_thread);
   GeomVertexDataPipelineWriter writer(new_vdata, true, current_thread);
   writer.check_array_writers();
   writer.check_array_writers();
 
 
-  for (int a = 0; a < num_arrays; ++a) {
+  for (size_t a = 0; a < num_arrays; ++a) {
     const GeomVertexArrayDataHandle *array_reader = reader.get_array_reader(a);
     const GeomVertexArrayDataHandle *array_reader = reader.get_array_reader(a);
     GeomVertexArrayDataHandle *array_writer = writer.get_array_writer(a);
     GeomVertexArrayDataHandle *array_writer = writer.get_array_writer(a);
 
 

+ 1 - 1
panda/src/pgraphnodes/shaderGenerator.cxx

@@ -261,7 +261,7 @@ analyze_renderstate(ShaderKey &key, const RenderState *rs) {
   rs->get_attrib_def(la);
   rs->get_attrib_def(la);
   bool have_ambient = false;
   bool have_ambient = false;
 
 
-  for (int i = 0; i < la->get_num_on_lights(); ++i) {
+  for (size_t i = 0; i < la->get_num_on_lights(); ++i) {
     NodePath np = la->get_on_light(i);
     NodePath np = la->get_on_light(i);
     nassertv(!np.is_empty());
     nassertv(!np.is_empty());
     PandaNode *node = np.node();
     PandaNode *node = np.node();

+ 1 - 1
panda/src/physics/physicsObject.cxx

@@ -112,7 +112,7 @@ add_impact(const LPoint3 &offset,
   a = a.cross(b);
   a = a.cross(b);
   PN_stdfloat angle = a.length();
   PN_stdfloat angle = a.length();
   if (angle) {
   if (angle) {
-    LRotation torque;
+    LRotation torque(0, 0, 0, 0);
     PN_stdfloat spin = force.length()*0.1; // todo: this should account for
     PN_stdfloat spin = force.length()*0.1; // todo: this should account for
                                         // impact distance and mass.
                                         // impact distance and mass.
     a.normalize();
     a.normalize();

+ 1 - 1
panda/src/pipeline/pipeline.cxx

@@ -94,7 +94,7 @@ cycle() {
   pvector< PT(CycleData) > saved_cdatas;
   pvector< PT(CycleData) > saved_cdatas;
   {
   {
     ReMutexHolder cycle_holder(_cycle_lock);
     ReMutexHolder cycle_holder(_cycle_lock);
-    int prev_seq, next_seq;
+    unsigned int prev_seq, next_seq;
     PipelineCyclerLinks prev_dirty;
     PipelineCyclerLinks prev_dirty;
     {
     {
       // We can't hold the lock protecting the linked lists during the cycling
       // We can't hold the lock protecting the linked lists during the cycling

+ 25 - 20
panda/src/pnmimage/pfmFile.cxx

@@ -1726,35 +1726,32 @@ compute_planar_bounds(const LPoint2f &center, PN_float32 point_dist, PN_float32
 
 
   // Now determine the minmax.
   // Now determine the minmax.
   PN_float32 min_x, min_y, min_z, max_x, max_y, max_z;
   PN_float32 min_x, min_y, min_z, max_x, max_y, max_z;
-  bool got_point = false;
   if (points_only) {
   if (points_only) {
-    LPoint3f points[4] = {
+    const LPoint3f points[4] = {
       p0 * rinv,
       p0 * rinv,
       p1 * rinv,
       p1 * rinv,
       p2 * rinv,
       p2 * rinv,
       p3 * rinv,
       p3 * rinv,
     };
     };
-    for (int i = 0; i < 4; ++i) {
+    const LPoint3f &point = points[0];
+    min_x = point[0];
+    min_y = point[1];
+    min_z = point[2];
+    max_x = point[0];
+    max_y = point[1];
+    max_z = point[2];
+
+    for (int i = 1; i < 4; ++i) {
       const LPoint3f &point = points[i];
       const LPoint3f &point = points[i];
-      if (!got_point) {
-        min_x = point[0];
-        min_y = point[1];
-        min_z = point[2];
-        max_x = point[0];
-        max_y = point[1];
-        max_z = point[2];
-        got_point = true;
-      } else {
-        min_x = min(min_x, point[0]);
-        min_y = min(min_y, point[1]);
-        min_z = min(min_z, point[2]);
-        max_x = max(max_x, point[0]);
-        max_y = max(max_y, point[1]);
-        max_z = max(max_z, point[2]);
-      }
+      min_x = min(min_x, point[0]);
+      min_y = min(min_y, point[1]);
+      min_z = min(min_z, point[2]);
+      max_x = max(max_x, point[0]);
+      max_y = max(max_y, point[1]);
+      max_z = max(max_z, point[2]);
     }
     }
-
   } else {
   } else {
+    bool got_point = false;
     for (int yi = 0; yi < _y_size; ++yi) {
     for (int yi = 0; yi < _y_size; ++yi) {
       for (int xi = 0; xi < _x_size; ++xi) {
       for (int xi = 0; xi < _x_size; ++xi) {
         if (!has_point(xi, yi)) {
         if (!has_point(xi, yi)) {
@@ -1780,6 +1777,14 @@ compute_planar_bounds(const LPoint2f &center, PN_float32 point_dist, PN_float32
         }
         }
       }
       }
     }
     }
+    if (!got_point) {
+      min_x = 0.0f;
+      min_y = 0.0f;
+      min_z = 0.0f;
+      max_x = 0.0f;
+      max_y = 0.0f;
+      max_z = 0.0f;
+    }
   }
   }
 
 
   PT(BoundingHexahedron) bounds;
   PT(BoundingHexahedron) bounds;

+ 1 - 1
panda/src/pnmimage/pnmimage_base.h

@@ -40,7 +40,7 @@ typedef unsigned char gray;
 
 
 struct pixel {
 struct pixel {
 PUBLISHED:
 PUBLISHED:
-  pixel() { }
+  pixel() = default;
   pixel(gray fill) : r(fill), g(fill), b(fill) { }
   pixel(gray fill) : r(fill), g(fill), b(fill) { }
   pixel(gray r, gray g, gray b) : r(r), g(g), b(b) { }
   pixel(gray r, gray g, gray b) : r(r), g(g), b(b) { }
 
 

+ 2 - 2
panda/src/pnmimagetypes/pnmFileTypeTGA.cxx

@@ -721,8 +721,8 @@ get_pixel( istream *ifp, pixel *dest, int Size, gray *alpha_p) {
         Red = getbyte( ifp );
         Red = getbyte( ifp );
         if ( Size == 32 )
         if ( Size == 32 )
             Alpha = getbyte( ifp );
             Alpha = getbyte( ifp );
-    else
-        Alpha = 0;
+        else
+            Alpha = 0;
         l = 0;
         l = 0;
         break;
         break;
 
 

+ 0 - 14
panda/src/pstatclient/pStatCollector.I

@@ -25,20 +25,6 @@ PStatCollector(PStatClient *client, int index) :
 {
 {
 }
 }
 
 
-/**
- * Creates an invalid PStatCollector.  Any attempt to use this collector will
- * crash messily.
- *
- * You can reassign it to a different, valid one later.
- */
-INLINE PStatCollector::
-PStatCollector() :
-  _client(nullptr),
-  _index(0),
-  _level(0.0f)
-{
-}
-
 /**
 /**
  * Creates a new PStatCollector, ready to start accumulating data.  The name
  * Creates a new PStatCollector, ready to start accumulating data.  The name
  * of the collector uniquely identifies it among the other collectors; if two
  * of the collector uniquely identifies it among the other collectors; if two

+ 4 - 4
panda/src/pstatclient/pStatCollector.h

@@ -47,7 +47,7 @@ private:
   INLINE PStatCollector(PStatClient *client, int index);
   INLINE PStatCollector(PStatClient *client, int index);
 
 
 public:
 public:
-  INLINE PStatCollector();
+  PStatCollector() = default;
 
 
 PUBLISHED:
 PUBLISHED:
   INLINE explicit PStatCollector(const std::string &name,
   INLINE explicit PStatCollector(const std::string &name,
@@ -99,9 +99,9 @@ PUBLISHED:
   INLINE int get_index() const;
   INLINE int get_index() const;
 
 
 private:
 private:
-  PStatClient *_client;
-  int _index;
-  double _level;
+  PStatClient *_client = nullptr;
+  int _index = 0;
+  double _level = 0.0;
 
 
 friend class PStatClient;
 friend class PStatClient;
 
 

+ 10 - 10
panda/src/putil/bitArray.cxx

@@ -87,7 +87,7 @@ is_all_on() const {
  */
  */
 bool BitArray::
 bool BitArray::
 has_any_of(int low_bit, int size) const {
 has_any_of(int low_bit, int size) const {
-  if ((low_bit + size - 1) / num_bits_per_word >= get_num_words()) {
+  if ((size_t)(low_bit + size) > get_num_bits()) {
     // This range touches the highest bits.
     // This range touches the highest bits.
     if (_highest_bits) {
     if (_highest_bits) {
       return true;
       return true;
@@ -97,7 +97,7 @@ has_any_of(int low_bit, int size) const {
   int w = low_bit / num_bits_per_word;
   int w = low_bit / num_bits_per_word;
   int b = low_bit % num_bits_per_word;
   int b = low_bit % num_bits_per_word;
 
 
-  if (w >= get_num_words()) {
+  if (w >= (int)get_num_words()) {
     // This range is entirely among the highest bits.
     // This range is entirely among the highest bits.
     return (_highest_bits != 0);
     return (_highest_bits != 0);
   }
   }
@@ -126,7 +126,7 @@ has_any_of(int low_bit, int size) const {
     size -= num_bits_per_word;
     size -= num_bits_per_word;
     ++w;
     ++w;
 
 
-    if (w >= get_num_words()) {
+    if (w >= (int)get_num_words()) {
       // Now we're up to the highest bits.
       // Now we're up to the highest bits.
       return (_highest_bits != 0);
       return (_highest_bits != 0);
     }
     }
@@ -140,7 +140,7 @@ has_any_of(int low_bit, int size) const {
  */
  */
 bool BitArray::
 bool BitArray::
 has_all_of(int low_bit, int size) const {
 has_all_of(int low_bit, int size) const {
-  if ((low_bit + size - 1) / num_bits_per_word >= get_num_words()) {
+  if ((size_t)(low_bit + size) > get_num_bits()) {
     // This range touches the highest bits.
     // This range touches the highest bits.
     if (!_highest_bits) {
     if (!_highest_bits) {
       return false;
       return false;
@@ -150,7 +150,7 @@ has_all_of(int low_bit, int size) const {
   int w = low_bit / num_bits_per_word;
   int w = low_bit / num_bits_per_word;
   int b = low_bit % num_bits_per_word;
   int b = low_bit % num_bits_per_word;
 
 
-  if (w >= get_num_words()) {
+  if (w >= (int)get_num_words()) {
     // This range is entirely among the highest bits.
     // This range is entirely among the highest bits.
     return (_highest_bits != 0);
     return (_highest_bits != 0);
   }
   }
@@ -179,7 +179,7 @@ has_all_of(int low_bit, int size) const {
     size -= num_bits_per_word;
     size -= num_bits_per_word;
     ++w;
     ++w;
 
 
-    if (w >= get_num_words()) {
+    if (w >= (int)get_num_words()) {
       // Now we're up to the highest bits.
       // Now we're up to the highest bits.
       return (_highest_bits != 0);
       return (_highest_bits != 0);
     }
     }
@@ -196,7 +196,7 @@ set_range(int low_bit, int size) {
   int w = low_bit / num_bits_per_word;
   int w = low_bit / num_bits_per_word;
   int b = low_bit % num_bits_per_word;
   int b = low_bit % num_bits_per_word;
 
 
-  if (w >= get_num_words() && _highest_bits) {
+  if (w >= (int)get_num_words() && _highest_bits) {
     // All the highest bits are already on.
     // All the highest bits are already on.
     return;
     return;
   }
   }
@@ -229,7 +229,7 @@ set_range(int low_bit, int size) {
     size -= num_bits_per_word;
     size -= num_bits_per_word;
     ++w;
     ++w;
 
 
-    if (w >= get_num_words() && _highest_bits) {
+    if (w >= (int)get_num_words() && _highest_bits) {
       // All the highest bits are already on.
       // All the highest bits are already on.
       normalize();
       normalize();
       return;
       return;
@@ -246,7 +246,7 @@ clear_range(int low_bit, int size) {
   int w = low_bit / num_bits_per_word;
   int w = low_bit / num_bits_per_word;
   int b = low_bit % num_bits_per_word;
   int b = low_bit % num_bits_per_word;
 
 
-  if (w >= get_num_words() && !_highest_bits) {
+  if (w >= (int)get_num_words() && !_highest_bits) {
     // All the highest bits are already off.
     // All the highest bits are already off.
     return;
     return;
   }
   }
@@ -279,7 +279,7 @@ clear_range(int low_bit, int size) {
     size -= num_bits_per_word;
     size -= num_bits_per_word;
     ++w;
     ++w;
 
 
-    if (w >= get_num_words() && !_highest_bits) {
+    if (w >= (int)get_num_words() && !_highest_bits) {
       // All the highest bits are already off.
       // All the highest bits are already off.
       normalize();
       normalize();
       return;
       return;

+ 4 - 4
panda/src/putil/doubleBitMask.I

@@ -214,8 +214,8 @@ has_any_of(int low_bit, int size) const {
   } else {
   } else {
     int hi_portion = low_bit + size - half_bits;
     int hi_portion = low_bit + size - half_bits;
     int lo_portion = size - hi_portion;
     int lo_portion = size - hi_portion;
-    return (_hi.has_any_of(0, hi_portion) << lo_portion) ||
-      _lo.has_any_of(low_bit, lo_portion);
+    return _hi.has_any_of(0, hi_portion)
+        || _lo.has_any_of(low_bit, lo_portion);
   }
   }
 }
 }
 
 
@@ -232,8 +232,8 @@ has_all_of(int low_bit, int size) const {
   } else {
   } else {
     int hi_portion = low_bit + size - half_bits;
     int hi_portion = low_bit + size - half_bits;
     int lo_portion = size - hi_portion;
     int lo_portion = size - hi_portion;
-    return (_hi.has_all_of(0, hi_portion) << lo_portion) &&
-      _lo.has_all_of(low_bit, lo_portion);
+    return _hi.has_all_of(0, hi_portion)
+        && _lo.has_all_of(low_bit, lo_portion);
   }
   }
 }
 }
 
 

+ 7 - 38
panda/src/putil/factoryBase.cxx

@@ -15,20 +15,6 @@
 #include "indent.h"
 #include "indent.h"
 #include "config_putil.h"
 #include "config_putil.h"
 
 
-/**
- *
- */
-FactoryBase::
-FactoryBase() {
-}
-
-/**
- *
- */
-FactoryBase::
-~FactoryBase() {
-}
-
 /**
 /**
  * Attempts to create a new instance of some class of the indicated type, or
  * Attempts to create a new instance of some class of the indicated type, or
  * some derivative if necessary.  If an instance of the exact type cannot be
  * some derivative if necessary.  If an instance of the exact type cannot be
@@ -145,7 +131,7 @@ register_factory(TypeHandle handle, BaseCreateFunc *func, void *user_data) {
 /**
 /**
  * Returns the number of different types the Factory knows how to create.
  * Returns the number of different types the Factory knows how to create.
  */
  */
-int FactoryBase::
+size_t FactoryBase::
 get_num_types() const {
 get_num_types() const {
   return _creators.size();
   return _creators.size();
 }
 }
@@ -156,8 +142,8 @@ get_num_types() const {
  * Normally you wouldn't need to traverse the list of the Factory's types.
  * Normally you wouldn't need to traverse the list of the Factory's types.
  */
  */
 TypeHandle FactoryBase::
 TypeHandle FactoryBase::
-get_type(int n) const {
-  nassertr(n >= 0 && n < get_num_types(), TypeHandle::none());
+get_type(size_t n) const {
+  nassertr(n < get_num_types(), TypeHandle::none());
   Creators::const_iterator ci;
   Creators::const_iterator ci;
   for (ci = _creators.begin(); ci != _creators.end(); ++ci) {
   for (ci = _creators.begin(); ci != _creators.end(); ++ci) {
     if (n == 0) {
     if (n == 0) {
@@ -193,7 +179,7 @@ add_preferred(TypeHandle handle) {
 /**
 /**
  * Returns the number of types added to the preferred-type list.
  * Returns the number of types added to the preferred-type list.
  */
  */
-int FactoryBase::
+size_t FactoryBase::
 get_num_preferred() const {
 get_num_preferred() const {
   return _preferred.size();
   return _preferred.size();
 }
 }
@@ -202,8 +188,8 @@ get_num_preferred() const {
  * Returns the nth type added to the preferred-type list.
  * Returns the nth type added to the preferred-type list.
  */
  */
 TypeHandle FactoryBase::
 TypeHandle FactoryBase::
-get_preferred(int n) const {
-  nassertr(n >= 0 && n < get_num_preferred(), TypeHandle::none());
+get_preferred(size_t n) const {
+  nassertr(n < get_num_preferred(), TypeHandle::none());
   return _preferred[n];
   return _preferred[n];
 }
 }
 
 
@@ -219,21 +205,6 @@ write_types(std::ostream &out, int indent_level) const {
   }
   }
 }
 }
 
 
-
-/**
- * Don't copy Factories.
- */
-FactoryBase::
-FactoryBase(const FactoryBase &) {
-}
-
-/**
- * Don't copy Factories.
- */
-void FactoryBase::
-operator = (const FactoryBase &) {
-}
-
 /**
 /**
  * Attempts to create an instance of the exact type requested by the given
  * Attempts to create an instance of the exact type requested by the given
  * handle.  Returns the new instance created, or NULL if the instance could
  * handle.  Returns the new instance created, or NULL if the instance could
@@ -262,9 +233,7 @@ make_instance_more_specific(TypeHandle handle, FactoryParams params) {
   // First, walk through the established preferred list.  Maybe one of these
   // First, walk through the established preferred list.  Maybe one of these
   // qualifies.
   // qualifies.
 
 
-  Preferred::const_iterator pi;
-  for (pi = _preferred.begin(); pi != _preferred.end(); ++pi) {
-    TypeHandle ptype = (*pi);
+  for (TypeHandle ptype : _preferred) {
     if (ptype.is_derived_from(handle)) {
     if (ptype.is_derived_from(handle)) {
       TypedObject *object = make_instance_exact(ptype, params);
       TypedObject *object = make_instance_exact(ptype, params);
       if (object != nullptr) {
       if (object != nullptr) {

+ 9 - 10
panda/src/putil/factoryBase.h

@@ -39,8 +39,11 @@ public:
 
 
   // public interface
   // public interface
 public:
 public:
-  FactoryBase();
-  ~FactoryBase();
+  FactoryBase() = default;
+  FactoryBase(const FactoryBase &copy) = delete;
+  ~FactoryBase() = default;
+
+  FactoryBase &operator = (const FactoryBase &copy) = delete;
 
 
   TypedObject *make_instance(TypeHandle handle,
   TypedObject *make_instance(TypeHandle handle,
                              const FactoryParams &params);
                              const FactoryParams &params);
@@ -58,21 +61,17 @@ public:
 
 
   void register_factory(TypeHandle handle, BaseCreateFunc *func, void *user_data = nullptr);
   void register_factory(TypeHandle handle, BaseCreateFunc *func, void *user_data = nullptr);
 
 
-  int get_num_types() const;
-  TypeHandle get_type(int n) const;
+  size_t get_num_types() const;
+  TypeHandle get_type(size_t n) const;
 
 
   void clear_preferred();
   void clear_preferred();
   void add_preferred(TypeHandle handle);
   void add_preferred(TypeHandle handle);
-  int get_num_preferred() const;
-  TypeHandle get_preferred(int n) const;
+  size_t get_num_preferred() const;
+  TypeHandle get_preferred(size_t n) const;
 
 
   void write_types(std::ostream &out, int indent_level = 0) const;
   void write_types(std::ostream &out, int indent_level = 0) const;
 
 
 private:
 private:
-  // These are private; we shouldn't be copy-constructing Factories.
-  FactoryBase(const FactoryBase &copy);
-  void operator = (const FactoryBase &copy);
-
   // internal utility functions
   // internal utility functions
   TypedObject *make_instance_exact(TypeHandle handle, FactoryParams params);
   TypedObject *make_instance_exact(TypeHandle handle, FactoryParams params);
   TypedObject *make_instance_more_specific(TypeHandle handle,
   TypedObject *make_instance_more_specific(TypeHandle handle,

+ 0 - 39
panda/src/putil/factoryParams.I

@@ -13,45 +13,6 @@
 
 
 #include "pnotify.h"
 #include "pnotify.h"
 
 
-/**
- *
- */
-INLINE FactoryParams::
-FactoryParams() : _user_data(nullptr) {
-}
-
-/**
- *
- */
-INLINE FactoryParams::
-FactoryParams(const FactoryParams &copy) :
-  _params(copy._params),
-  _user_data(copy._user_data) {}
-
-/**
- *
- */
-INLINE FactoryParams::
-~FactoryParams() {
-}
-
-/**
- *
- */
-INLINE FactoryParams::
-FactoryParams(FactoryParams &&from) noexcept :
-  _params(std::move(from._params)),
-  _user_data(from._user_data) {}
-
-/**
- *
- */
-INLINE void FactoryParams::
-operator = (FactoryParams &&from) noexcept {
-  _params = std::move(from._params);
-  _user_data = from._user_data;
-}
-
 /**
 /**
  * Returns the custom pointer that was associated with the factory function.
  * Returns the custom pointer that was associated with the factory function.
  */
  */

+ 6 - 6
panda/src/putil/factoryParams.h

@@ -35,12 +35,12 @@
  */
  */
 class EXPCL_PANDA_PUTIL FactoryParams {
 class EXPCL_PANDA_PUTIL FactoryParams {
 public:
 public:
-  INLINE FactoryParams();
-  INLINE FactoryParams(const FactoryParams &copy);
-  INLINE FactoryParams(FactoryParams &&from) noexcept;
-  INLINE ~FactoryParams();
+  FactoryParams() = default;
+  FactoryParams(const FactoryParams &copy) = default;
+  FactoryParams(FactoryParams &&from) noexcept = default;
+  ~FactoryParams() = default;
 
 
-  INLINE void operator = (FactoryParams &&from) noexcept;
+  FactoryParams &operator = (FactoryParams &&from) noexcept = default;
 
 
   void add_param(FactoryParam *param);
   void add_param(FactoryParam *param);
   void clear();
   void clear();
@@ -56,7 +56,7 @@ private:
   typedef pvector< PT(TypedReferenceCount) > Params;
   typedef pvector< PT(TypedReferenceCount) > Params;
 
 
   Params _params;
   Params _params;
-  void *_user_data;
+  void *_user_data = nullptr;
 
 
   friend class FactoryBase;
   friend class FactoryBase;
 };
 };

+ 2 - 2
panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx

@@ -2251,10 +2251,10 @@ do_issue_texture() {
 
 
       // The following special cases are handled inline, rather than relying
       // The following special cases are handled inline, rather than relying
       // on the above wrap function pointers.
       // on the above wrap function pointers.
-      if (wrap_u && SamplerState::WM_border_color && wrap_v == SamplerState::WM_border_color) {
+      if (wrap_u == SamplerState::WM_border_color && wrap_v == SamplerState::WM_border_color) {
         texture_def->tex_minfilter_func = apply_wrap_border_color_minfilter;
         texture_def->tex_minfilter_func = apply_wrap_border_color_minfilter;
         texture_def->tex_magfilter_func = apply_wrap_border_color_magfilter;
         texture_def->tex_magfilter_func = apply_wrap_border_color_magfilter;
-      } else if (wrap_u && SamplerState::WM_clamp && wrap_v == SamplerState::WM_clamp) {
+      } else if (wrap_u == SamplerState::WM_clamp && wrap_v == SamplerState::WM_clamp) {
         texture_def->tex_minfilter_func = apply_wrap_clamp_minfilter;
         texture_def->tex_minfilter_func = apply_wrap_clamp_minfilter;
         texture_def->tex_magfilter_func = apply_wrap_clamp_magfilter;
         texture_def->tex_magfilter_func = apply_wrap_clamp_magfilter;
       }
       }

+ 3 - 3
panda/src/tinydisplay/ztriangle.h

@@ -14,7 +14,7 @@
   int error, derror;
   int error, derror;
   int x1, dxdy_min, dxdy_max;
   int x1, dxdy_min, dxdy_max;
   /* warning: x2 is multiplied by 2^16 */
   /* warning: x2 is multiplied by 2^16 */
-  UNUSED int x2, dx2dy2;
+  int x2, dx2dy2;
 
 
 #ifdef INTERP_Z
 #ifdef INTERP_Z
   int z1 = 0, dzdx = 0, dzdy = 0, dzdl_min = 0, dzdl_max = 0;
   int z1 = 0, dzdx = 0, dzdy = 0, dzdl_min = 0, dzdl_max = 0;
@@ -348,10 +348,10 @@
         int n;
         int n;
 #ifdef INTERP_Z
 #ifdef INTERP_Z
         ZPOINT *pz;
         ZPOINT *pz;
-        UNUSED unsigned int z,zz;
+        unsigned int z,zz;
 #endif
 #endif
 #ifdef INTERP_RGB
 #ifdef INTERP_RGB
-        UNUSED unsigned int or1,og1,ob1,oa1;
+        unsigned int or1,og1,ob1,oa1;
 #endif
 #endif
 #ifdef INTERP_ST
 #ifdef INTERP_ST
         unsigned int s,t;
         unsigned int s,t;

+ 13 - 3
panda/src/tinydisplay/ztriangle_two.h

@@ -1,3 +1,9 @@
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
+#endif
+
 static void
 static void
 FNAME(white_untextured) (ZBuffer *zb,
 FNAME(white_untextured) (ZBuffer *zb,
                          ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2)
                          ZBufferPoint *p0,ZBufferPoint *p1,ZBufferPoint *p2)
@@ -229,7 +235,7 @@ FNAME(smooth_textured) (ZBuffer *zb,
     c2 = RGBA_TO_PIXEL(p2->r, p2->g, p2->b, p2->a);     \
     c2 = RGBA_TO_PIXEL(p2->r, p2->g, p2->b, p2->a);     \
     if (c0 == c1 && c0 == c2) {                         \
     if (c0 == c1 && c0 == c2) {                         \
       /* It's really a flat-shaded triangle. */         \
       /* It's really a flat-shaded triangle. */         \
-      if (c0 == 0xffffffff) {                           \
+      if (c0 == 0xffffffffu) {                          \
         /* Actually, it's a white triangle. */          \
         /* Actually, it's a white triangle. */          \
         FNAME(white_textured)(zb, p0, p1, p2);          \
         FNAME(white_textured)(zb, p0, p1, p2);          \
         return;                                         \
         return;                                         \
@@ -537,13 +543,13 @@ FNAME(smooth_perspective) (ZBuffer *zb,
 
 
 #define EARLY_OUT()                                     \
 #define EARLY_OUT()                                     \
   {                                                     \
   {                                                     \
-    int c0, c1, c2;                                     \
+    unsigned int c0, c1, c2;                            \
     c0 = RGBA_TO_PIXEL(p0->r, p0->g, p0->b, p0->a);     \
     c0 = RGBA_TO_PIXEL(p0->r, p0->g, p0->b, p0->a);     \
     c1 = RGBA_TO_PIXEL(p1->r, p1->g, p1->b, p1->a);     \
     c1 = RGBA_TO_PIXEL(p1->r, p1->g, p1->b, p1->a);     \
     c2 = RGBA_TO_PIXEL(p2->r, p2->g, p2->b, p2->a);     \
     c2 = RGBA_TO_PIXEL(p2->r, p2->g, p2->b, p2->a);     \
     if (c0 == c1 && c0 == c2) {                         \
     if (c0 == c1 && c0 == c2) {                         \
       /* It's really a flat-shaded triangle. */         \
       /* It's really a flat-shaded triangle. */         \
-      if (c0 == 0xffffffff) {                           \
+      if (c0 == 0xffffffffu) {                          \
         /* Actually, it's a white triangle. */          \
         /* Actually, it's a white triangle. */          \
         FNAME(white_perspective)(zb, p0, p1, p2);       \
         FNAME(white_perspective)(zb, p0, p1, p2);       \
         return;                                         \
         return;                                         \
@@ -1008,3 +1014,7 @@ FNAME(smooth_multitex3) (ZBuffer *zb,
 #undef INTERP_MIPMAP
 #undef INTERP_MIPMAP
 #undef CALC_MIPMAP_LEVEL
 #undef CALC_MIPMAP_LEVEL
 #undef ZB_LOOKUP_TEXTURE
 #undef ZB_LOOKUP_TEXTURE
+
+#if defined(__GNUC__) && !defined(__clang__)
+#pragma GCC diagnostic pop
+#endif

+ 1 - 1
panda/src/x11display/x11GraphicsWindow.cxx

@@ -174,7 +174,7 @@ move_pointer(int device, int x, int y) {
     return true;
     return true;
   } else {
   } else {
     // Move a raw mouse.
     // Move a raw mouse.
-    if ((device < 1)||(device >= _input_devices.size())) {
+    if (device < 1 || (size_t)device >= _input_devices.size()) {
       return false;
       return false;
     }
     }
     _input_devices[device].set_pointer_in_window(x, y);
     _input_devices[device].set_pointer_in_window(x, y);

+ 3 - 3
pandatool/src/objegg/objToEggConverter.cxx

@@ -649,7 +649,7 @@ process_f_node(vector_string &words) {
   _f_given = true;
   _f_given = true;
 
 
   bool all_vn = true;
   bool all_vn = true;
-  int non_vn_index = -1;
+  //int non_vn_index = -1;
 
 
   pvector<VertexEntry> verts;
   pvector<VertexEntry> verts;
   verts.reserve(words.size() - 1);
   verts.reserve(words.size() - 1);
@@ -658,7 +658,7 @@ process_f_node(vector_string &words) {
     verts.push_back(entry);
     verts.push_back(entry);
     if (entry._vni == 0) {
     if (entry._vni == 0) {
       all_vn = false;
       all_vn = false;
-      non_vn_index = i;
+      //non_vn_index = i;
     }
     }
   }
   }
 
 
@@ -706,7 +706,7 @@ process_f_node(vector_string &words) {
   }
   }
 
 
   if (_current_vertex_data->_prim->get_num_vertices() + 3 * num_tris > egg_max_indices ||
   if (_current_vertex_data->_prim->get_num_vertices() + 3 * num_tris > egg_max_indices ||
-      _current_vertex_data->_entries.size() + verts.size() > egg_max_vertices) {
+      _current_vertex_data->_entries.size() + verts.size() > (size_t)egg_max_vertices) {
     // We'll exceed our specified limit with these triangles; start a new
     // We'll exceed our specified limit with these triangles; start a new
     // Geom.
     // Geom.
     _current_vertex_data->close_geom(this);
     _current_vertex_data->close_geom(this);

+ 1 - 1
pandatool/src/vrml/vrmlLexer.cxx.prebuilt

@@ -2883,7 +2883,7 @@ input_chars(char *buffer, int &result, int max_size) {
 // Define this macro carefully, since different flex versions call it
 // Define this macro carefully, since different flex versions call it
 // with a different type for result.
 // with a different type for result.
 #define YY_INPUT(buffer, result, max_size) { \
 #define YY_INPUT(buffer, result, max_size) { \
-  int int_result; \
+  int int_result = 0; \
   input_chars((buffer), int_result, (max_size)); \
   input_chars((buffer), int_result, (max_size)); \
   (result) = int_result; \
   (result) = int_result; \
 }
 }

+ 1 - 1
pandatool/src/vrml/vrmlLexer.lxx

@@ -159,7 +159,7 @@ input_chars(char *buffer, int &result, int max_size) {
 // Define this macro carefully, since different flex versions call it
 // Define this macro carefully, since different flex versions call it
 // with a different type for result.
 // with a different type for result.
 #define YY_INPUT(buffer, result, max_size) { \
 #define YY_INPUT(buffer, result, max_size) { \
-  int int_result; \
+  int int_result = 0; \
   input_chars((buffer), int_result, (max_size)); \
   input_chars((buffer), int_result, (max_size)); \
   (result) = int_result; \
   (result) = int_result; \
 }
 }

+ 1 - 1
pandatool/src/xfile/xLexer.cxx.prebuilt

@@ -794,7 +794,7 @@ input_chars(char *buffer, int &result, int max_size) {
 // Define this macro carefully, since different flex versions call it
 // Define this macro carefully, since different flex versions call it
 // with a different type for result.
 // with a different type for result.
 #define YY_INPUT(buffer, result, max_size) { \
 #define YY_INPUT(buffer, result, max_size) { \
-  int int_result; \
+  int int_result = 0; \
   input_chars((buffer), int_result, (max_size)); \
   input_chars((buffer), int_result, (max_size)); \
   (result) = int_result; \
   (result) = int_result; \
 }
 }

+ 1 - 1
pandatool/src/xfile/xLexer.lxx

@@ -150,7 +150,7 @@ input_chars(char *buffer, int &result, int max_size) {
 // Define this macro carefully, since different flex versions call it
 // Define this macro carefully, since different flex versions call it
 // with a different type for result.
 // with a different type for result.
 #define YY_INPUT(buffer, result, max_size) { \
 #define YY_INPUT(buffer, result, max_size) { \
-  int int_result; \
+  int int_result = 0; \
   input_chars((buffer), int_result, (max_size)); \
   input_chars((buffer), int_result, (max_size)); \
   (result) = int_result; \
   (result) = int_result; \
 }
 }