From 5785c5888e90c805a227bde413f0e08e8bd3561d Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 7 Aug 2001 03:59:13 +0000 Subject: [PATCH] squelch compiler warnings --- panda/src/builder/builderFuncs.I | 4 ++-- panda/src/builder/builderPrimTempl.I | 7 +++++-- panda/src/egg/eggPolygon.cxx | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/panda/src/builder/builderFuncs.I b/panda/src/builder/builderFuncs.I index 1ba892fe5a..6dd5ee8255 100644 --- a/panda/src/builder/builderFuncs.I +++ b/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; diff --git a/panda/src/builder/builderPrimTempl.I b/panda/src/builder/builderPrimTempl.I index 7b31eb758a..6905cb6c3b 100644 --- a/panda/src/builder/builderPrimTempl.I +++ b/panda/src/builder/builderPrimTempl.I @@ -730,7 +730,6 @@ sort_value() const { template 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 void BuilderPrimTempl:: remove_doubled_verts(int closed) { - SameCoord 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 sc = SameCoord(); + Verts::iterator new_end = unique(_verts.begin(), _verts.end(), sc); _verts.erase(new_end, _verts.end()); diff --git a/panda/src/egg/eggPolygon.cxx b/panda/src/egg/eggPolygon.cxx index d8a87edf4c..b886289dcc 100644 --- a/panda/src/egg/eggPolygon.cxx +++ b/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;