[cogl/wip/cogl-sharp: 9/14] cogl: Don't expose longs in the API (1/2)



commit 6ef968362ea65984ffc1142ea0772263479f21cf
Author: Damien Lespiau <damien lespiau intel com>
Date:   Sun Sep 30 02:11:25 2012 +0100

    cogl: Don't expose longs in the API (1/2)
    
    unsigned long have quite a bad property in that they have different
    sizes on 64 bits platforms depending on if you are on Linux (LP64) or on
    Windows (LLP64).
    
    This makes writing bindings for the CLR really hard as it only has fixed
    types and no types which size would depend on the platform.
    
    As the longs exposed in Cogl don't seem to need to be 64 bits
    on 64 bits platforms, let's just use ints instead. Well, actually, even
    if you wanted to use the 64 bits of longs and not care about Windows,
    you couldn't because the API also has to work on Linux 32 bits.
    
    Let's start by changing the type of the variable storing the number of
    instances alive (per object type) to an int.

 cogl/cogl-object-private.h |    2 +-
 cogl/cogl-object.c         |    4 ++--
 cogl/cogl-object.h         |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/cogl/cogl-object-private.h b/cogl/cogl-object-private.h
index 5510c8e..d145f31 100644
--- a/cogl/cogl-object-private.h
+++ b/cogl/cogl-object-private.h
@@ -117,7 +117,7 @@ struct _CoglObject
 #define COGL_OBJECT_COMMON_DEFINE_WITH_CODE(TypeName, type_name, code)  \
                                                                         \
 CoglObjectClass _cogl_##type_name##_class;                              \
-static unsigned long _cogl_object_##type_name##_count;                  \
+static unsigned int _cogl_object_##type_name##_count;                   \
                                                                         \
 static inline void                                                      \
 _cogl_object_##type_name##_inc (void)                                   \
diff --git a/cogl/cogl-object.c b/cogl/cogl-object.c
index 1ec2e8d..d502356 100644
--- a/cogl/cogl-object.c
+++ b/cogl/cogl-object.c
@@ -239,7 +239,7 @@ cogl_debug_object_foreach_type (CoglDebugObjectForeachTypeCallback func,
                                 void *user_data)
 {
   GHashTableIter iter;
-  unsigned long *instance_count;
+  unsigned int *instance_count;
   CoglDebugObjectTypeInfo info;
 
   g_hash_table_iter_init (&iter, _cogl_debug_instances);
@@ -256,7 +256,7 @@ static void
 print_instances_cb (const CoglDebugObjectTypeInfo *info,
                     void *user_data)
 {
-  g_print ("\t%s: %lu\n", info->name, info->instance_count);
+  g_print ("\t%s: %u\n", info->name, info->instance_count);
 }
 
 void
diff --git a/cogl/cogl-object.h b/cogl/cogl-object.h
index a65bd9c..a0e099e 100644
--- a/cogl/cogl-object.h
+++ b/cogl/cogl-object.h
@@ -117,7 +117,7 @@ typedef void (*CoglUserDataDestroyCallback) (void *user_data);
 typedef struct
 {
   const char *name;
-  unsigned long instance_count;
+  unsigned int instance_count;
 } CoglDebugObjectTypeInfo;
 
 /**



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