From a5cee04fad8ca23a2f3a3ac5b5233ca6b01fe71e Mon Sep 17 00:00:00 2001 From: Jeff Morriss Date: Thu, 22 May 2008 15:46:27 +0000 Subject: Move the file utility functions from wiretap to libwsutil so that libwireshark (and the plugins using those functions) do not depend on wiretap on Windows. While doing that, rename the eth_* functions to ws_*. svn path=/trunk/; revision=25354 --- color_filters.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'color_filters.c') diff --git a/color_filters.c b/color_filters.c index 445c36d1cf..6d72c1928e 100644 --- a/color_filters.c +++ b/color_filters.c @@ -24,7 +24,7 @@ /* * Updated 1 Dec 10 jjm */ - + #ifdef HAVE_CONFIG_H # include "config.h" #endif @@ -34,7 +34,7 @@ #include #include -#include "file_util.h" +#include #include #include "color.h" @@ -54,7 +54,7 @@ static gboolean read_users_filters(GSList **cfl); /* the currently active filters */ static GSList *color_filter_list = NULL; -/* keep "old" deleted filters in this list until +/* keep "old" deleted filters in this list until * the dissection no longer needs them (e.g. file is closed) */ static GSList *color_filter_deleted_list = NULL; static GSList *color_filter_valid_list = NULL; @@ -157,10 +157,10 @@ color_filters_set_tmp(guint8 filt_nr, gchar *filter, gboolean disabled) * If found, clear it so that a filter can be "moved" up and down the list */ for ( i=1 ; i<=10 ; i++ ) { - /* If we need to reset the temporary filter (filter==NULL), don't look + /* If we need to reset the temporary filter (filter==NULL), don't look * for other rules with the same filter string */ - if( i!=filt_nr && filter==NULL ) + if( i!=filt_nr && filter==NULL ) continue; name = g_strdup_printf("%s%02d",TEMP_COLOR_PREFIX,i); @@ -380,7 +380,7 @@ color_filters_apply(GSList *tmp_cfl, GSList *edit_cfl) /* clone all list entries from tmp/edit to normal list */ color_filter_valid_list = NULL; color_filter_valid_list = color_filter_list_clone(tmp_cfl); - color_filter_valid_list = g_slist_concat(color_filter_valid_list, + color_filter_valid_list = g_slist_concat(color_filter_valid_list, color_filter_list_clone(edit_cfl) ); /* compile all filter */ @@ -393,13 +393,13 @@ color_filters_apply(GSList *tmp_cfl, GSList *edit_cfl) g_slist_foreach(color_filter_list, color_filter_compile_cb, NULL); } -gboolean +gboolean color_filters_used(void) { return color_filter_list != NULL && filters_enabled; } -gboolean +gboolean tmp_color_filters_used(void) { return tmp_colors_set; @@ -505,7 +505,7 @@ read_filters_file(FILE *f, gpointer user_data) } /* skip # comments and invalid lines */ - if (c != '@') { + if (c != '@') { skip_end_of_line = TRUE; continue; } @@ -526,7 +526,7 @@ read_filters_file(FILE *f, gpointer user_data) name_len *= 2; name = g_realloc(name, name_len + 1); } - name[i++] = c; + name[i++] = c; } name[i] = '\0'; @@ -630,7 +630,7 @@ read_users_filters(GSList **cfl) /* decide what file to open (from dfilter code) */ path = get_persconffile_path("colorfilters", TRUE, FALSE); - if ((f = eth_fopen(path, "r")) == NULL) { + if ((f = ws_fopen(path, "r")) == NULL) { if (errno != ENOENT) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not open filter file\n\"%s\": %s.", path, @@ -657,7 +657,7 @@ color_filters_read_globals(gpointer user_data) /* decide what file to open (from dfilter code) */ path = get_datafile_path("colorfilters"); - if ((f = eth_fopen(path, "r")) == NULL) { + if ((f = ws_fopen(path, "r")) == NULL) { if (errno != ENOENT) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not open global filter file\n\"%s\": %s.", path, @@ -681,7 +681,7 @@ color_filters_import(gchar *path, gpointer user_data) FILE *f; gboolean ret; - if ((f = eth_fopen(path, "r")) == NULL) { + if ((f = ws_fopen(path, "r")) == NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not open\n%s\nfor reading: %s.", path, strerror(errno)); @@ -730,7 +730,7 @@ write_filters_file(GSList *cfl, FILE *f, gboolean only_selected) data.f = f; data.only_selected = only_selected; - + fprintf(f,"# DO NOT EDIT THIS FILE! It was created by Wireshark\n"); g_slist_foreach(cfl, write_filter, &data); return TRUE; @@ -755,7 +755,7 @@ color_filters_write(GSList *cfl) } path = get_persconffile_path("colorfilters", TRUE, TRUE); - if ((f = eth_fopen(path, "w+")) == NULL) { + if ((f = ws_fopen(path, "w+")) == NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not open\n%s\nfor writing: %s.", path, strerror(errno)); @@ -774,7 +774,7 @@ color_filters_export(gchar *path, GSList *cfl, gboolean only_marked) { FILE *f; - if ((f = eth_fopen(path, "w+")) == NULL) { + if ((f = ws_fopen(path, "w+")) == NULL) { simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Could not open\n%s\nfor writing: %s.", path, strerror(errno)); -- cgit v1.2.3