[cairo-commit] build/configure.ac.warnings src/cairo-gl-shaders.c src/cairo-gl-surface.c src/cairo-xcb-surface-core.c

Benjamin Otte company at kemper.freedesktop.org
Wed Feb 10 13:14:11 PST 2010


 build/configure.ac.warnings  |    2 +-
 src/cairo-gl-shaders.c       |    8 ++++----
 src/cairo-gl-surface.c       |    3 ++-
 src/cairo-xcb-surface-core.c |    3 ++-
 4 files changed, 9 insertions(+), 7 deletions(-)

New commits:
commit ed4a30b38311e4ce0730ecd6026432f4a1e8ddf7
Author: Benjamin Otte <otte at redhat.com>
Date:   Wed Feb 10 22:10:23 2010 +0100

    build: Add -Wdeclaration-after-statement
    
    ... and fix the compile errors from it I get on my build.
    
    It's Cairo style to put declarations before the code, so better warn
    about it.
    Besides, it eases porting to old compilers like MSVC.

diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings
index 212f8a0..5b561e1 100644
--- a/build/configure.ac.warnings
+++ b/build/configure.ac.warnings
@@ -9,7 +9,7 @@ dnl MAYBE_WARN in an ignorable way (like adding whitespace)
 # cast image data from uint8_t to uin32_t.
 
 MAYBE_WARN="-Wall -Wextra \
--Wold-style-definition \
+-Wold-style-definition -Wdeclaration-after-statement \
 -Wmissing-declarations -Werror-implicit-function-declaration \
 -Wnested-externs -Wpointer-arith -Wwrite-strings \
 -Wsign-compare -Wstrict-prototypes -Wmissing-prototypes \
diff --git a/src/cairo-gl-shaders.c b/src/cairo-gl-shaders.c
index 582eb48..e2797d5 100644
--- a/src/cairo-gl-shaders.c
+++ b/src/cairo-gl-shaders.c
@@ -292,14 +292,14 @@ static cairo_status_t
 bind_matrix_to_shader_arb (GLuint program, const char *name, cairo_matrix_t* m)
 {
     GLint location = glGetUniformLocationARB (program, name);
-    if (location == -1)
-        return CAIRO_INT_STATUS_UNSUPPORTED;
     float gl_m[16] = {
         m->xx, m->xy, 0,     m->x0,
         m->yx, m->yy, 0,     m->y0,
         0,     0,     1,     0,
         0,     0,     0,     1
     };
+    if (location == -1)
+        return CAIRO_INT_STATUS_UNSUPPORTED;
     glUniformMatrix4fvARB (location, 1, GL_TRUE, gl_m);
     return CAIRO_STATUS_SUCCESS;
 }
@@ -466,14 +466,14 @@ static cairo_status_t
 bind_matrix_to_shader_core_2_0 (GLuint program, const char *name, cairo_matrix_t* m)
 {
     GLint location = glGetUniformLocation (program, name);
-    if (location == -1)
-        return CAIRO_INT_STATUS_UNSUPPORTED;
     float gl_m[16] = {
         m->xx, m->xy, 0,     m->x0,
         m->yx, m->yy, 0,     m->y0,
         0,     0,     1,     0,
         0,     0,     0,     1
     };
+    if (location == -1)
+        return CAIRO_INT_STATUS_UNSUPPORTED;
     glUniformMatrix4fv (location, 1, GL_TRUE, gl_m);
     return CAIRO_STATUS_SUCCESS;
 }
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index c860f30..9c7c28e 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -1311,9 +1311,10 @@ _cairo_gl_operand_init (cairo_gl_composite_operand_t *operand,
 		       int dst_x, int dst_y,
 		       int width, int height)
 {
-    operand->pattern = pattern;
     cairo_status_t status;
 
+    operand->pattern = pattern;
+
     switch (pattern->type) {
     case CAIRO_PATTERN_TYPE_SOLID:
 	return _cairo_gl_solid_operand_init (operand,
diff --git a/src/cairo-xcb-surface-core.c b/src/cairo-xcb-surface-core.c
index 2788bdf..3cc167e 100644
--- a/src/cairo-xcb-surface-core.c
+++ b/src/cairo-xcb-surface-core.c
@@ -506,9 +506,10 @@ _cairo_xcb_surface_core_copy_boxes (cairo_xcb_surface_t		*dst,
 	_cairo_xcb_connection_change_gc (dst->connection, gc, mask, values);
 
 	for (chunk = &boxes->chunks; chunk != NULL; chunk = chunk->next) {
-	    xcb_rects = (xcb_rectangle_t *) chunk->base;
 	    int i;
 
+	    xcb_rects = (xcb_rectangle_t *) chunk->base;
+
 	    for (i = 0; i < chunk->count; i++) {
 		int x1 = _cairo_fixed_integer_round (chunk->base[i].p1.x);
 		int x2 = _cairo_fixed_integer_round (chunk->base[i].p2.x);


More information about the cairo-commit mailing list