Add another DL CRC error - Duplicate NonZero RV.
[obnox/wireshark/wip.git] / color_filters.c
index dd3b7e5d2f91fd4b0397c9529203bb3f62a845bc..2a8a0cbdd2682c0a9b2ed3bced981fcb6337d4d6 100644 (file)
@@ -88,50 +88,50 @@ color_filter_new(const gchar *name,    /* The name of the filter to create */
        colorf->c_colorfilter = NULL;
        colorf->edit_dialog = NULL;
        colorf->selected = FALSE;
-        return colorf;
+    return colorf;
 }
 
 /* Add ten empty (temporary) colorfilters for easy coloring */
 static void
 color_filters_add_tmp(GSList **cfl)
 {
-       gchar  *name = NULL;
-       guint32 i;
-        gchar** bg_colors;
-        gchar** fg_colors;
-        unsigned long int cval;
-        color_t bg_color, fg_color;
-        color_filter_t *colorf;
+    gchar  *name = NULL;
+    guint32 i;
+    gchar** bg_colors;
+    gchar** fg_colors;
+    unsigned long int cval;
+    color_t bg_color, fg_color;
+    color_filter_t *colorf;
 
-       g_assert(strlen(prefs.gui_colorized_fg)==69);
-       g_assert(strlen(prefs.gui_colorized_bg)==69);
-        fg_colors = g_strsplit(prefs.gui_colorized_fg, ",", -1);
-        bg_colors = g_strsplit(prefs.gui_colorized_bg, ",", -1);
+    g_assert(strlen(prefs.gui_colorized_fg)==69);
+    g_assert(strlen(prefs.gui_colorized_bg)==69);
+    fg_colors = g_strsplit(prefs.gui_colorized_fg, ",", -1);
+    bg_colors = g_strsplit(prefs.gui_colorized_bg, ",", -1);
 
         for ( i=1 ; i<=10 ; i++ ) {
-                name = g_strdup_printf("%s%02d",TEMP_COLOR_PREFIX,i);
+            name = g_strdup_printf("%s%02d",CONVERSATION_COLOR_PREFIX,i);
 
-               /* retrieve background and foreground colors */
-                cval = strtoul(fg_colors[i-1], NULL, 16);
-                initialize_color(&fg_color, RED_COMPONENT(cval),
-                                            GREEN_COMPONENT(cval),
-                                            BLUE_COMPONENT(cval) );
-                cval = strtoul(bg_colors[i-1], NULL, 16);
-                initialize_color(&bg_color, RED_COMPONENT(cval),
-                                            GREEN_COMPONENT(cval),
-                                            BLUE_COMPONENT(cval) );
-                colorf = color_filter_new(name, NULL, &bg_color, &fg_color, TRUE);
-                colorf->filter_text = g_strdup("frame");
-                colorf->c_colorfilter = NULL;
-                *cfl = g_slist_append(*cfl, colorf);
+            /* retrieve background and foreground colors */
+            cval = strtoul(fg_colors[i-1], NULL, 16);
+            initialize_color(&fg_color, RED_COMPONENT(cval),
+                                        GREEN_COMPONENT(cval),
+                                        BLUE_COMPONENT(cval) );
+            cval = strtoul(bg_colors[i-1], NULL, 16);
+            initialize_color(&bg_color, RED_COMPONENT(cval),
+                                        GREEN_COMPONENT(cval),
+                                        BLUE_COMPONENT(cval) );
+            colorf = color_filter_new(name, NULL, &bg_color, &fg_color, TRUE);
+            colorf->filter_text = g_strdup("frame");
+            colorf->c_colorfilter = NULL;
+            *cfl = g_slist_append(*cfl, colorf);
 
-                g_free(name);
-       }
+            g_free(name);
+    }
 
-        g_strfreev(fg_colors);
-        g_strfreev(bg_colors);
+    g_strfreev(fg_colors);
+    g_strfreev(bg_colors);
 
-       return;
+    return;
 }
 
 static gint
@@ -165,8 +165,8 @@ color_filters_set_tmp(guint8 filt_nr, gchar *filter, gboolean disabled)
                 if( i!=filt_nr && filter==NULL )
                         continue;
 
-                name = g_strdup_printf("%s%02d",TEMP_COLOR_PREFIX,i);
-                cfl = g_slist_find_custom(color_filter_list, (gpointer *) name, color_filters_find_by_name_cb);
+                name = g_strdup_printf("%s%02d",CONVERSATION_COLOR_PREFIX,i);
+                cfl = g_slist_find_custom(color_filter_list, name, color_filters_find_by_name_cb);
                 colorf = (color_filter_t *)cfl->data;
 
                 /* Only change the filter rule if this is the rule to change or if
@@ -201,7 +201,7 @@ color_filters_set_tmp(guint8 filt_nr, gchar *filter, gboolean disabled)
 
 /* Reset the temporary colorfilters */
 void
