Ethereal-dev: [Ethereal-dev] RFC: Some patches for 64-bit architectures
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: Thu, 10 Oct 2002 02:33:55 +0200
or why you shouldn't treat pointers as integers and vice versa. I've looked into the source rpm of the suse 8.1 ethereal-0.9.6 package and found one patch. The only thing that patch does is cast around some conversions between pointers and integers. As I didn't like that solution (I don't know whether this even compiles on 32bit archs) I created a solution that is more to my liking. There's basically 3 places where that needed to be done: 1) gtk/ I like my solution, maybe I should add a (gpointer) before the & ? 2) packet-dcerpc.c and packet-rpc: I don't like just adding up integers and pointers in order to calculate a key, but I'm not sure that my solution of just removing the pointer from the sum is all that good either 3) packet-ssl.c: Not yet patched. That's a variable that is used as pointer or as a version (integer), depending on context. Adding a new struct member would be cleaner or, if it's that memory critical, maybe changing the pointer into a union might be a solution.s I've attached the original suse patch and my first attempt at a patch. Please give me feedback what you think about the problem and better solutions (or whether the patch works - I only checked that it compiles!) Ciao Jörg -- Joerg Mayer <jmayer@xxxxxxxxx> I found out that "pro" means "instead of" (as in proconsul). Now I know what proactive means.
--- gtk/column_prefs.c +++ gtk/column_prefs.c @@ -176,7 +176,7 @@ mitem = gtk_menu_item_new_with_label(col_format_desc(i)); gtk_menu_append(GTK_MENU(menu), mitem); gtk_signal_connect( GTK_OBJECT(mitem), "activate", - GTK_SIGNAL_FUNC(column_menu_changed_cb), (gpointer) i); + GTK_SIGNAL_FUNC(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 @@ -936,7 +936,8 @@ GtkWidget *list_bb, *alignment, *accept_bt, *close_bt; GtkCTreeNode *protocol_node, *item_node; header_field_info *hfinfo; - int i, len; + int len; + long int i; void *cookie; gchar *name; GHashTable *proto_array; @@ -1123,7 +1124,7 @@ /* Create a node for the item, and put it under its parent protocol. */ 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, --- gtk/file_dlg.c +++ gtk/file_dlg.c @@ -332,7 +332,7 @@ set_file_type_list(GtkWidget *option_menu) { GtkWidget *ft_menu, *ft_menu_item; - int ft; + long int ft; guint index; guint item_to_select; @@ -371,7 +371,7 @@ static void select_file_type_cb(GtkWidget *w _U_, gpointer data) { - int new_filetype = (int)data; + long int new_filetype = (int)((long int) data); if (filetype != new_filetype) { /* We can select only the filtered or marked packets to be saved if we can --- packet-dcerpc.c +++ packet-dcerpc.c @@ -521,7 +521,7 @@ dcerpc_bind_hash (gconstpointer k) { dcerpc_bind_key *key = (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 @@ -435,7 +435,7 @@ { rpc_call_info_key* key = (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 @@ -602,7 +602,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 @@ -734,7 +734,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); } @@ -2191,7 +2191,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
Index: packet-dcerpc.c =================================================================== RCS file: /usr/local/cvsroot/ethereal/packet-dcerpc.c,v retrieving revision 1.79 diff -u -p -r1.79 packet-dcerpc.c --- packet-dcerpc.c 26 Sep 2002 06:13:07 -0000 1.79 +++ packet-dcerpc.c 9 Oct 2002 23:52:56 -0000 @@ -532,7 +532,7 @@ static guint dcerpc_bind_hash (gconstpointer k) { dcerpc_bind_key *key = (dcerpc_bind_key *)k; - return ((guint)key->conv) + key->ctx_id + key->smb_fid; + return key->ctx_id + key->smb_fid; } /* Index: packet-rpc.c =================================================================== RCS file: /usr/local/cvsroot/ethereal/packet-rpc.c,v retrieving revision 1.104 diff -u -p -r1.104 packet-rpc.c --- packet-rpc.c 4 Sep 2002 09:40:24 -0000 1.104 +++ packet-rpc.c 9 Oct 2002 23:52:57 -0000 @@ -413,7 +413,7 @@ rpc_call_hash(gconstpointer k) { rpc_call_info_key* key = (rpc_call_info_key*) k; - return key->xid + (guint32)(key->conversation); + return key->xid; } Index: gtk/column_prefs.c =================================================================== RCS file: /usr/local/cvsroot/ethereal/gtk/column_prefs.c,v retrieving revision 1.13 diff -u -p -r1.13 column_prefs.c --- gtk/column_prefs.c 5 Sep 2002 18:47:45 -0000 1.13 +++ gtk/column_prefs.c 9 Oct 2002 23:52:58 -0000 @@ -174,7 +174,7 @@ column_prefs_show() { mitem = gtk_menu_item_new_with_label(col_format_desc(i)); gtk_menu_append(GTK_MENU(menu), mitem); gtk_signal_connect( GTK_OBJECT(mitem), "activate", - GTK_SIGNAL_FUNC(column_menu_changed_cb), (gpointer) i); + GTK_SIGNAL_FUNC(column_menu_changed_cb), &i); gtk_widget_show(mitem); } gtk_option_menu_set_menu(GTK_OPTION_MENU(fmt_m), menu); @@ -300,7 +300,7 @@ column_menu_changed_cb(GtkWidget *w _U_, GList *clp; if (cur_row >= 0) { - cur_fmt = (gint) data; + cur_fmt = *(gint *)data; clp = gtk_clist_get_row_data(GTK_CLIST(column_l), cur_row); cfmt = (fmt_data *) clp->data; Index: gtk/dfilter_expr_dlg.c =================================================================== RCS file: /usr/local/cvsroot/ethereal/gtk/dfilter_expr_dlg.c,v retrieving revision 1.29 diff -u -p -r1.29 dfilter_expr_dlg.c --- gtk/dfilter_expr_dlg.c 9 Oct 2002 23:03:11 -0000 1.29 +++ gtk/dfilter_expr_dlg.c 9 Oct 2002 23:52:58 -0000 @@ -7,7 +7,7 @@ * Copyright 2000, Jeffrey C. Foster <jfoste@xxxxxxxxxxxx> and * Guy Harris <guy@xxxxxxxxxxxx> * - * $Id: dfilter_expr_dlg.c,v 1.29 2002/10/09 23:03:11 jmayer Exp $ + * $Id: dfilter_expr_dlg.c,v 1.28 2002/09/05 18:47:45 jmayer Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@xxxxxxxxxxxx> @@ -931,6 +931,7 @@ dfilter_expr_dlg_new(GtkWidget *filter_t GtkCTreeNode *protocol_node, *item_node; header_field_info *hfinfo; int i, len; + int parent; void *cookie; gchar *name; GHashTable *proto_array; @@ -1116,8 +1117,8 @@ dfilter_expr_dlg_new(GtkWidget *filter_t /* Create a node for the item, and put it under its parent protocol. */ - protocol_node = g_hash_table_lookup(proto_array, - (gpointer)proto_registrar_get_parent(i)); + parent = proto_registrar_get_parent(i); + protocol_node = g_hash_table_lookup(proto_array, &parent); item_node = gtk_ctree_insert_node(GTK_CTREE(tree), protocol_node, NULL, &hfinfo->name, 5, Index: gtk/file_dlg.c =================================================================== RCS file: /usr/local/cvsroot/ethereal/gtk/file_dlg.c,v retrieving revision 1.52 diff -u -p -r1.52 file_dlg.c --- gtk/file_dlg.c 9 Sep 2002 20:38:58 -0000 1.52 +++ gtk/file_dlg.c 9 Oct 2002 23:52:59 -0000 @@ -324,7 +324,7 @@ static void set_file_type_list(GtkWidget *option_menu) { GtkWidget *ft_menu, *ft_menu_item; - int ft; + gint ft; guint index; guint item_to_select; @@ -350,7 +350,7 @@ set_file_type_list(GtkWidget *option_men item_to_select = index; } gtk_signal_connect(GTK_OBJECT(ft_menu_item), "activate", - GTK_SIGNAL_FUNC(select_file_type_cb), (gpointer)ft); + GTK_SIGNAL_FUNC(select_file_type_cb), &ft); gtk_menu_append(GTK_MENU(ft_menu), ft_menu_item); gtk_widget_show(ft_menu_item); index++; @@ -363,7 +363,7 @@ set_file_type_list(GtkWidget *option_men static void select_file_type_cb(GtkWidget *w _U_, gpointer data) { - int new_filetype = (int)data; + gint new_filetype = *(gint *)data; if (filetype != new_filetype) { /* We can select only the filtered or marked packets to be saved if we can Index: gtk2/column_prefs.c =================================================================== RCS file: /usr/local/cvsroot/ethereal/gtk2/column_prefs.c,v retrieving revision 1.4 diff -u -p -r1.4 column_prefs.c --- gtk2/column_prefs.c 14 Sep 2002 10:07:39 -0000 1.4 +++ gtk2/column_prefs.c 9 Oct 2002 23:52:59 -0000 @@ -190,7 +190,7 @@ column_prefs_show() { mitem = gtk_menu_item_new_with_label(col_format_desc(i)); gtk_menu_append(GTK_MENU(menu), mitem); g_signal_connect(G_OBJECT(mitem), "activate", - G_CALLBACK(column_menu_changed_cb), (gpointer) i); + G_CALLBACK(column_menu_changed_cb), &i); gtk_widget_show(mitem); } gtk_option_menu_set_menu(GTK_OPTION_MENU(fmt_m), menu); @@ -351,7 +351,7 @@ column_menu_changed_cb(GtkWidget *w _U_, sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(column_l)); if (gtk_tree_selection_get_selected(sel, &model, &iter)) { - cur_fmt = (gint) data; + cur_fmt = *(gint *)data; gtk_tree_model_get(model, &iter, 2, &clp, -1); cfmt = (fmt_data *) clp->data; Index: gtk2/file_dlg.c =================================================================== RCS file: /usr/local/cvsroot/ethereal/gtk2/file_dlg.c,v retrieving revision 1.4 diff -u -p -r1.4 file_dlg.c --- gtk2/file_dlg.c 9 Sep 2002 20:39:01 -0000 1.4 +++ gtk2/file_dlg.c 9 Oct 2002 23:52:59 -0000 @@ -318,7 +318,7 @@ static void set_file_type_list(GtkWidget *option_menu) { GtkWidget *ft_menu, *ft_menu_item; - int ft; + gint ft; guint index; guint item_to_select; @@ -344,7 +344,7 @@ set_file_type_list(GtkWidget *option_men item_to_select = index; } g_signal_connect(G_OBJECT(ft_menu_item), "activate", - G_CALLBACK(select_file_type_cb), (gpointer)ft); + G_CALLBACK(select_file_type_cb), &ft); gtk_menu_append(GTK_MENU(ft_menu), ft_menu_item); gtk_widget_show(ft_menu_item); index++; @@ -357,7 +357,7 @@ set_file_type_list(GtkWidget *option_men static void select_file_type_cb(GtkWidget *w _U_, gpointer data) { - int new_filetype = (int)data; + int new_filetype = *(gint *)data; if (filetype != new_filetype) { /* We can select only the filtered or marked packets to be saved if we can
- Follow-Ups:
- Re: [Ethereal-dev] RFC: Some patches for 64-bit architectures
- From: Guy Harris
- Re: [Ethereal-dev] RFC: Some patches for 64-bit architectures
- Prev by Date: Re: [Ethereal-dev] [patch] add afp 3.1 call
- Next by Date: Re: [Ethereal-dev] RFC: Some patches for 64-bit architectures
- Previous by thread: Re: [Ethereal-dev] Fix for bad CRC calculation in packet-iscsi.c
- Next by thread: Re: [Ethereal-dev] RFC: Some patches for 64-bit architectures
- Index(es):