From ee9f102aa9ec36b28992512d840f971be4eba571 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 31 Dec 2015 20:14:08 -0800 Subject: [PATCH] No need for toolkit-dependent color initialization. We're not allocating colors ourselves in GTK+ (and haven't been doing so since at least 1.12), and all color_t values are valid colors, so we don't need any toolkit-specific processing to fill in a color_t. While we're at it, catch read errors when reading color filter files. Change-Id: Ieb520d141cf15e371a31a01459d466c95ba2209b Reviewed-on: https://code.wireshark.org/review/12985 Reviewed-by: Guy Harris --- epan/color_filters.c | 111 ++++++++++++++++++-------------- epan/color_filters.h | 19 ++---- epan/prefs.c | 4 ++ ui/gtk/capture_file_dlg.c | 2 +- ui/gtk/color_dlg.c | 2 +- ui/gtk/color_utils.c | 22 +------ ui/gtk/color_utils.h | 34 ++++++++-- ui/gtk/main.c | 6 +- ui/qt/color_utils.cpp | 15 +++++ ui/qt/coloring_rules_dialog.cpp | 23 +------ ui/qt/main_window_slots.cpp | 2 +- ui/qt/wireshark_application.cpp | 2 +- ui/ui_util.h | 1 - ui/win32/file_dlg_win32.c | 2 +- wireshark-qt.cpp | 2 +- 15 files changed, 127 insertions(+), 120 deletions(-) diff --git a/epan/color_filters.c b/epan/color_filters.c index cc95a08a31..549b235697 100644 --- a/epan/color_filters.c +++ b/epan/color_filters.c @@ -45,7 +45,7 @@ #define GREEN_COMPONENT(x) (guint16) (((((x) >> 8) & 0xff) * 65535 / 255)) #define BLUE_COMPONENT(x) (guint16) ( (((x) & 0xff) * 65535 / 255)) -static gboolean read_users_filters(GSList **cfl, gchar** err_msg, initialize_color_func init_func, color_filter_add_cb_func add_cb); +static gboolean read_users_filters(GSList **cfl, gchar** err_msg, color_filter_add_cb_func add_cb); /* the currently active filters */ static GSList *color_filter_list = NULL; @@ -84,7 +84,7 @@ color_filter_new(const gchar *name, /* The name of the filter to create /* Add ten empty (temporary) colorfilters for easy coloring */ static void -color_filters_add_tmp(GSList **cfl, initialize_color_func init_func) +color_filters_add_tmp(GSList **cfl) { gchar *name = NULL; guint32 i; @@ -104,13 +104,13 @@ color_filters_add_tmp(GSList **cfl, initialize_color_func init_func) /* retrieve background and foreground colors */ cval = strtoul(fg_colors[i-1], NULL, 16); - init_func(&fg_color, RED_COMPONENT(cval), - GREEN_COMPONENT(cval), - BLUE_COMPONENT(cval) ); + fg_color.red = RED_COMPONENT(cval); + fg_color.green = GREEN_COMPONENT(cval); + fg_color.blue = BLUE_COMPONENT(cval); cval = strtoul(bg_colors[i-1], NULL, 16); - init_func(&bg_color, RED_COMPONENT(cval), - GREEN_COMPONENT(cval), - BLUE_COMPONENT(cval) ); + bg_color.red = RED_COMPONENT(cval); + bg_color.green = GREEN_COMPONENT(cval); + bg_color.blue = BLUE_COMPONENT(cval); colorf = color_filter_new(name, NULL, &bg_color, &fg_color, TRUE); colorf->filter_text = g_strdup("frame"); *cfl = g_slist_append(*cfl, colorf); @@ -293,20 +293,20 @@ color_filter_list_clone(GSList *cfl) /* Initialize the filter structures (reading from file) for general running, including app startup */ gboolean -color_filters_init(gchar** err_msg, initialize_color_func init_func, color_filter_add_cb_func add_cb) +color_filters_init(gchar** err_msg, color_filter_add_cb_func add_cb) { /* delete all currently existing filters */ color_filter_list_delete(&color_filter_list); /* start the list with the temporary colorizing rules */ - color_filters_add_tmp(&color_filter_list, init_func); + color_filters_add_tmp(&color_filter_list); /* try to read the users filters */ - if (!read_users_filters(&color_filter_list, err_msg, init_func, add_cb)) { + if (!read_users_filters(&color_filter_list, err_msg, add_cb)) { gchar* local_err_msg = NULL; /* if that failed, try to read the global filters */ - if (!color_filters_read_globals(&color_filter_list, &local_err_msg, init_func, add_cb)) { + if (!color_filters_read_globals(&color_filter_list, &local_err_msg, add_cb)) { /* Show the first error */ g_free(local_err_msg); } @@ -318,7 +318,7 @@ color_filters_init(gchar** err_msg, initialize_color_func init_func, color_filte } gboolean -color_filters_reload(gchar** err_msg, initialize_color_func init_func, color_filter_add_cb_func add_cb) +color_filters_reload(gchar** err_msg, color_filter_add_cb_func add_cb) { /* "move" old entries to the deleted list * we must keep them until the dissection no longer needs them */ @@ -326,14 +326,14 @@ color_filters_reload(gchar** err_msg, initialize_color_func init_func, color_fil color_filter_list = NULL; /* start the list with the temporary colorizing rules */ - color_filters_add_tmp(&color_filter_list, init_func); + color_filters_add_tmp(&color_filter_list); /* try to read the users filters */ - if (!read_users_filters(&color_filter_list, err_msg, init_func, add_cb)) { + if (!read_users_filters(&color_filter_list, err_msg, add_cb)) { gchar* local_err_msg = NULL; /* if that failed, try to read the global filters */ - if (!color_filters_read_globals(&color_filter_list, &local_err_msg, init_func, add_cb)) { + if (!color_filters_read_globals(&color_filter_list, &local_err_msg, add_cb)) { /* Show the first error */ g_free(local_err_msg); } @@ -509,8 +509,8 @@ color_filters_colorize_packet(epan_dissect_t *edt) /* read filters from the given file */ /* XXX - Would it make more sense to use GStrings here instead of reallocing our buffers? */ -static gboolean -read_filters_file(FILE *f, gpointer user_data, gchar** err_msg, initialize_color_func init_func, color_filter_add_cb_func add_cb) +static int +read_filters_file(FILE *f, gpointer user_data, color_filter_add_cb_func add_cb) { #define INIT_BUF_SIZE 128 gchar *name = NULL; @@ -522,7 +522,7 @@ read_filters_file(FILE *f, gpointer user_data, gchar** err_msg, initialize_color guint16 fg_r, fg_g, fg_b, bg_r, bg_g, bg_b; gboolean disabled = FALSE; gboolean skip_end_of_line = FALSE; - gboolean ret = TRUE; + int ret = 0; name = (gchar *)g_malloc(name_len + 1); filter_exp = (gchar *)g_malloc(filter_exp_len + 1); @@ -629,22 +629,13 @@ read_filters_file(FILE *f, gpointer user_data, gchar** err_msg, initialize_color continue; } - if (!init_func(&fg_color, fg_r, fg_g, fg_b)) { - /* oops */ - *err_msg = g_strdup_printf("Could not allocate foreground color specified in input file for %s.", name); - dfilter_free(temp_dfilter); - skip_end_of_line = TRUE; - ret = FALSE; - continue; - } - if (!init_func(&bg_color, bg_r, bg_g, bg_b)) { - /* oops */ - *err_msg = g_strdup_printf("Could not allocate background color specified in input file for %s.", name); - dfilter_free(temp_dfilter); - skip_end_of_line = TRUE; - ret = FALSE; - continue; - } + fg_color.red = fg_r; + fg_color.green = fg_g; + fg_color.blue = fg_b; + + bg_color.red = bg_r; + bg_color.green = bg_g; + bg_color.blue = bg_b; colorf = color_filter_new(name, filter_exp, &bg_color, &fg_color, disabled); @@ -665,6 +656,9 @@ read_filters_file(FILE *f, gpointer user_data, gchar** err_msg, initialize_color skip_end_of_line = TRUE; } + if (ferror(f)) + ret = errno; + g_free(name); g_free(filter_exp); return ret; @@ -672,11 +666,11 @@ read_filters_file(FILE *f, gpointer user_data, gchar** err_msg, initialize_color /* read filters from the user's filter file */ static gboolean -read_users_filters(GSList **cfl, gchar** err_msg, initialize_color_func init_func, color_filter_add_cb_func add_cb) +read_users_filters(GSList **cfl, gchar** err_msg, color_filter_add_cb_func add_cb) { gchar *path; FILE *f; - gboolean ret; + int ret; /* decide what file to open (from dfilter code) */ path = get_persconffile_path("colorfilters", TRUE); @@ -691,18 +685,25 @@ read_users_filters(GSList **cfl, gchar** err_msg, initialize_color_func init_fun g_free(path); path = NULL; - ret = read_filters_file(f, cfl, err_msg, init_func, add_cb); + ret = read_filters_file(f, cfl, add_cb); + if (ret != 0) { + *err_msg = g_strdup_printf("Error reading filter file\n\"%s\": %s.", + path, g_strerror(errno)); + fclose(f); + return FALSE; + } + fclose(f); - return ret; + return TRUE; } /* read filters from the filter file */ gboolean -color_filters_read_globals(gpointer user_data, gchar** err_msg, initialize_color_func init_func, color_filter_add_cb_func add_cb) +color_filters_read_globals(gpointer user_data, gchar** err_msg, color_filter_add_cb_func add_cb) { gchar *path; FILE *f; - gboolean ret; + int ret; /* decide what file to open (from dfilter code) */ path = get_datafile_path("colorfilters"); @@ -717,27 +718,41 @@ color_filters_read_globals(gpointer user_data, gchar** err_msg, initialize_color g_free(path); path = NULL; - ret = read_filters_file(f, user_data, err_msg, init_func, add_cb); + ret = read_filters_file(f, user_data, add_cb); + if (ret != 0) { + *err_msg = g_strdup_printf("Error reading global filter file\n\"%s\": %s.", + path, g_strerror(errno)); + fclose(f); + return FALSE; + } + fclose(f); - return ret; + return TRUE; } /* read filters from some other filter file (import) */ gboolean -color_filters_import(const gchar *path, const gpointer user_data, gchar** err_msg, initialize_color_func init_func, color_filter_add_cb_func add_cb) +color_filters_import(const gchar *path, const gpointer user_data, gchar** err_msg, color_filter_add_cb_func add_cb) { FILE *f; - gboolean ret; + int ret; if ((f = ws_fopen(path, "r")) == NULL) { - *err_msg = g_strdup_printf("Could not open\n%s\nfor reading: %s.", + *err_msg = g_strdup_printf("Could not open filter file\n%s\nfor reading: %s.", path, g_strerror(errno)); return FALSE; } - ret = read_filters_file(f, user_data, err_msg, init_func, add_cb); + ret = read_filters_file(f, user_data, add_cb); + if (ret != 0) { + *err_msg = g_strdup_printf("Error reading filter file\n\"%s\": %s.", + path, g_strerror(errno)); + fclose(f); + return FALSE; + } + fclose(f); - return ret; + return TRUE; } struct write_filter_data diff --git a/epan/color_filters.h b/epan/color_filters.h index a240a67862..750c88ee6f 100644 --- a/epan/color_filters.h +++ b/epan/color_filters.h @@ -39,17 +39,6 @@ typedef struct { guint16 blue; } color_t; -/** Initialize a color with R, G, and B values, including any toolkit-dependent - ** work that needs to be done. - * - * @param color the color_t to be filled - * @param red the red value for the color - * @param green the green value for the color - * @param blue the blue value for the color - * @return TRUE if it succeeds, FALSE if it fails - */ -typedef gboolean (*initialize_color_func)(color_t *color, guint16 red, guint16 green, guint16 blue); - #define CONVERSATION_COLOR_PREFIX "___conversation_color_filter___" /** @file * Color filters. @@ -80,10 +69,10 @@ typedef struct _color_filter { typedef void (*color_filter_add_cb_func)(color_filter_t *colorf, gpointer user_data); /** Init the color filters (incl. initial read from file). */ -WS_DLL_PUBLIC gboolean color_filters_init(gchar** err_msg, initialize_color_func init_func, color_filter_add_cb_func add_cb); +WS_DLL_PUBLIC gboolean color_filters_init(gchar** err_msg, color_filter_add_cb_func add_cb); /** Reload the color filters */ -WS_DLL_PUBLIC gboolean color_filters_reload(gchar** err_msg, initialize_color_func init_func, color_filter_add_cb_func add_cb); +WS_DLL_PUBLIC gboolean color_filters_reload(gchar** err_msg, color_filter_add_cb_func add_cb); /** Cleanup remaining color filter zombies */ WS_DLL_PUBLIC void color_filters_cleanup(void); @@ -150,14 +139,14 @@ WS_DLL_PUBLIC void color_filters_clone(gpointer user_data, color_filter_add_cb_f * @param user_data will be returned by each call to to color_filter_add_cb() * @return TRUE, if read succeeded */ -WS_DLL_PUBLIC gboolean color_filters_import(const gchar *path, const gpointer user_data, gchar** err_msg, initialize_color_func init_func, color_filter_add_cb_func add_cb); +WS_DLL_PUBLIC gboolean color_filters_import(const gchar *path, const gpointer user_data, gchar** err_msg, color_filter_add_cb_func add_cb); /** Read filters from the global filter file (not the users file). * * @param user_data will be returned by each call to to color_filter_add_cb() * @return TRUE, if read succeeded */ -WS_DLL_PUBLIC gboolean color_filters_read_globals(gpointer user_data, gchar** err_msg, initialize_color_func init_func, color_filter_add_cb_func add_cb); +WS_DLL_PUBLIC gboolean color_filters_read_globals(gpointer user_data, gchar** err_msg, color_filter_add_cb_func add_cb); /** Apply a changed filter list. diff --git a/epan/prefs.c b/epan/prefs.c index 0d8b53fc61..e94df06ccb 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -3810,6 +3810,10 @@ prefs_capture_options_dialog_column_is_visible(const gchar *column) #define PRS_GUI_FILTER_EXPR "gui.filter_expressions.expr" #define PRS_GUI_FILTER_ENABLED "gui.filter_expressions.enabled" +/* + * Extract the red, green, and blue components of a 24-bit RGB value + * and convert them from [0,255] to [0,65535]. + */ #define RED_COMPONENT(x) (guint16) (((((x) >> 16) & 0xff) * 65535 / 255)) #define GREEN_COMPONENT(x) (guint16) (((((x) >> 8) & 0xff) * 65535 / 255)) #define BLUE_COMPONENT(x) (guint16) ( (((x) & 0xff) * 65535 / 255)) diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c index bf4a7ecc99..b1cf035f5e 100644 --- a/ui/gtk/capture_file_dlg.c +++ b/ui/gtk/capture_file_dlg.c @@ -2277,7 +2277,7 @@ file_color_import_cmd_cb(GtkWidget *color_filters, gpointer filter_list _U_) } /* Try to open the color filter file. */ - if (!color_filters_import(cf_name, color_filters, &err_msg, initialize_color, color_filter_add_cb)) { + if (!color_filters_import(cf_name, color_filters, &err_msg, color_filter_add_cb)) { /* We couldn't open it; don't dismiss the open dialog box, just leave it around so that the user can, after they dismiss the alert box popped up for the open error, diff --git a/ui/gtk/color_dlg.c b/ui/gtk/color_dlg.c index edb6c6da13..ed016b5ee0 100644 --- a/ui/gtk/color_dlg.c +++ b/ui/gtk/color_dlg.c @@ -963,7 +963,7 @@ color_clear_cmd(GtkWidget *widget) } /* try to read the global filters */ - if (!color_filters_read_globals(color_filters, &err_msg, initialize_color, color_filter_add_cb)) + if (!color_filters_read_globals(color_filters, &err_msg, color_filter_add_cb)) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg); g_free(err_msg); diff --git a/ui/gtk/color_utils.c b/ui/gtk/color_utils.c index 65889a2fbf..de34afc395 100644 --- a/ui/gtk/color_utils.c +++ b/ui/gtk/color_utils.c @@ -1,5 +1,5 @@ /* color_utils.c - * Toolkit-dependent implementations of routines to handle colors. + * GTK+ color conversion routines. * * Wireshark - Network traffic analyzer * By Gerald Combs @@ -28,25 +28,6 @@ #include "ui/gtk/color_utils.h" -/* - * Initialize a color with R, G, and B values, including any toolkit-dependent - * work that needs to be done. - * Returns TRUE if it succeeds, FALSE if it fails. - */ -gboolean -initialize_color(color_t *color, guint16 red, guint16 green, guint16 blue) -{ - GdkColor gdk_color; - - gdk_color.pixel = 0; - gdk_color.red = red; - gdk_color.green = green; - gdk_color.blue = blue; - - gdkcolor_to_color_t(color, &gdk_color); - return TRUE; -} - void color_t_to_gdkcolor(GdkColor *target, const color_t *source) { @@ -64,6 +45,7 @@ color_t_to_gdkRGBAcolor(GdkRGBA *target, const color_t *source) target->green = source->green / 65535.0; target->blue = source->blue / 65535.0; } + void gdkcolor_to_color_t(color_t *target, const GdkColor *source) { diff --git a/ui/gtk/color_utils.h b/ui/gtk/color_utils.h index 1f8fcf2ec9..15c4953b62 100644 --- a/ui/gtk/color_utils.h +++ b/ui/gtk/color_utils.h @@ -1,5 +1,5 @@ -/* colors.h - * Definitions for color structures and routines +/* color_utils.h + * Definitions for GTK+ color conversion routines. * * Wireshark - Network traffic analyzer * By Gerald Combs @@ -20,8 +20,8 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef __COLORS_H__ -#define __COLORS_H__ +#ifndef __COLOR_UTILS_H__ +#define __COLOR_UTILS_H__ #include "ui/gtk/gui_utils.h" #include @@ -36,15 +36,39 @@ * @param source the source color_t */ void color_t_to_gdkcolor(GdkColor *target, const color_t *source); + +/** Convert color_t to GdkRGBA. + * + * @param target the GdkRGBA to be filled + * @param source the source color_t + */ void color_t_to_gdkRGBAcolor(GdkRGBA *target, const color_t *source); + /** Convert GdkColor to color_t. * * @param target the source color_t * @param source the GdkColor to be filled */ void gdkcolor_to_color_t(color_t *target, const GdkColor *source); + +/** Convert GdkRGBA to color_t. + * + * @param target the source color_t + * @param source the GdkRGBA to be filled + */ void gdkRGBAcolor_to_color_t(color_t *target, const GdkRGBA *source); +/** Convert GdkColor to GdkRGBA. + * + * @param target the source GdkColor + * @param source the GdkRGBA to be filled + */ void GdkColor_to_GdkRGBA(GdkRGBA *target, const GdkColor *source); + +/** Convert GdkRGBA to GdkColor. + * + * @param target the source GdkColor + * @param source the GdkRGBA to be filled + */ void gdkRGBAcolor_to_GdkColor(GdkColor *target, const GdkRGBA *source); -#endif /* __COLORS_H__ */ +#endif /* __COLOR_UTILS_H__ */ diff --git a/ui/gtk/main.c b/ui/gtk/main.c index 78fdf27188..afac29a273 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -3177,7 +3177,7 @@ main(int argc, char *argv[]) dnd_init(top_level); - if (!color_filters_init(&err_msg, initialize_color, color_filter_add_cb)) { + if (!color_filters_init(&err_msg, color_filter_add_cb)) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg); g_free(err_msg); } @@ -3963,7 +3963,7 @@ void change_configuration_profile (const gchar *profile_name) } /* Reload color filters */ - if (!color_filters_reload(&err_msg, initialize_color, color_filter_add_cb)) { + if (!color_filters_reload(&err_msg, color_filter_add_cb)) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg); g_free(err_msg); } @@ -3989,7 +3989,7 @@ main_fields_changed (void) gchar* err_msg = NULL; /* Reload color filters */ - if (!color_filters_reload(&err_msg, initialize_color, color_filter_add_cb)) { + if (!color_filters_reload(&err_msg, color_filter_add_cb)) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg); g_free(err_msg); } diff --git a/ui/qt/color_utils.cpp b/ui/qt/color_utils.cpp index e6576b0938..204aa59f80 100644 --- a/ui/qt/color_utils.cpp +++ b/ui/qt/color_utils.cpp @@ -54,8 +54,21 @@ ColorUtils::ColorUtils(QObject *parent) : { } +// +// A color_t has RGB values in [0,65535]. +// Qt RGB colors have RGB values in [0,255]. +// +// 65535/255 = 257 = 0x0101, so converting from [0,255] to +// [0,65535] involves just shifting the 8-bit value left 8 bits +// and ORing them together. +// +// Converting from [0,65535] to [0,255] without rounding involves +// just shifting the 16-bit value right 8 bits; I guess you could +// round them by adding 0x80 to the value before shifting. +// QColor ColorUtils::fromColorT (const color_t *color) { if (!color) return QColor(); + // Convert [0,65535] values to [0,255] values return QColor(color->red >> 8, color->green >> 8, color->blue >> 8); } @@ -67,6 +80,8 @@ QColor ColorUtils::fromColorT(color_t color) const color_t ColorUtils::toColorT(const QColor color) { color_t colort; + + // Convert [0,255] values to [0,65535] values colort.red = (color.red() << 8) | color.red(); colort.green = (color.green() << 8) | color.green(); colort.blue = (color.blue() << 8) | color.blue(); diff --git a/ui/qt/coloring_rules_dialog.cpp b/ui/qt/coloring_rules_dialog.cpp index 264cda04d8..5ba48a91a6 100644 --- a/ui/qt/coloring_rules_dialog.cpp +++ b/ui/qt/coloring_rules_dialog.cpp @@ -324,7 +324,7 @@ void ColoringRulesDialog::on_buttonBox_clicked(QAbstractButton *button) QString file_name = QFileDialog::getOpenFileName(this, wsApp->windowTitleString(tr("Import Coloring Rules")), wsApp->lastOpenDir().path()); gchar* err_msg = NULL; - if (!color_filters_import(file_name.toUtf8().constData(), this, &err_msg, initialize_color, color_filter_add_cb)) { + if (!color_filters_import(file_name.toUtf8().constData(), this, &err_msg, color_filter_add_cb)) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg); g_free(err_msg); } @@ -436,27 +436,6 @@ void ColoringRulesTreeDelegate::ruleNameChanged(const QString name) } -/* - * Initialize a color with R, G, and B values, including any toolkit-dependent - * work that needs to be done. - */ -gboolean -initialize_color(color_t *color, guint16 red, guint16 green, guint16 blue) -{ - QColor qc; - - // color_t uses 16-bit components to match Gtk+. Qt use 8. - qc.setRgb(red>>8, green>>8, blue>>8); - if (!qc.isValid()) - return FALSE; - - // Match what color_filters.c does. - color->red = red; - color->green = green; - color->blue = blue; - return TRUE; -} - // Callback for color_filters_clone. void color_filter_add_cb(color_filter_t *colorf, gpointer user_data) diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index c396236eb2..2cc5755626 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -1398,7 +1398,7 @@ void MainWindow::checkDisplayFilter() void MainWindow::fieldsChanged() { gchar *err_msg = NULL; - if (!color_filters_reload(&err_msg, initialize_color, color_filter_add_cb)) { + if (!color_filters_reload(&err_msg, color_filter_add_cb)) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg); g_free(err_msg); } diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp index ec648a56fc..2ba9cfdcfd 100644 --- a/ui/qt/wireshark_application.cpp +++ b/ui/qt/wireshark_application.cpp @@ -394,7 +394,7 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name) } /* Reload color filters */ - if (!color_filters_reload(&err_msg, initialize_color, color_filter_add_cb)) { + if (!color_filters_reload(&err_msg, color_filter_add_cb)) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg); g_free(err_msg); } diff --git a/ui/ui_util.h b/ui/ui_util.h index fd5f1daedb..e973549849 100644 --- a/ui/ui_util.h +++ b/ui/ui_util.h @@ -89,7 +89,6 @@ void packet_list_resize_column(gint col); files Function names make it clear where they are coming from */ -gboolean initialize_color(color_t *color, guint16 red, guint16 green, guint16 blue); void color_filter_add_cb(color_filter_t *colorf, gpointer user_data); #ifdef __cplusplus diff --git a/ui/win32/file_dlg_win32.c b/ui/win32/file_dlg_win32.c index 747819024b..3b8c0614df 100644 --- a/ui/win32/file_dlg_win32.c +++ b/ui/win32/file_dlg_win32.c @@ -978,7 +978,7 @@ win32_import_color_file(HWND h_wnd, gpointer color_filters) { /* XXX - Support export limited to selected filters */ if (GetOpenFileName(ofn)) { g_free( (void *) ofn); - if (!color_filters_import(utf_16to8(file_name), color_filters, &err_msg, initialize_color, color_filter_add_cb)) { + if (!color_filters_import(utf_16to8(file_name), color_filters, &err_msg, color_filter_add_cb)) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg); g_free(err_msg); return; diff --git a/wireshark-qt.cpp b/wireshark-qt.cpp index c1382c967c..bd9277f0f7 100644 --- a/wireshark-qt.cpp +++ b/wireshark-qt.cpp @@ -1354,7 +1354,7 @@ int main(int argc, char *argv[]) //////// gchar* err_msg = NULL; - if (!color_filters_init(&err_msg, initialize_color, color_filter_add_cb)) { + if (!color_filters_init(&err_msg, color_filter_add_cb)) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "%s", err_msg); g_free(err_msg); }