[gegl] fix various pointer <-> integer casts



commit be2cb36de7d789238233953ced3f0fc32754ffd8
Author: Nils Philippsen <nils redhat com>
Date:   Fri Feb 19 15:05:29 2010 +0100

    fix various pointer <-> integer casts

 gegl/buffer/gegl-tile-backend-ram.c     |    2 +-
 gegl/buffer/gegl-tile-backend-tiledir.c |    2 +-
 gegl/buffer/gegl-tile-handler-cache.c   |    4 ++--
 gegl/buffer/gegl-tile-handler-log.c     |    4 ++--
 gegl/buffer/gegl-tile-source.h          |    8 ++++----
 gegl/gegl-utils.c                       |    2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/gegl/buffer/gegl-tile-backend-ram.c b/gegl/buffer/gegl-tile-backend-ram.c
index c2bee78..580fac9 100644
--- a/gegl/buffer/gegl-tile-backend-ram.c
+++ b/gegl/buffer/gegl-tile-backend-ram.c
@@ -253,7 +253,7 @@ gegl_tile_backend_ram_command (GeglTileSource     *tile_store,
         return NULL;
 
       case GEGL_TILE_EXIST:
-        return (gpointer)exist_tile (tile_store, data, x, y, z);
+        return GINT_TO_POINTER(exist_tile (tile_store, data, x, y, z));
 
       default:
         g_assert (command < GEGL_TILE_LAST_COMMAND &&
diff --git a/gegl/buffer/gegl-tile-backend-tiledir.c b/gegl/buffer/gegl-tile-backend-tiledir.c
index 221e1ff..e0a1d8f 100644
--- a/gegl/buffer/gegl-tile-backend-tiledir.c
+++ b/gegl/buffer/gegl-tile-backend-tiledir.c
@@ -256,7 +256,7 @@ gegl_tile_backend_tiledir_command (GeglTileSource  *tile_store,
         return void_tile (tile_store, data, x, y, z);
 
       case GEGL_TILE_EXIST:
-        return (gpointer)exist_tile (tile_store, data, x, y, z);
+        return GINT_TO_POINTER (exist_tile (tile_store, data, x, y, z));
 
       default:
         g_assert (command < GEGL_TILE_LAST_COMMAND &&
diff --git a/gegl/buffer/gegl-tile-handler-cache.c b/gegl/buffer/gegl-tile-handler-cache.c
index dd19e98..d18eb05 100644
--- a/gegl/buffer/gegl-tile-handler-cache.c
+++ b/gegl/buffer/gegl-tile-handler-cache.c
@@ -270,7 +270,7 @@ gegl_tile_handler_cache_command (GeglTileSource  *tile_store,
          */
         return get_tile (tile_store, x, y, z);
       case GEGL_TILE_IS_CACHED:
-        return (gpointer)gegl_tile_handler_cache_has_tile (cache, x, y, z);
+        return GINT_TO_POINTER(gegl_tile_handler_cache_has_tile (cache, x, y, z));
       case GEGL_TILE_EXIST:
         {
           gboolean exist = gegl_tile_handler_cache_has_tile (cache, x, y, z);
@@ -282,7 +282,7 @@ gegl_tile_handler_cache_command (GeglTileSource  *tile_store,
         {
           gboolean action = gegl_tile_handler_cache_wash (cache);
           if (action)
-            return (gpointer)action;
+            return GINT_TO_POINTER(action);
           break;
         }
       case GEGL_TILE_REFETCH:
diff --git a/gegl/buffer/gegl-tile-handler-log.c b/gegl/buffer/gegl-tile-handler-log.c
index b251a6e..e73fded 100644
--- a/gegl/buffer/gegl-tile-handler-log.c
+++ b/gegl/buffer/gegl-tile-handler-log.c
@@ -62,11 +62,11 @@ gegl_tile_handler_log_command (GeglTileSource  *gegl_tile_source,
       default:
         if (result)
         g_print ("(%s %p %p %i·%i·%i â??%p)", 
-          commands[command], (void *) ((gint)gegl_tile_source&0xffff), (void*)((gint)data&0xffff), x, y, z,
+          commands[command], GINT_TO_POINTER(GPOINTER_TO_INT(gegl_tile_source)&0xffff), GINT_TO_POINTER(GPOINTER_TO_INT(data)&0xffff), x, y, z,
           result);
         else
         g_print ("(%s %p %p %i·%i·%i �)", 
-          commands[command], (void *) ((gint)gegl_tile_source&0xffff), data, x, y, z);
+          commands[command], GINT_TO_POINTER(GPOINTER_TO_INT(gegl_tile_source)&0xffff), data, x, y, z);
     }
   return result;
 }
diff --git a/gegl/buffer/gegl-tile-source.h b/gegl/buffer/gegl-tile-source.h
index 0abca72..28b1d83 100644
--- a/gegl/buffer/gegl-tile-source.h
+++ b/gegl/buffer/gegl-tile-source.h
@@ -183,19 +183,19 @@ gboolean  gegl_tile_source_idle      (GegTileSource *source);
 
 
 #define gegl_tile_source_set_tile(source,x,y,z,tile) \
-   (gboolean)gegl_tile_source_command(source,GEGL_TILE_SET,x,y,z,tile)
+   (gboolean)GPOINTER_TO_INT(gegl_tile_source_command(source,GEGL_TILE_SET,x,y,z,tile))
 #define gegl_tile_source_get_tile(source,x,y,z) \
    (GeglTile*)gegl_tile_source_command(source,GEGL_TILE_GET,x,y,z,NULL)
 #define gegl_tile_source_is_cached(source,x,y,z) \
-   (gboolean)gegl_tile_source_command(source,GEGL_TILE_IS_CACHED,x,y,z,NULL)
+   (gboolean)GPOINTER_TO_INT(gegl_tile_source_command(source,GEGL_TILE_IS_CACHED,x,y,z,NULL))
 #define gegl_tile_source_exist(source,x,y,z) \
-   (gboolean)gegl_tile_source_command(source,GEGL_TILE_EXIST,x,y,z,NULL)
+   (gboolean)GPOINTER_TO_INT(gegl_tile_source_command(source,GEGL_TILE_EXIST,x,y,z,NULL))
 #define gegl_tile_source_void(source,x,y,z) \
    gegl_tile_source_command(source,GEGL_TILE_VOID,x,y,z,NULL)
 #define gegl_tile_source_refetch(source,x,y,z) \
    gegl_tile_source_command(source,GEGL_TILE_REFETCH,x,y,z,NULL)
 #define gegl_tile_source_idle(source) \
-   (gboolean)gegl_tile_source_command(source,GEGL_TILE_IDLE,0,0,0,NULL)
+   (gboolean)GPOINTER_TO_INT(gegl_tile_source_command(source,GEGL_TILE_IDLE,0,0,0,NULL))
 
 G_END_DECLS
 
diff --git a/gegl/gegl-utils.c b/gegl/gegl-utils.c
index b87731b..e80c955 100644
--- a/gegl/gegl-utils.c
+++ b/gegl/gegl-utils.c
@@ -228,7 +228,7 @@
     gint   offset;
 
     mem    = g_malloc (size + GEGL_ALIGN + sizeof(gpointer));
-    offset = GEGL_ALIGN - (((guint)mem) + sizeof(gpointer)) % GEGL_ALIGN;
+    offset = GEGL_ALIGN - (GPOINTER_TO_UINT(mem) + sizeof(gpointer)) % GEGL_ALIGN;
     ret    = (gpointer)(mem + sizeof(gpointer) + offset);
 
     /* store the real malloc one pointer in front of this malloc */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]