Define some fcns & vars as static;

Rename g_capture_in_progress to gbl_capture_in_progress (capture_if_dlg.c)
Do some whitespace cleanup.

svn path=/trunk/; revision=34490
This commit is contained in:
Bill Meier 2010-10-12 17:39:44 +00:00
parent 2d3abb5cec
commit 2b0f6a63f1
10 changed files with 950 additions and 945 deletions

View File

@ -252,7 +252,7 @@ update_all(gpointer data)
return TRUE;
}
gboolean g_capture_in_progress = FALSE;
static gboolean gbl_capture_in_progress = FALSE;
/* a live capture has started or stopped */
void
@ -261,7 +261,7 @@ set_capture_if_dialog_for_capture_in_progress(gboolean capture_in_progress)
GList *curr;
int ifs;
g_capture_in_progress = capture_in_progress;
gbl_capture_in_progress = capture_in_progress;
if(cap_if_w) {
gtk_widget_set_sensitive(stop_bt, capture_in_progress);
@ -887,7 +887,7 @@ capture_if_cb(GtkWidget *w _U_, gpointer d _U_)
gtk_widget_show_all(cap_if_w);
window_present(cap_if_w);
set_capture_if_dialog_for_capture_in_progress(g_capture_in_progress);
set_capture_if_dialog_for_capture_in_progress(gbl_capture_in_progress);
/* update the interface list every 1000ms */
timer_id = g_timeout_add(1000, update_all, sc);

View File

@ -61,7 +61,7 @@ typedef struct _diameterstat_t {
srt_stat_table diameter_srt_table;
} diameterstat_t;
GHashTable* cmd_str_hash;
static GHashTable* cmd_str_hash;
static void
diameterstat_set_title(diameterstat_t *diameter)

View File

@ -51,7 +51,7 @@
#define SMB_EO_CONTAINS_READSANDWRITES 0x03
#define LEGAL_FILENAME_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVXYZ1234567890_."
const value_string smb_eo_contains_string[]={
static const value_string smb_eo_contains_string[]={
{SMB_EO_CONTAINS_NOTHING, ""},
{SMB_EO_CONTAINS_READS, "R"},
{SMB_EO_CONTAINS_WRITES, "W"},
@ -86,7 +86,8 @@ static GSList *GSL_active_files;
static GTree *btree_visited_packet;
/* The comparison function for the btree_visited_packet */
gint btree_visited_packet_cmpkey(gconstpointer keya, gconstpointer keyb, gpointer user_data) {
static gint
btree_visited_packet_cmpkey(gconstpointer keya, gconstpointer keyb, gpointer user_data) {
gint nop_value;
guint32 *a = (guint32 *)keya;
guint32 *b = (guint32 *)keyb;
@ -117,7 +118,8 @@ typedef struct _free_chunk {
the last offset captured. In most cases, the real
file length would be different.
*/
void insert_chunk(active_file *file, export_object_entry_t *entry, const smb_eo_t *eo_info)
static void
insert_chunk(active_file *file, export_object_entry_t *entry, const smb_eo_t *eo_info)
{
guint nfreechunks = g_slist_length(file->free_chunk_list);
guint i;
@ -251,7 +253,8 @@ void insert_chunk(active_file *file, export_object_entry_t *entry, const smb_e
}
/* We use this function to obtain the index in the GSL of a given file */
int find_incoming_file(GSList *GSL_active_files,active_file *incoming_file)
static int
find_incoming_file(GSList *GSL_active_files,active_file *incoming_file)
{
int i,row,last;
active_file *in_list_file;

View File

@ -59,13 +59,13 @@ static GtkWidget *fs_w;
/* various widget related global data */
int row;
GtkWidget *fs_tb;
GtkWidget *fs_sw;
GtkTooltips *tooltips;
GtkWidget *fs_dir_lb;
GtkWidget *fs_first_rb;
GtkWidget *fs_tb_vb;
static int row;
static GtkWidget *fs_tb;
static GtkWidget *fs_sw;
static GtkTooltips *tooltips;
static GtkWidget *fs_dir_lb;
static GtkWidget *fs_first_rb;
static GtkWidget *fs_tb_vb;

View File

@ -145,7 +145,7 @@ typedef struct _fw_product_t {
gboolean does_inbound;
} fw_product;
fw_product products[] = {
static fw_product products[] = {
{ "Cisco IOS (standard)", "!", NULL, sf_ios_std_ipv4, NULL, NULL, FALSE },
{ "Cisco IOS (extended)", "!",
NULL, sf_ios_ext_ipv4, sf_ios_ext_port, sf_ios_ext_ipv4_port, TRUE },

View File

@ -55,7 +55,7 @@
#endif
PangoFontDescription *m_r_font, *m_b_font;
static PangoFontDescription *m_r_font, *m_b_font;
/* Get the regular user font.
@ -79,11 +79,11 @@ PangoFontDescription *user_font_get_bold(void)
static void
set_fonts(PangoFontDescription *regular, PangoFontDescription *bold)
{
/* Yes, assert. The code that loads the font should check
* for NULL and provide its own error message. */
g_assert(m_r_font && m_b_font);
m_r_font = regular;
m_b_font = bold;
/* Yes, assert. The code that loads the font should check
* for NULL and provide its own error message. */
g_assert(m_r_font && m_b_font);
m_r_font = regular;
m_b_font = bold;
}
void
@ -100,14 +100,14 @@ view_zoom_in_cb(GtkWidget *w _U_, gpointer d _U_)
case FA_FONT_NOT_RESIZEABLE:
/* "font_apply()" popped up an alert box. */
recent.gui_zoom_level = save_gui_zoom_level; /* undo zoom */
recent.gui_zoom_level = save_gui_zoom_level; /* undo zoom */
break;
case FA_FONT_NOT_AVAILABLE:
/* We assume this means that the specified size isn't available. */
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Your current font isn't available in the next larger size.\n");
recent.gui_zoom_level = save_gui_zoom_level; /* undo zoom */
recent.gui_zoom_level = save_gui_zoom_level; /* undo zoom */
break;
}
}
@ -126,14 +126,14 @@ view_zoom_out_cb(GtkWidget *w _U_, gpointer d _U_)
case FA_FONT_NOT_RESIZEABLE:
/* "font_apply()" popped up an alert box. */
recent.gui_zoom_level = save_gui_zoom_level; /* undo zoom */
recent.gui_zoom_level = save_gui_zoom_level; /* undo zoom */
break;
case FA_FONT_NOT_AVAILABLE:
/* We assume this means that the specified size isn't available. */
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Your current font isn't available in the next smaller size.\n");
recent.gui_zoom_level = save_gui_zoom_level; /* undo zoom */
recent.gui_zoom_level = save_gui_zoom_level; /* undo zoom */
break;
}
}
@ -152,7 +152,7 @@ view_zoom_100_cb(GtkWidget *w _U_, gpointer d _U_)
case FA_FONT_NOT_RESIZEABLE:
/* "font_apply()" popped up an alert box. */
recent.gui_zoom_level = save_gui_zoom_level; /* undo zoom */
recent.gui_zoom_level = save_gui_zoom_level; /* undo zoom */
break;
case FA_FONT_NOT_AVAILABLE:
@ -160,7 +160,7 @@ view_zoom_100_cb(GtkWidget *w _U_, gpointer d _U_)
XXX - this "shouldn't happen". */
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Your current font couldn't be reloaded at the size you selected.\n");
recent.gui_zoom_level = save_gui_zoom_level; /* undo zoom */
recent.gui_zoom_level = save_gui_zoom_level; /* undo zoom */
break;
}
}
@ -170,33 +170,33 @@ view_zoom_100_cb(GtkWidget *w _U_, gpointer d _U_)
gboolean
user_font_test(gchar *font_name)
{
PangoFontDescription *new_r_font, *new_b_font;
PangoFontDescription *new_r_font, *new_b_font;
new_r_font = pango_font_description_from_string(font_name);
if (new_r_font == NULL) {
/* Oops, that font didn't work.
Tell the user, but don't tear down the font selection
dialog, so that they can try again. */
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"The font you selected can't be loaded.");
new_r_font = pango_font_description_from_string(font_name);
if (new_r_font == NULL) {
/* Oops, that font didn't work.
Tell the user, but don't tear down the font selection
dialog, so that they can try again. */
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"The font you selected can't be loaded.");
return FALSE;
}
return FALSE;
}
new_b_font = pango_font_description_copy(new_r_font);
pango_font_description_set_weight(new_b_font, PANGO_WEIGHT_BOLD);
if (new_b_font == NULL) {
/* Oops, that font didn't work.
Tell the user, but don't tear down the font selection
dialog, so that they can try again. */
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"The font you selected doesn't have a boldface version.");
new_b_font = pango_font_description_copy(new_r_font);
pango_font_description_set_weight(new_b_font, PANGO_WEIGHT_BOLD);
if (new_b_font == NULL) {
/* Oops, that font didn't work.
Tell the user, but don't tear down the font selection
dialog, so that they can try again. */
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"The font you selected doesn't have a boldface version.");
pango_font_description_free(new_r_font);
return FALSE;
}
pango_font_description_free(new_r_font);
return FALSE;
}
return TRUE;
return TRUE;
}
@ -246,11 +246,11 @@ user_font_apply(void) {
/* convert font name to reflect the zoom level */
gui_font_name = font_zoom(prefs.gui_font_name);
if (gui_font_name == NULL) {
/*
* This means the font name isn't an XLFD font name.
* We just report that for now as a font not available in
* multiple sizes.
*/
/*
* This means the font name isn't an XLFD font name.
* We just report that for now as a font not available in
* multiple sizes.
*/
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK,
"Your current font isn't available in any other sizes.\n");
return FA_FONT_NOT_RESIZEABLE;
@ -319,26 +319,26 @@ set_app_font_gtk2(const char *fontname)
settings = gtk_settings_get_default();
if (fontname == NULL) {
g_object_set(G_OBJECT(settings), "gtk-font-name", appfontname, NULL);
g_object_set(G_OBJECT(settings), "gtk-font-name", appfontname, NULL);
} else {
GtkWidget *w;
PangoFontDescription *pfd;
PangoContext *pc;
PangoFont *pfont;
GtkWidget *w;
PangoFontDescription *pfd;
PangoContext *pc;
PangoFont *pfont;
w = gtk_label_new(NULL);
pfd = pango_font_description_from_string(fontname);
pc = gtk_widget_get_pango_context(w);
pfont = pango_context_load_font(pc, pfd);
w = gtk_label_new(NULL);
pfd = pango_font_description_from_string(fontname);
pc = gtk_widget_get_pango_context(w);
pfont = pango_context_load_font(pc, pfd);
if (pfont != NULL) {
g_strlcpy(appfontname, fontname, 128);
appfontname[127] = '\0';
g_object_set(G_OBJECT(settings), "gtk-font-name", appfontname, NULL);
}
if (pfont != NULL) {
g_strlcpy(appfontname, fontname, 128);
appfontname[127] = '\0';
g_object_set(G_OBJECT(settings), "gtk-font-name", appfontname, NULL);
}
gtk_widget_destroy(w);
pango_font_description_free(pfd);
gtk_widget_destroy(w);
pango_font_description_free(pfd);
}
}
@ -351,14 +351,14 @@ static char *default_windows_menu_fontspec_gtk2(void)
ncm.cbSize = sizeof ncm;
if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, &ncm, 0)) {
HDC screen = GetDC(0);
double y_scale = 72.0 / GetDeviceCaps(screen, LOGPIXELSY);
int point_size = (int) (ncm.lfMenuFont.lfHeight * y_scale);
HDC screen = GetDC(0);
double y_scale = 72.0 / GetDeviceCaps(screen, LOGPIXELSY);
int point_size = (int) (ncm.lfMenuFont.lfHeight * y_scale);
if (point_size < 0) point_size = -point_size;
fontspec = g_strdup_printf("%s %d", ncm.lfMenuFont.lfFaceName,
point_size);
ReleaseDC(0, screen);
if (point_size < 0) point_size = -point_size;
fontspec = g_strdup_printf("%s %d", ncm.lfMenuFont.lfFaceName,
point_size);
ReleaseDC(0, screen);
}
return fontspec;
@ -371,25 +371,25 @@ static void try_to_get_windows_font_gtk2(void)
fontspec = default_windows_menu_fontspec_gtk2();
if (fontspec != NULL) {
int match = 0;
PangoFontDescription *pfd;
PangoFont *pfont;
PangoContext *pc;
GtkWidget *w;
int match = 0;
PangoFontDescription *pfd;
PangoFont *pfont;
PangoContext *pc;
GtkWidget *w;
pfd = pango_font_description_from_string(fontspec);
pfd = pango_font_description_from_string(fontspec);
w = gtk_label_new(NULL);
pc = gtk_widget_get_pango_context(w);
pfont = pango_context_load_font(pc, pfd);
match = (pfont != NULL);
w = gtk_label_new(NULL);
pc = gtk_widget_get_pango_context(w);
pfont = pango_context_load_font(pc, pfd);
match = (pfont != NULL);
pango_font_description_free(pfd);
g_object_unref(G_OBJECT(pc));
gtk_widget_destroy(w);
pango_font_description_free(pfd);
g_object_unref(G_OBJECT(pc));
gtk_widget_destroy(w);
if (match) set_app_font_gtk2(fontspec);
g_free(fontspec);
if (match) set_app_font_gtk2(fontspec);
g_free(fontspec);
}
}
#endif /* _WIN32 */
@ -398,42 +398,42 @@ static void try_to_get_windows_font_gtk2(void)
void font_init(void)
{
#ifdef _WIN32
/* try to load the application font for GTK2 */
try_to_get_windows_font_gtk2();
/* try to load the application font for GTK2 */
try_to_get_windows_font_gtk2();
#endif
/* Try to load the regular and boldface fixed-width fonts */
m_r_font = pango_font_description_from_string(prefs.gui_font_name);
m_b_font = pango_font_description_copy(m_r_font);
pango_font_description_set_weight(m_b_font, PANGO_WEIGHT_BOLD);
if (m_r_font == NULL || m_b_font == NULL) {
/* XXX - pop this up as a dialog box? no */
if (m_r_font == NULL) {
fprintf(stderr, "wireshark: Warning: font %s not found - defaulting to Monospace 9\n",
prefs.gui_font_name);
} else {
pango_font_description_free(m_r_font);
}
if (m_b_font == NULL) {
fprintf(stderr, "wireshark: Warning: bold font %s not found - defaulting"
" to Monospace 9\n", prefs.gui_font_name);
} else {
pango_font_description_free(m_b_font);
}
if ((m_r_font = pango_font_description_from_string("Monospace 9")) == NULL)
{
fprintf(stderr, "wireshark: Error: font Monospace 9 not found\n");
exit(1);
}
if ((m_b_font = pango_font_description_copy(m_r_font)) == NULL) {
fprintf(stderr, "wireshark: Error: font Monospace 9 bold not found\n");
exit(1);
}
g_free(prefs.gui_font_name);
/* Try to load the regular and boldface fixed-width fonts */
m_r_font = pango_font_description_from_string(prefs.gui_font_name);
m_b_font = pango_font_description_copy(m_r_font);
pango_font_description_set_weight(m_b_font, PANGO_WEIGHT_BOLD);
prefs.gui_font_name = g_strdup("Monospace 9");
}
if (m_r_font == NULL || m_b_font == NULL) {
/* XXX - pop this up as a dialog box? no */
if (m_r_font == NULL) {
fprintf(stderr, "wireshark: Warning: font %s not found - defaulting to Monospace 9\n",
prefs.gui_font_name);
} else {
pango_font_description_free(m_r_font);
}
if (m_b_font == NULL) {
fprintf(stderr, "wireshark: Warning: bold font %s not found - defaulting"
" to Monospace 9\n", prefs.gui_font_name);
} else {
pango_font_description_free(m_b_font);
}
if ((m_r_font = pango_font_description_from_string("Monospace 9")) == NULL)
{
fprintf(stderr, "wireshark: Error: font Monospace 9 not found\n");
exit(1);
}
if ((m_b_font = pango_font_description_copy(m_r_font)) == NULL) {
fprintf(stderr, "wireshark: Error: font Monospace 9 bold not found\n");
exit(1);
}
g_free(prefs.gui_font_name);
pango_font_description_set_weight(m_b_font, PANGO_WEIGHT_BOLD);
prefs.gui_font_name = g_strdup("Monospace 9");
}
/* Call this for the side-effects that set_fonts() produces */
set_fonts(m_r_font, m_b_font);
/* Call this for the side-effects that set_fonts() produces */
set_fonts(m_r_font, m_b_font);
}

