浏览代码

squelch compiler warnings

David Rose 24 年之前
父节点
当前提交
5785c5888e
共有 3 个文件被更改,包括 9 次插入5 次删除
  1. 2 2
      panda/src/builder/builderFuncs.I
  2. 5 2
      panda/src/builder/builderPrimTempl.I
  3. 2 1
      panda/src/egg/eggPolygon.cxx

+ 2 - 2
panda/src/builder/builderFuncs.I

@@ -540,8 +540,8 @@ build_geoms(InputIterator first, InputIterator last,
   GeomBindType bind_colors = G_OVERALL;
   GeomBindType bind_texcoords = G_PER_VERTEX;
 
-  NType overall_normal;
-  CType overall_color;
+  NType overall_normal(0);
+  CType overall_color(0);
   bool first_normal = true;
   bool first_color = true;
 

+ 5 - 2
panda/src/builder/builderPrimTempl.I

@@ -730,7 +730,6 @@ sort_value() const {
 template <class VTX>
 class SameCoord {
 public:
-  SameCoord() {}
   bool operator () (const VTX &a, const VTX &b) const {
     return a.get_coord() == b.get_coord();
   }
@@ -750,7 +749,11 @@ public:
 template <class VTX>
 void BuilderPrimTempl<VTX>::
 remove_doubled_verts(int closed) {
-  SameCoord<Vertex> sc;
+  // For some reason, writing this variable declaration this way
+  // prevents VC++ from generating dozens of spurious "local variable
+  // 'sc' used without having been initialized" warning messages.
+  SameCoord<Vertex> sc = SameCoord<Vertex>();
+
   Verts::iterator new_end = unique(_verts.begin(), _verts.end(), sc);
   _verts.erase(new_end, _verts.end());
 

+ 2 - 1
panda/src/egg/eggPolygon.cxx

@@ -371,6 +371,7 @@ triangulate_poly(EggGroupNode *container, bool convex_also) {
   /* select largest signed area */
   max = 0.0;
   index = 0;
+  flag = 0;
   for (i = 0; i < 3; i++) {
     if (as[i] >= 0.0) {
       if (as[i] > max) {
@@ -400,7 +401,7 @@ triangulate_poly(EggGroupNode *container, bool convex_also) {
     y = 2;
     break;
 
-  case 2:
+  default: // case 2
     x = 1;
     y = 2;
     break;