[Cogl] [PATCH 4/6] matrix-stack: Fix the _cogl_matrix_entry_equal function

Neil Roberts neil at linux.intel.com
Thu May 17 15:40:16 PDT 2012


The _cogl_matrix_entry_equal function has a large switch statement to
do the right kind of comparison for the entry. However most of the
entries have a return statement that is only conditionally reached.
There were no corresponding break statements to the case labels so
presumably if the comparison succeeded for the correct entry type it
would also flow through and try the comparison for the next type which
would be extremely unlikely to pass.
---
 cogl/cogl-matrix-stack.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/cogl/cogl-matrix-stack.c b/cogl/cogl-matrix-stack.c
index 32b0cd7..a8b42e7 100644
--- a/cogl/cogl-matrix-stack.c
+++ b/cogl/cogl-matrix-stack.c
@@ -863,6 +863,7 @@ _cogl_matrix_entry_equal (CoglMatrixEntry *entry0,
                 translate0->z != translate1->z)
               return FALSE;
           }
+          break;
         case COGL_MATRIX_OP_ROTATE:
           {
             CoglMatrixEntryRotate *rotate0 =
@@ -875,6 +876,7 @@ _cogl_matrix_entry_equal (CoglMatrixEntry *entry0,
                 rotate0->z != rotate1->z)
               return FALSE;
           }
+          break;
         case COGL_MATRIX_OP_SCALE:
           {
             CoglMatrixEntryScale *scale0 = (CoglMatrixEntryScale *)entry0;
@@ -884,6 +886,7 @@ _cogl_matrix_entry_equal (CoglMatrixEntry *entry0,
                 scale0->z != scale1->z)
               return FALSE;
           }
+          break;
         case COGL_MATRIX_OP_MULTIPLY:
           {
             CoglMatrixEntryMultiply *mult0 = (CoglMatrixEntryMultiply *)entry0;
@@ -891,6 +894,7 @@ _cogl_matrix_entry_equal (CoglMatrixEntry *entry0,
             if (!cogl_matrix_equal (mult0->matrix, mult1->matrix))
               return FALSE;
           }
+          break;
         case COGL_MATRIX_OP_LOAD:
           {
             CoglMatrixEntryLoad *load0 = (CoglMatrixEntryLoad *)entry0;
-- 
1.7.3.16.g9464b



More information about the Cogl mailing list