-color_filters_reset_tmp()
+color_filters_reset_tmp(void)
 {
        guint8 i;
 
@@ -260,7 +260,7 @@ color_filter_clone(color_filter_t *colorf)
        new_colorf->edit_dialog = NULL;
        new_colorf->selected = FALSE;
 
-        return new_colorf;
+    return new_colorf;
 }
 
 static void
@@ -303,13 +303,13 @@ color_filters_init(void)
 void
 color_filters_reload(void)
 {
-        /* "move" old entries to the deleted list
-         * we must keep them until the dissection no longer needs them */
-        color_filter_deleted_list = g_slist_concat(color_filter_deleted_list, color_filter_list);
-        color_filter_list = NULL;
+    /* "move" old entries to the deleted list
+     * we must keep them until the dissection no longer needs them */
+    color_filter_deleted_list = g_slist_concat(color_filter_deleted_list, color_filter_list);
+    color_filter_list = NULL;
 
-        /* start the list with the temporary colorizing rules */
-        color_filters_add_tmp(&color_filter_list);
+    /* start the list with the temporary colorizing rules */
+    color_filters_add_tmp(&color_filter_list);
 
        /* try to read the users filters */
        if (!read_users_filters(&color_filter_list))
@@ -320,15 +320,15 @@ color_filters_reload(void)
 void
 color_filters_cleanup(void)
 {
-        /* delete the previously deleted filters */
-        color_filter_list_delete(&color_filter_deleted_list);
+    /* delete the previously deleted filters */
+    color_filter_list_delete(&color_filter_deleted_list);
 }
 
 static void
 color_filters_clone_cb(gpointer filter_arg, gpointer user_data)
 {
        color_filter_t * new_colorf = color_filter_clone((color_filter_t *)filter_arg);
-        color_filter_add_cb (new_colorf, user_data);
+    color_filter_add_cb (new_colorf, user_data);
 }
 
 void
@@ -571,9 +571,8 @@ read_filters_file(FILE *f, gpointer user_data)
                        dfilter_t *temp_dfilter;
 
                        if (!dfilter_compile(filter_exp, &temp_dfilter)) {
-                               simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
-                               "Could not compile color filter %s from saved filters.\n%s",
-                                             name, dfilter_error_msg);
+                               g_warning("Could not compile color filter \"%s\" from saved filters: %s",
+                                       name, dfilter_error_msg);
                                skip_end_of_line = TRUE;
                                continue;
                        }
@@ -635,7 +634,7 @@ read_users_filters(GSList **cfl)
                if (errno != ENOENT) {
                        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                            "Could not open filter file\n\"%s\": %s.", path,
-                           strerror(errno));
+                           g_strerror(errno));
                }
                g_free(path);
                return FALSE;
@@ -662,7 +661,7 @@ color_filters_read_globals(gpointer user_data)
                if (errno != ENOENT) {
                        simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                            "Could not open global filter file\n\"%s\": %s.", path,
-                           strerror(errno));
+                           g_strerror(errno));
                }
                g_free(path);
                return FALSE;
@@ -685,7 +684,7 @@ color_filters_import(gchar *path, gpointer user_data)
        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));
+                   path, g_strerror(errno));
                return FALSE;
        }
 
@@ -709,7 +708,7 @@ write_filter(gpointer filter_arg, gpointer data_arg)
        FILE *f = data->f;
 
        if ( (colorf->selected || !data->only_selected) &&
-             (strstr(colorf->filter_name,TEMP_COLOR_PREFIX)==NULL) ) {
+             (strstr(colorf->filter_name,CONVERSATION_COLOR_PREFIX)==NULL) ) {
                fprintf(f,"%s@%s@%s@[%d,%d,%d][%d,%d,%d]\n",
                    colorf->disabled ? "!" : "",
                    colorf->filter_name,
@@ -750,7 +749,7 @@ color_filters_write(GSList *cfl)
        if (create_persconffile_dir(&pf_dir_path) == -1) {
                simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
                    "Can't create directory\n\"%s\"\nfor color files: %s.",
-                   pf_dir_path, strerror(errno));
+                   pf_dir_path, g_strerror(errno));
                g_free(pf_dir_path);
                return FALSE;
        }
@@ -759,7 +758,7 @@ color_filters_write(GSList *cfl)
        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));
+                   path, g_strerror(errno));
                g_free(path);
                return FALSE;
        }
@@ -778,7 +777,7 @@ color_filters_export(gchar *path, GSList *cfl, gboolean only_marked)
        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));
+                   path, g_strerror(errno));
                return FALSE;
        }
        write_filters_file(cfl, f, only_marked);