typedef GType to gulong instead of gsize, if possible.
authorTim Janik <timj@gtk.org>
Mon, 26 Nov 2001 09:18:55 +0000 (09:18 +0000)
committerTim Janik <timj@src.gnome.org>
Mon, 26 Nov 2001 09:18:55 +0000 (09:18 +0000)
Mon Nov 26 09:55:12 2001  Tim Janik  <timj@gtk.org>

        * gtype.h: typedef GType to gulong instead of gsize, if possible.

        * gtype.c: fixups for GType being sizeof(long) wide (changed
        UINT casts).
        * gsignal.c:
        * gclosure.c:
        * gparam.c: likewise.

gobject/ChangeLog
gobject/gclosure.c
gobject/gparam.c
gobject/gsignal.c
gobject/gtype.c
gobject/gtype.h

index 55fa4cf..dd1c429 100644 (file)
@@ -1,3 +1,13 @@
+Mon Nov 26 09:55:12 2001  Tim Janik  <timj@gtk.org>
+
+       * gtype.h: typedef GType to gulong instead of gsize, if possible.
+
+       * gtype.c: fixups for GType being sizeof(long) wide (changed
+       UINT casts).
+       * gsignal.c:
+       * gclosure.c:
+       * gparam.c: likewise.
+
 Sun Nov 25 22:33:32 2001  Tim Janik  <timj@gtk.org>
 
        * gtype.h: removed enum GTypeFundamentals. use macros
