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

Robert Bragg robert at sixbynine.org
Wed Jun 20 03:22:15 PDT 2012


Oops.

This looks good to land to me.

Reviewed-by: Robert Bragg <robert at linux.intel.com>

thanks,
- Robert

On Thu, May 17, 2012 at 11:40 PM, Neil Roberts <neil at linux.intel.com> wrote:
> 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
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl


More information about the Cogl mailing list