Ethereal-dev: [Ethereal-dev] patches
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Lars.Roland@xxxxxxx
Date: Mon, 2 Jun 2003 21:24:04 +0200 (MEST)
Hello all, I was able to compile Ethereal with glib 2.2.1 and GTK 2.2.1 on Windows. However I had to patch "plugins.c" because it used some functions, which are not available in glib 2 anymore. I also added col_set_fence() to the plugin_api, because I'd like to use it in a plugin. I also patched "ethereal.nsi". The generated uninstaller didn't remove Startmenu Entries and Desktop Icon. All patches are attached. Please check in. Best Regards, Lars
Index: ethereal/epan/plugins.c =================================================================== RCS file: /cvsroot/ethereal/epan/plugins.c,v retrieving revision 1.70 diff -u -r1.70 plugins.c --- ethereal/epan/plugins.c 1 May 2003 21:10:42 -0000 1.70 +++ ethereal/epan/plugins.c 2 Jun 2003 18:49:34 -0000 @@ -144,13 +144,19 @@ plugins_scan_dir(const char *dirname) { #define FILENAME_LEN 1024 +#if GLIB_MAJOR_VERSION < 2 gchar *hack_path; /* pathname used to construct lt_lib_ext */ gchar *lt_lib_ext; /* extension for loadable modules */ DIR *dir; /* scanned directory */ struct dirent *file; /* current file */ + gchar *name; +#else /* GLIB 2 */ + GDir *dir; /* scanned directory */ + GError **dummy; + const gchar *name; +#endif gchar filename[FILENAME_LEN]; /* current file name */ GModule *handle; /* handle returned by dlopen */ - gchar *name; gchar *version; void (*init)(void *); void (*reg_handoff)(void); @@ -168,6 +174,8 @@ * to use, but that's not checked into the GLib CVS tree yet, * and we can't use it on systems that don't have GLib 2.0. */ + +#if GLIB_MAJOR_VERSION < 2 hack_path = g_module_build_path("", ""); lt_lib_ext = strrchr(hack_path, '.'); if (lt_lib_ext == NULL) @@ -202,6 +210,27 @@ continue; } name = (gchar *)file->d_name; +#else /* GLIB 2 */ + dummy = g_malloc(sizeof(GError *)); + *dummy = NULL; + if ((dir = g_dir_open(dirname, 0, dummy)) != NULL) + { + while ((name = g_dir_read_name(dir)) != NULL) + { + /* skip anything but files with G_MODULE_SUFFIX */ + dot = strrchr(name, '.'); + if (dot == NULL || strcmp(dot+1, G_MODULE_SUFFIX) != 0) continue; + + snprintf(filename, FILENAME_LEN, "%s" G_DIR_SEPARATOR_S "%s", + dirname, name); + + if ((handle = g_module_open(filename, 0)) == NULL) + { + g_warning("Couldn't load module %s: %s", filename, + g_module_error()); + continue; + } +#endif if (g_module_symbol(handle, "version", (gpointer*)&version) == FALSE) { g_warning("The plugin %s has no version symbol", name); @@ -234,7 +263,7 @@ * We have a "plugin_reg_handoff()" routine, so we don't * need the protocol, filter string, or dissector pointer. */ - if ((cr = add_plugin(handle, g_strdup(file->d_name), version, + if ((cr = add_plugin(handle, g_strdup(name), version, reg_handoff))) { if (cr == EEXIST) @@ -268,9 +297,16 @@ "Those are no longer supported.\n", name, version); } } +#if GLIB_MAJOR_VERSION < 2 closedir(dir); } g_free(hack_path); +#else /* GLIB 2 */ + g_dir_close(dir); + } + g_clear_error(dummy); + g_free(dummy); +#endif } /* @@ -489,7 +525,7 @@ patable.p_fragment_delete = fragment_delete; patable.p_show_fragment_tree = show_fragment_tree; patable.p_show_fragment_seq_tree = show_fragment_seq_tree; - + patable.p_register_tap = register_tap; patable.p_tap_queue_packet = tap_queue_packet; @@ -517,7 +553,7 @@ patable.p_asn1_oid_decode = asn1_oid_decode; patable.p_asn1_sequence_decode = asn1_sequence_decode; patable.p_asn1_err_to_str = asn1_err_to_str; - + patable.p_proto_item_set_end = proto_item_set_end; patable.p_proto_tree_add_none_format = proto_tree_add_none_format; @@ -533,6 +569,8 @@ patable.p_except_free = except_free; patable.p_except_pop = except_pop; patable.p_except_setup_try = except_setup_try; + + patable.p_col_set_fence = col_set_fence; #endif #ifdef WIN32 Index: ethereal/plugins/plugin_api.c =================================================================== RCS file: /cvsroot/ethereal/plugins/plugin_api.c,v retrieving revision 1.50 diff -u -r1.50 plugin_api.c --- ethereal/plugins/plugin_api.c 1 May 2003 21:10:43 -0000 1.50 +++ ethereal/plugins/plugin_api.c 2 Jun 2003 09:23:04 -0000 @@ -254,4 +254,6 @@ p_except_free = pat->p_except_free; p_except_pop = pat->p_except_pop; p_except_setup_try = pat->p_except_setup_try; + + p_col_set_fence = pat->p_col_set_fence; } Index: ethereal/plugins/plugin_api.h =================================================================== RCS file: /cvsroot/ethereal/plugins/plugin_api.h,v retrieving revision 1.51 diff -u -r1.51 plugin_api.h --- ethereal/plugins/plugin_api.h 1 May 2003 21:10:43 -0000 1.51 +++ ethereal/plugins/plugin_api.h 2 Jun 2003 09:23:05 -0000 @@ -284,6 +284,8 @@ #define except_free (*p_except_free) #define except_pop (*p_except_pop) #define except_setup_try (*p_except_setup_try) + +#define col_set_fence (*p_col_set_fence) #endif Index: ethereal/plugins/plugin_api_decls.h =================================================================== RCS file: /cvsroot/ethereal/plugins/plugin_api_decls.h,v retrieving revision 1.13 diff -u -r1.13 plugin_api_decls.h --- ethereal/plugins/plugin_api_decls.h 1 May 2003 21:10:43 -0000 1.13 +++ ethereal/plugins/plugin_api_decls.h 2 Jun 2003 09:23:06 -0000 @@ -293,3 +293,5 @@ addr_except_free p_except_free; addr_except_pop p_except_pop; addr_except_setup_try p_except_setup_try; + +addr_col_set_fence p_col_set_fence; Index: ethereal/plugins/plugin_table.h =================================================================== RCS file: /cvsroot/ethereal/plugins/plugin_table.h,v retrieving revision 1.63 diff -u -r1.63 plugin_table.h --- ethereal/plugins/plugin_table.h 1 May 2003 21:10:43 -0000 1.63 +++ ethereal/plugins/plugin_table.h 2 Jun 2003 09:23:06 -0000 @@ -331,6 +331,8 @@ typedef struct except_stacknode *(*addr_except_pop)(void); typedef void (*addr_except_setup_try)(struct except_stacknode *, struct except_catch *, const except_id_t [], size_t); +typedef void (*addr_col_set_fence)(column_info*, gint); + typedef struct { #include "plugin_api_decls.h"
Index: ethereal/packaging/nsis/ethereal.nsi =================================================================== RCS file: /cvsroot/ethereal/packaging/nsis/ethereal.nsi,v retrieving revision 1.12 diff -u -r1.12 ethereal.nsi --- ethereal/packaging/nsis/ethereal.nsi 21 Apr 2003 21:28:36 -0000 1.12 +++ ethereal/packaging/nsis/ethereal.nsi 2 Jun 2003 09:23:03 -0000 @@ -183,6 +183,11 @@ DeleteRegKey HKEY_LOCAL_MACHINE "Software\Microsoft\Windows\CurrentVersion\Uninstall\Ethereal" DeleteRegKey HKEY_LOCAL_MACHINE SOFTWARE\Ethereal + +; +; UnInstall for every user +; +SetShellVarContext all Delete "$INSTDIR\plugins\${VERSION}\*.*" Delete "$INSTDIR\plugins\*.*"
- Follow-Ups:
- Re: [Ethereal-dev] patches
- From: Gerald Combs
- Re: [Ethereal-dev] patches
- From: Matthijs Melchior
- Re: [Ethereal-dev] patches
- Prev by Date: [Ethereal-dev] packet-iapp.c
- Next by Date: Re: [Ethereal-dev] Fix for packet-cpha.c - question & a patch
- Previous by thread: [Ethereal-dev] packet-iapp.c
- Next by thread: Re: [Ethereal-dev] patches
- Index(es):