Move "ts_type_text" out of "epan/timestamp.h into "gtk/recent.c", as

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
This commit is contained in:
Guy Harris 2004-01-19 23:03:20 +00:00
parent 439159f73d
commit d4ab584f0f
4 changed files with 20 additions and 23 deletions

View 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;
/*
* 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;
static char *ts_type_text[] =
{ "RELATIVE", "ABSOLUTE", "ABSOLUTE_WITH_DATE", "DELTA", NULL };
#endif /* timestamp.h */

View 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;

View 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;
}

View 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>
@ -45,11 +45,10 @@
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. */