index 8c540c4..b6282bb 100644 (file)
@@ -505,7 +505,7 @@ g_type_class_meta_marshal (GClosure       *closure,
 {
   GTypeClass *class;
   gpointer callback;
-  /* GType itype = GPOINTER_TO_UINT (closure->data); */
+  /* GType itype = (GType) closure->data; */
   guint offset = GPOINTER_TO_UINT (marshal_data);
   
   class = G_TYPE_INSTANCE_GET_CLASS (g_value_peek_pointer (param_values + 0), itype, GTypeClass);
@@ -528,7 +528,7 @@ g_type_iface_meta_marshal (GClosure       *closure,
 {
   GTypeClass *class;
   gpointer callback;
-  GType itype = GPOINTER_TO_UINT (closure->data);
+  GType itype = (GType) closure->data;
   guint offset = GPOINTER_TO_UINT (marshal_data);
   
   class = G_TYPE_INSTANCE_GET_INTERFACE (g_value_peek_pointer (param_values + 0), itype, GTypeClass);
@@ -550,7 +550,7 @@ g_signal_type_cclosure_new (GType    itype,
   g_return_val_if_fail (G_TYPE_IS_CLASSED (itype) || G_TYPE_IS_INTERFACE (itype), NULL);
   g_return_val_if_fail (struct_offset >= sizeof (GTypeClass), NULL);
   
-  closure = g_closure_new_simple (sizeof (GClosure), GUINT_TO_POINTER (itype));
+  closure = g_closure_new_simple (sizeof (GClosure), (gpointer) itype);
   if (G_TYPE_IS_INTERFACE (itype))
     g_closure_set_meta_marshal (closure, GUINT_TO_POINTER (struct_offset), g_type_iface_meta_marshal);
   else
index 27ac03d..d13435b 100644 (file)
@@ -743,7 +743,7 @@ pool_list (gpointer key,
 {
   GParamSpec *pspec = value;
   gpointer *data = user_data;
-  GType owner_type = GPOINTER_TO_UINT (data[1]);
+  GType owner_type = (GType) data[1];
 
   if (owner_type == pspec->owner_type)
     data[0] = g_list_prepend (data[0], pspec);
@@ -760,7 +760,7 @@ g_param_spec_pool_list_owned (GParamSpecPool *pool,
   
   G_SLOCK (&pool->smutex);
   data[0] = NULL;
-  data[1] = GUINT_TO_POINTER (owner_type);
+  data[1] = (gpointer) owner_type;
   g_hash_table_foreach (pool->hash_table, pool_list, &data);
   G_SUNLOCK (&pool->smutex);
 
@@ -810,7 +810,7 @@ pool_depth_list (gpointer key,
   GParamSpec *pspec = value;
   gpointer *data = user_data;
   GSList **slists = data[0];
-  GType owner_type = GPOINTER_TO_UINT (data[1]);
+  GType owner_type = (GType) data[1];
 
   if (g_type_is_a (owner_type, pspec->owner_type))
     {
@@ -839,7 +839,7 @@ g_param_spec_pool_list (GParamSpecPool *pool,
   d = g_type_depth (owner_type);
   slists = g_new0 (GSList*, d);
   data[0] = slists;
-  data[1] = GUINT_TO_POINTER (owner_type);
+  data[1] = (gpointer) owner_type;
   g_hash_table_foreach (pool->hash_table, pool_depth_list, &data);
   for (i = 0; i < d - 1; i++)
     slists[i] = pspec_list_remove_overridden (slists[i], pool->hash_table, owner_type, n_pspecs_p);
index fdd8437..7394de1 100644 (file)
@@ -947,7 +947,7 @@ g_signal_lookup (const gchar *name,
     {
       /* give elaborate warnings */
       if (!g_type_name (itype))
-       g_warning (G_STRLOC ": unable to lookup signal \"%s\" for invalid type id `%u'",
+       g_warning (G_STRLOC ": unable to lookup signal \"%s\" for invalid type id `%lu'",
                   name, itype);
       else if (!G_TYPE_IS_INSTANTIATABLE (itype))
        g_warning (G_STRLOC ": unable to lookup signal \"%s\" for non instantiatable type `%s'",
@@ -994,7 +994,7 @@ g_signal_list_ids (GType  itype,
     {
       /* give elaborate warnings */
       if (!g_type_name (itype))
-       g_warning (G_STRLOC ": unable to list signals for invalid type id `%u'",
+       g_warning (G_STRLOC ": unable to list signals for invalid type id `%lu'",
                   itype);
       else if (!G_TYPE_IS_INSTANTIATABLE (itype))
        g_warning (G_STRLOC ": unable to list signals of non instantiatable type `%s'",
index c912a7c..d2c9b2a 100644 (file)
@@ -355,7 +355,7 @@ type_node_any_new_W (TypeNode             *pnode,
   
   g_hash_table_insert (static_type_nodes_ht,
                       GUINT_TO_POINTER (node->qname),
-                      GUINT_TO_POINTER (type));
+                      (gpointer) type);
   return node;
 }
 
@@ -1742,7 +1742,7 @@ g_type_register_fundamental (GType                       type_id,
   if ((type_id & TYPE_ID_MASK) ||
       type_id > G_TYPE_FUNDAMENTAL_MAX)
     {
-      g_warning ("attempt to register fundamental type `%s' with invalid type id (%u)",
+      g_warning ("attempt to register fundamental type `%s' with invalid type id (%lu)",
                 type_name,
                 type_id);
       return 0;
@@ -2128,7 +2128,7 @@ g_type_from_name (const gchar *name)
   if (quark)
     {
       G_READ_LOCK (&type_rw_lock);
-      type = GPOINTER_TO_UINT (g_hash_table_lookup (static_type_nodes_ht, GUINT_TO_POINTER (quark)));
+      type = (GType) g_hash_table_lookup (static_type_nodes_ht, GUINT_TO_POINTER (quark));
       G_READ_UNLOCK (&type_rw_lock);
     }
   
@@ -2794,7 +2794,7 @@ g_type_value_table_peek (GType type)
     return vtable;
   
   if (!node)
-    g_warning (G_STRLOC ": type id `%u' is invalid", type);
+    g_warning (G_STRLOC ": type id `%lu' is invalid", type);
   if (!has_refed_data)
     g_warning ("can't peek value table for type `%s' which is not currently referenced",
               type_descriptive_name_I (type));
index b8701ca..c743a42 100644 (file)
@@ -88,7 +88,11 @@ G_BEGIN_DECLS
 
 /* Typedefs
  */
+#if    GLIB_SIZEOF_LONG == GLIB_SIZEOF_SIZE_T
+typedef gulong                          GType;
+#else  /* hm, shouldn't happen? */
 typedef gsize                           GType;
+#endif
 typedef struct _GValue                  GValue;
 typedef union  _GTypeCValue             GTypeCValue;
 typedef struct _GTypePlugin             GTypePlugin;