Move "ts_type_text" out of "epan/timestamp.h into "gtk/recent.c", as
authorGuy Harris <guy@alum.mit.edu>
Mon, 19 Jan 2004 23:03:20 +0000 (23:03 -0000)
committerGuy Harris <guy@alum.mit.edu>
Mon, 19 Jan 2004 23:03:20 +0000 (23:03 -0000)
it's only used in the latter; that avoids lots of warnings about
"ts_type_text" being defined but not used in other source files that
include "epan/timestamp.h".  (If it's going to be used in more than one
file, make it non-static and declare it "extern" in "epan/timestamp.h".)

Define TS_NOT_SET as ((ts_type)-1), and use that when initializing
"timestamp_type" in Ethereal and when checking to see whether
"timestamp_type" was set, to avoid signed vs. unsigned comparison
warnings.

Clean up indentation.

svn path=/trunk/; revision=9740

epan/timestamp.h
gtk/main.c
gtk/menu.c
gtk/recent.c

index 291b71feb25ac973f9cd5aafe66d191f562a021c..38f28ac507c5dd390500e80d5e49bec1f72dc1a1 100644 (file)
@@ -1,13 +1,12 @@
 /* timestamp.h
  * Defines for packet timestamps
  *
- * $Id: timestamp.h,v 1.3 2004/01/19 03:46:42 ulfl Exp $
+ * $Id: timestamp.h,v 1.4 2004/01/19 23:03:19 guy Exp $
  *
  * Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
  * Copyright 1998 Gerald Combs
  *
- *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
  * as published by the Free Software Foundation; either version 2
@@ -26,7 +25,6 @@
 #ifndef __TIMESTAMP_H__
 #define __TIMESTAMP_H__
 
-
 /*
  * Type of time-stamp shown in the summary display.
  */
@@ -37,10 +35,12 @@ typedef enum {
        TS_DELTA
 } ts_type;
 
-extern ts_type timestamp_type;
-
-static char *ts_type_text[] =
-       { "RELATIVE", "ABSOLUTE", "ABSOLUTE_WITH_DATE", "DELTA", NULL };
+/*
+ * Special value used for the command-line setting in Ethereal, to indicate
+ * that no value has been set from the command line.
+ */
+#define TS_NOT_SET     ((ts_type)-1)
 
+extern ts_type timestamp_type;
 
 #endif /* timestamp.h */
index 3002de71494386fb8c40c8f0cb6ba09e3d491564..5fb9beb42d0c10151f3f3318366f40410ee96809 100644 (file)
@@ -1,6 +1,6 @@
 /* main.c
  *
- * $Id: main.c,v 1.360 2004/01/19 18:21:18 jmayer Exp $
+ * $Id: main.c,v 1.361 2004/01/19 23:03:20 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -157,7 +157,7 @@ static gboolean updated_geometry = FALSE;
 
 /* init with an invalid value, so that "recent" can detect this and */
 /* distinguish it from a command line value */
-ts_type timestamp_type = -1;
+ts_type timestamp_type = TS_NOT_SET;
 
 #if GTK_MAJOR_VERSION < 2
 GtkStyle *item_style;
index 7a44d49e8b4b607411afde8de1cf05a73118b3f1..204d36d54b288d67f4c36bdd24246f40362c9019 100644 (file)
@@ -1,7 +1,7 @@
 /* menu.c
  * Menu routines
  *
- * $Id: menu.c,v 1.138 2004/01/19 03:46:42 ulfl Exp $
+ * $Id: menu.c,v 1.139 2004/01/19 23:03:20 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -1014,18 +1014,18 @@ timestamp_delta_cb(GtkWidget *w _U_, gpointer d _U_)
 /* the recent file read has finished, update the menu corresponding */
 void
 menu_recent_read_finished(void) {
-       GtkWidget *menu = NULL;
+    GtkWidget *menu = NULL;
 
-       menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Main Toolbar");
+    menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Main Toolbar");
     gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.main_toolbar_show);
 
-       menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Filter Toolbar");
+    menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Filter Toolbar");
     gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.filter_toolbar_show);
 
-       menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Packet List");
+    menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Packet List");
     gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.packet_list_show);
 
-       menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Packet Dissection");
+    menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Packet Dissection");
     gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menu), recent.tree_view_show);
 
     menu = gtk_item_factory_get_widget(main_menu_factory, "/View/Show/Packet Data");
@@ -1037,7 +1037,7 @@ menu_recent_read_finished(void) {
     main_widgets_rearrange();
 
     /* don't change the time format, if we had a command line value */
-    if (timestamp_type != -1) {
+    if (timestamp_type != TS_NOT_SET) {
         recent.gui_time_format = timestamp_type;
     }
 
index 26830c8ed4b154faf97aafa45feae76891bd4208..871aed1ed8aaed55397bcdeb66af7f61563bb889 100644 (file)
@@ -2,7 +2,7 @@
  * Recent "preference" handling routines
  * Copyright 2004, Ulf Lamping <ulf.lamping@web.de>
  *
- * $Id: recent.c,v 1.3 2004/01/19 03:46:43 ulfl Exp $
+ * $Id: recent.c,v 1.4 2004/01/19 23:03:20 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
 extern void add_menu_recent_capture_file(gchar *file);
 extern void menu_recent_read_finished(void);
 
-
 recent_settings_t recent;
 
-
-
+static char *ts_type_text[] =
+       { "RELATIVE", "ABSOLUTE", "ABSOLUTE_WITH_DATE", "DELTA", NULL };
 
 /* Takes an string and a pointer to an array of strings, and a default int value.
  * The array must be terminated by a NULL string. If the string is found in the array
@@ -70,8 +69,6 @@ find_index_from_string_array(char *needle, char **haystack, int default_value)
        return default_value;
 }
 
-
-
 /* Write out "recent" to the user's recent file, and return 0.
    If we got an error, stuff a pointer to the path of the recent file
    into "*pf_path_return", and return the errno. */