View File

@ -383,7 +383,7 @@ window_set_geometry(GtkWidget *widget, window_geometry_t *geom)
/* the geometry hashtable for all known window classes,
* the window name is the key, and the geometry struct is the value */
GHashTable *window_geom_hash = NULL;
static GHashTable *window_geom_hash = NULL;
/* save the window and it's current geometry into the geometry hashtable */

View File

@ -215,9 +215,10 @@ int airpcap_dll_ret_val = -1;
#endif
GString *comp_info_str, *runtime_info_str;
gboolean have_capture_file = FALSE; /* XXX - is there an equivalent in cfile? */
guint tap_update_timer_id;
static gboolean have_capture_file = FALSE; /* XXX - is there an equivalent in cfile? */
static guint tap_update_timer_id;
#ifdef _WIN32
static gboolean has_console; /* TRUE if app has console */
@ -1421,7 +1422,7 @@ resolv_update_cb(gpointer data _U_)
/* Set main_window_name and it's icon title to the capture filename */
void
static void
set_display_filename(capture_file *cf)
{
gchar *window_name;
@ -1435,7 +1436,7 @@ set_display_filename(capture_file *cf)
}
}
GtkWidget *close_dlg = NULL;
static GtkWidget *close_dlg = NULL;
static void
priv_warning_dialog_cb(gpointer dialog, gint btn _U_, gpointer data _U_)

File diff suppressed because it is too large Load Diff

View File

@ -37,9 +37,9 @@
#include "gtk/packet_history.h"
GList *history_current = NULL;
GList *history_list = NULL;
gboolean ignore_jump = FALSE;
static GList *history_current = NULL;
static GList *history_list = NULL;
static gboolean ignore_jump = FALSE;
#if 0
@ -123,7 +123,7 @@ void packet_history_add(gint row) {
void packet_history_clear(void) {
/* clear "old" list */
clear_list(history_list);
history_current = NULL;