Ethereal-dev: [Ethereal-dev] 64 bit pointer warnings

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Sun, 9 Mar 2003 07:04:32 +0100
This is something we discussed a while back but I didn't do anything
about it until a few hours ago :-)
Suse has a patch that fixes some warnings when compiling on the ia64
platform. I've converted the casts in the patch to use glib's
GPOINTER_TO_INT etc macros. One thing I don't understand: Why do they
change i from int to long int?
I'll attach both, the original Suse patch and my revised version of the
patch.

  Ciao
   Jörg
--
Joerg Mayer                                            <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want ist just stuff that
works. Some say that should read Microsoft instead of technology.
--- gtk/column_prefs.c
+++ gtk/column_prefs.c
@@ -239,7 +239,7 @@
   for (i = 0; i < NUM_COL_FMTS; i++) {
     mitem = gtk_menu_item_new_with_label(col_format_desc(i));
     gtk_menu_append(GTK_MENU(menu), mitem);
-    SIGNAL_CONNECT(mitem, "activate", column_menu_changed_cb, (gpointer) i);
+    SIGNAL_CONNECT(mitem, "activate", column_menu_changed_cb, (gpointer) ((long int) i));
     gtk_widget_show(mitem);
   }
   gtk_option_menu_set_menu(GTK_OPTION_MENU(fmt_m), menu);
--- gtk/dfilter_expr_dlg.c
+++ gtk/dfilter_expr_dlg.c
@@ -1066,7 +1066,8 @@
     GtkWidget *value_label, *value_entry, *value_list_scrolled_win, *value_list;
     GtkWidget *list_bb, *alignment, *accept_bt, *close_bt;
     header_field_info       *hfinfo;
-    int i, len;
+    int len;
+    long int i;
 #if GTK_MAJOR_VERSION < 2
     void *cookie;
     gchar *name;
@@ -1334,7 +1335,7 @@
            under its parent protocol. */
 #if GTK_MAJOR_VERSION < 2
         protocol_node = g_hash_table_lookup(proto_array,
-                                            (gpointer)proto_registrar_get_parent(i));
+                                            (gpointer)((long int)proto_registrar_get_parent(i)));
         item_node = gtk_ctree_insert_node(GTK_CTREE(tree),
                                           protocol_node, NULL,
                                           &hfinfo->name, 5,
--- packet-dcerpc.c
+++ packet-dcerpc.c
@@ -558,7 +558,8 @@
 dcerpc_bind_hash (gconstpointer k)
 {
     const dcerpc_bind_key *key = (const dcerpc_bind_key *)k;
-    return ((guint)key->conv) + key->ctx_id + key->smb_fid;
+    return ((guint)((long int) key->conv)) + key->ctx_id + key->smb_fid;
+
 }
 
 /*
--- packet-rpc.c
+++ packet-rpc.c
@@ -431,7 +431,7 @@
 {
 	const rpc_call_info_key* key = (const rpc_call_info_key*) k;
 
-	return key->xid + (guint32)(key->conversation);
+	return key->xid + (guint32)((long int)(key->conversation));
 }
 
 
--- packet-ssl.c
+++ packet-ssl.c
@@ -598,7 +598,7 @@
     conv_data = conversation_get_proto_data(conversation, proto_ssl);
     if (conv_data != NULL)
     {
-        conv_version = (guint)conv_data;
+        conv_version = (guint)((long int)conv_data);
     }
 
     /* Initialize the protocol column; we'll set it later when we
@@ -730,7 +730,7 @@
          * this conversation, do so. */
         if (conv_data == NULL)
         {
-            conv_data = (void *)conv_version;
+            conv_data = (void *)((long int)conv_version);
             conversation_add_proto_data(conversation, proto_ssl, conv_data);
         }
 
@@ -2187,7 +2187,7 @@
         /* get rid of the current data */
         conversation_delete_proto_data(conversation, proto_ssl);
     }
-    conversation_add_proto_data(conversation, proto_ssl, (void *)version);
+    conversation_add_proto_data(conversation, proto_ssl, (void *)((long int)version));
 }
 
 static int
--- gtk/column_prefs.c
+++ gtk/column_prefs.c
@@ -239,7 +239,7 @@
   for (i = 0; i < NUM_COL_FMTS; i++) {
     mitem = gtk_menu_item_new_with_label(col_format_desc(i));
     gtk_menu_append(GTK_MENU(menu), mitem);
-    SIGNAL_CONNECT(mitem, "activate", column_menu_changed_cb, (gpointer) i);
+    SIGNAL_CONNECT(mitem, "activate", column_menu_changed_cb, GINT_TO_POINTER(i));
     gtk_widget_show(mitem);
   }
   gtk_option_menu_set_menu(GTK_OPTION_MENU(fmt_m), menu);
--- gtk/dfilter_expr_dlg.c
+++ gtk/dfilter_expr_dlg.c
@@ -1334,7 +1335,7 @@
            under its parent protocol. */
 #if GTK_MAJOR_VERSION < 2
         protocol_node = g_hash_table_lookup(proto_array,
-                                            (gpointer)proto_registrar_get_parent(i));
+                                            GINT_TO_POINTER(proto_registrar_get_parent(i)));
         item_node = gtk_ctree_insert_node(GTK_CTREE(tree),
                                           protocol_node, NULL,
                                           &hfinfo->name, 5,
--- packet-dcerpc.c
+++ packet-dcerpc.c
@@ -558,7 +558,8 @@
 dcerpc_bind_hash (gconstpointer k)
 {
     const dcerpc_bind_key *key = (const dcerpc_bind_key *)k;
-    return ((guint)key->conv) + key->ctx_id + key->smb_fid;
+    return GPOINTER_TO_UINT(key->conv) + key->ctx_id + key->smb_fid;
+
 }
 
 /*
--- packet-rpc.c
+++ packet-rpc.c
@@ -431,7 +431,7 @@
 {
 	const rpc_call_info_key* key = (const rpc_call_info_key*) k;
 
-	return key->xid + (guint32)(key->conversation);
+	return key->xid + GPOINTER_TO_UINT(key->conversation);
 }
 
 
--- packet-ssl.c
+++ packet-ssl.c
@@ -598,7 +598,7 @@
     conv_data = conversation_get_proto_data(conversation, proto_ssl);
     if (conv_data != NULL)
     {
-        conv_version = (guint)conv_data;
+        conv_version = GPOINTER_TO_UINT(conv_data);
     }
 
     /* Initialize the protocol column; we'll set it later when we
@@ -730,7 +730,7 @@
          * this conversation, do so. */
         if (conv_data == NULL)
         {
-            conv_data = (void *)conv_version;
+            conv_data = GINT_TO_POINTER(conv_version);
             conversation_add_proto_data(conversation, proto_ssl, conv_data);
         }
 
@@ -2187,7 +2187,7 @@
         /* get rid of the current data */
         conversation_delete_proto_data(conversation, proto_ssl);
     }
-    conversation_add_proto_data(conversation, proto_ssl, (void *)version);
+    conversation_add_proto_data(conversation, proto_ssl, GINT_TO_POINTER(version));
 }
 
 static int