[Cogl] [PATCH 2/2] Fix a warning in the vtable for texture_2d_get_data

Neil Roberts neil at linux.intel.com
Wed Sep 26 09:09:19 PDT 2012


The function pointer for texture_2d_get_data in the driver vtable was
expecting an unsigned int for the rowstride but the definition in
cogl-texture-2d-gl.c took a size_t so it was giving an annoying
warning. This normalizes them both to just take an int. This seems to
better match the pattern used for cogl_bitmap_new_from_data and
cogl_texture_2d_new_from_data.
---
 cogl/cogl-driver.h                          | 2 +-
 cogl/cogl-texture-2d.c                      | 2 +-
 cogl/cogl-texture-3d.c                      | 2 +-
 cogl/cogl-texture-private.h                 | 2 +-
 cogl/cogl-texture-rectangle.c               | 2 +-
 cogl/driver/gl/cogl-texture-2d-gl-private.h | 2 +-
 cogl/driver/gl/cogl-texture-2d-gl.c         | 2 +-
 cogl/winsys/cogl-texture-pixmap-x11.c       | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/cogl/cogl-driver.h b/cogl/cogl-driver.h
index 7560ba0..f922111 100644
--- a/cogl/cogl-driver.h
+++ b/cogl/cogl-driver.h
@@ -209,7 +209,7 @@ struct _CoglDriverVtable
   void
   (* texture_2d_get_data) (CoglTexture2D *tex_2d,
                            CoglPixelFormat format,
-                           unsigned int rowstride,
+                           int rowstride,
                            uint8_t *data);
 
   /* Prepares for drawing by flushing the journal, framebuffer state,
diff --git a/cogl/cogl-texture-2d.c b/cogl/cogl-texture-2d.c
index 6b902fb..950ccce 100644
--- a/cogl/cogl-texture-2d.c
+++ b/cogl/cogl-texture-2d.c
@@ -505,7 +505,7 @@ _cogl_texture_2d_set_region (CoglTexture    *tex,
 static CoglBool
 _cogl_texture_2d_get_data (CoglTexture *tex,
                            CoglPixelFormat format,
-                           unsigned int rowstride,
+                           int rowstride,
                            uint8_t *data)
 {
   CoglContext *ctx = tex->context;
diff --git a/cogl/cogl-texture-3d.c b/cogl/cogl-texture-3d.c
index dee4542..6000b37 100644
--- a/cogl/cogl-texture-3d.c
+++ b/cogl/cogl-texture-3d.c
@@ -572,7 +572,7 @@ _cogl_texture_3d_set_region (CoglTexture    *tex,
 static int
 _cogl_texture_3d_get_data (CoglTexture *tex,
                            CoglPixelFormat format,
-                           unsigned int rowstride,
+                           int rowstride,
                            uint8_t *data)
 {
   /* FIXME: we could probably implement this by assuming the data is
diff --git a/cogl/cogl-texture-private.h b/cogl/cogl-texture-private.h
index 42de679..f4b3b40 100644
--- a/cogl/cogl-texture-private.h
+++ b/cogl/cogl-texture-private.h
@@ -81,7 +81,7 @@ struct _CoglTextureVtable
      be necessary). */
   CoglBool (* get_data) (CoglTexture *tex,
                          CoglPixelFormat format,
-                         unsigned int rowstride,
+                         int rowstride,
                          uint8_t *data);
 
   void (* foreach_sub_texture_in_region) (CoglTexture *tex,
diff --git a/cogl/cogl-texture-rectangle.c b/cogl/cogl-texture-rectangle.c
index 2d985bb..3dca1ed 100644
--- a/cogl/cogl-texture-rectangle.c
+++ b/cogl/cogl-texture-rectangle.c
@@ -568,7 +568,7 @@ _cogl_texture_rectangle_set_region (CoglTexture    *tex,
 static CoglBool
 _cogl_texture_rectangle_get_data (CoglTexture *tex,
                                   CoglPixelFormat format,
-                                  unsigned int rowstride,
+                                  int rowstride,
                                   uint8_t *data)
 {
   CoglTextureRectangle *tex_rect = COGL_TEXTURE_RECTANGLE (tex);
diff --git a/cogl/driver/gl/cogl-texture-2d-gl-private.h b/cogl/driver/gl/cogl-texture-2d-gl-private.h
index 492c314..52378ff 100644
--- a/cogl/driver/gl/cogl-texture-2d-gl-private.h
+++ b/cogl/driver/gl/cogl-texture-2d-gl-private.h
@@ -106,7 +106,7 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
 void
 _cogl_texture_2d_gl_get_data (CoglTexture2D *tex_2d,
                               CoglPixelFormat format,
-                              size_t rowstride,
+                              int rowstride,
                               uint8_t *data);
 
 #endif /* _COGL_TEXTURE_2D_GL_PRIVATE_H_ */
diff --git a/cogl/driver/gl/cogl-texture-2d-gl.c b/cogl/driver/gl/cogl-texture-2d-gl.c
index 653405c..52169ec 100644
--- a/cogl/driver/gl/cogl-texture-2d-gl.c
+++ b/cogl/driver/gl/cogl-texture-2d-gl.c
@@ -542,7 +542,7 @@ _cogl_texture_2d_gl_copy_from_bitmap (CoglTexture2D *tex_2d,
 void
 _cogl_texture_2d_gl_get_data (CoglTexture2D *tex_2d,
                               CoglPixelFormat format,
-                              size_t rowstride,
+                              int rowstride,
                               uint8_t *data)
 {
   CoglContext *ctx = COGL_TEXTURE (tex_2d)->context;
diff --git a/cogl/winsys/cogl-texture-pixmap-x11.c b/cogl/winsys/cogl-texture-pixmap-x11.c
index b800f8e..397cda3 100644
--- a/cogl/winsys/cogl-texture-pixmap-x11.c
+++ b/cogl/winsys/cogl-texture-pixmap-x11.c
@@ -694,7 +694,7 @@ _cogl_texture_pixmap_x11_set_region (CoglTexture     *tex,
 static CoglBool
 _cogl_texture_pixmap_x11_get_data (CoglTexture *tex,
                                    CoglPixelFormat format,
-                                   unsigned int rowstride,
+                                   int rowstride,
                                    uint8_t *data)
 {
   CoglTexturePixmapX11 *tex_pixmap = COGL_TEXTURE_PIXMAP_X11 (tex);
-- 
1.7.11.3.g3c3efa5



More information about the Cogl mailing list