From d5d0ceedae9740f228cd92e16abbc8697b476c65 Mon Sep 17 00:00:00 2001 From: Russ Taylor Date: Sat, 4 Jul 2015 17:46:59 -0400 Subject: [PATCH 1/4] Removing checks for impossible things. The code comments said that we should not be able to get to this case, but if fact we cannot get to the case. --- contrib/poly2tri/poly2tri/sweep/sweep.cc | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/contrib/poly2tri/poly2tri/sweep/sweep.cc b/contrib/poly2tri/poly2tri/sweep/sweep.cc index 130e06ed4..0f398ad2d 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep.cc +++ b/contrib/poly2tri/poly2tri/sweep/sweep.cc @@ -652,13 +652,6 @@ void Sweep::FlipEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle* t, Triangle& ot = t->NeighborAcross(p); Point& op = *ot.OppositePoint(*t, p); - if (&ot == NULL) { - // If we want to integrate the fillEdgeEvent do it here - // With current implementation we should never get here - //throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle"); - assert(0); - } - if (InScanArea(p, *t->PointCCW(p), *t->PointCW(p), op)) { // Lets rotate shared edge one vertex CW RotateTrianglePair(*t, p, ot, op); @@ -728,13 +721,6 @@ void Sweep::FlipScanEdgeEvent(SweepContext& tcx, Point& ep, Point& eq, Triangle& Triangle& ot = t.NeighborAcross(p); Point& op = *ot.OppositePoint(t, p); - if (&t.NeighborAcross(p) == NULL) { - // If we want to integrate the fillEdgeEvent do it here - // With current implementation we should never get here - //throw new RuntimeException( "[BUG:FIXME] FLIP failed due to missing triangle"); - assert(0); - } - if (InScanArea(eq, *flip_triangle.PointCCW(eq), *flip_triangle.PointCW(eq), op)) { // flip with new edge op->eq FlipEdgeEvent(tcx, eq, op, &ot, op); From 65374b085d6a87df84a7d92914df3ad292fd9472 Mon Sep 17 00:00:00 2001 From: Russ Taylor Date: Sat, 4 Jul 2015 17:49:15 -0400 Subject: [PATCH 2/4] Removing another test that cannot fail. --- contrib/poly2tri/poly2tri/sweep/sweep_context.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/poly2tri/poly2tri/sweep/sweep_context.cc b/contrib/poly2tri/poly2tri/sweep/sweep_context.cc index c9dd5a8c4..235e1eb05 100644 --- a/contrib/poly2tri/poly2tri/sweep/sweep_context.cc +++ b/contrib/poly2tri/poly2tri/sweep/sweep_context.cc @@ -164,7 +164,7 @@ void SweepContext::RemoveFromMap(Triangle* triangle) void SweepContext::MeshClean(Triangle& triangle) { - if (&triangle != NULL && !triangle.IsInterior()) { + if (!triangle.IsInterior()) { triangle.IsInterior(true); triangles_.push_back(&triangle); for (int i = 0; i < 3; i++) { From c09eb045a1bf5f49d2c14d69076d41d60f528ccf Mon Sep 17 00:00:00 2001 From: Russ Taylor Date: Sat, 4 Jul 2015 18:08:31 -0400 Subject: [PATCH 3/4] Explicit conversion of a quantity that should be positive to unsigned to avoid compiler warning. --- code/ACLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/ACLoader.cpp b/code/ACLoader.cpp index 637f51a77..5b7b6a61d 100644 --- a/code/ACLoader.cpp +++ b/code/ACLoader.cpp @@ -620,7 +620,7 @@ aiNode* AC3DImporter::ConvertObjectSection(Object& object, face.mIndices[i] = cur++; // copy vertex positions - if ((vertices - mesh->mVertices) >= mesh->mNumVertices) { + if (static_cast(vertices - mesh->mVertices) >= mesh->mNumVertices) { throw DeadlyImportError("AC3D: Invalid number of vertices"); } *vertices = object.vertices[entry.first] + object.translation; From f618387b062274c9b9a267a7f4fc5eb0856db7ef Mon Sep 17 00:00:00 2001 From: Russ Taylor Date: Sat, 4 Jul 2015 18:31:25 -0400 Subject: [PATCH 4/4] Added const to string definitions so that the compiler won't warn about them being unused. --- contrib/openddlparser/code/OpenDDLParser.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/contrib/openddlparser/code/OpenDDLParser.cpp b/contrib/openddlparser/code/OpenDDLParser.cpp index bc85ec4ab..77a1c4a25 100644 --- a/contrib/openddlparser/code/OpenDDLParser.cpp +++ b/contrib/openddlparser/code/OpenDDLParser.cpp @@ -39,14 +39,14 @@ BEGIN_ODDLPARSER_NS static const char *Version = "0.1.0"; namespace Grammar { - static const char *OpenBracketToken = "{"; - static const char *CloseBracketToken = "}"; - static const char *OpenPropertyToken = "("; - static const char *ClosePropertyToken = ")"; - static const char *BoolTrue = "true"; - static const char *BoolFalse = "false"; - static const char *RefToken = "ref"; - static const char *CommaSeparator = ","; + static const char * const OpenBracketToken = "{"; + static const char * const CloseBracketToken = "}"; + static const char * const OpenPropertyToken = "("; + static const char * const ClosePropertyToken = ")"; + static const char * const BoolTrue = "true"; + static const char * const BoolFalse = "false"; + static const char * const RefToken = "ref"; + static const char * const CommaSeparator = ","; static const char* PrimitiveTypeToken[ Value::ddl_types_max ] = { "bool",