aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-01-01 23:19:11 +0000
committerGuy Harris <guy@alum.mit.edu>2005-01-01 23:19:11 +0000
commit0067b4b94e59cf3c72bc5283ba0302e651f81b87 (patch)
tree3d52dc19ce96ea34d1d7d021e926ab2e865018ba /gtk
parenta46d94072bba5953cc76f324fde3d72b78df8140 (diff)
The right way to check whether a pointer is null and get a Boolean is to
test it against null, not to cast it to a Boolean type - as Boolean types in C89/C90, at least, are just integral types, that cast might just throw away the upper 32 bits; that probably yields the results you want, but the compiler might well justifiably warn about that on an LP64 platform. svn path=/trunk/; revision=12915
Diffstat (limited to 'gtk')
-rw-r--r--gtk/file_dlg.c10
-rw-r--r--gtk/packet_history.c4
-rw-r--r--gtk/summary_dlg.c8
3 files changed, 11 insertions, 11 deletions
diff --git a/gtk/file_dlg.c b/gtk/file_dlg.c
index c43e398091..7107393dba 100644
--- a/gtk/file_dlg.c
+++ b/gtk/file_dlg.c
@@ -157,7 +157,7 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name)
gtk_label_set_text(GTK_LABEL(label), "-");
if(!cf_name) {
- return FALSE;
+ return NULL;
}
label = OBJECT_GET_DATA(prev, PREVIEW_FILENAME_KEY);
@@ -166,7 +166,7 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name)
if (test_for_directory(cf_name) == EISDIR) {
label = OBJECT_GET_DATA(prev, PREVIEW_FORMAT_KEY);
gtk_label_set_text(GTK_LABEL(label), "directory");
- return FALSE;
+ return NULL;
}
wth = wtap_open_offline(cf_name, &err, &err_info, TRUE);
@@ -177,13 +177,13 @@ preview_set_filename(GtkWidget *prev, const gchar *cf_name)
} else {
gtk_label_set_text(GTK_LABEL(label), "error opening file");
}
- return FALSE;
+ return NULL;
}
/* Find the size of the file. */
if (fstat(wtap_fd(wth), &cf_stat) < 0) {
wtap_close(wth);
- return FALSE;
+ return NULL;
}
/* size */
@@ -339,7 +339,7 @@ file_open_entry_changed(GtkWidget *w _U_, gpointer file_sel)
/* set the filename to the preview */
wth = preview_set_filename(prev, cf_name);
- have_preview = (gboolean) wth;
+ have_preview = (wth != NULL);
/* make the preview widget sensitive */
gtk_widget_set_sensitive(prev, have_preview);
diff --git a/gtk/packet_history.c b/gtk/packet_history.c
index 917e4a3384..421a63a79c 100644
--- a/gtk/packet_history.c
+++ b/gtk/packet_history.c
@@ -66,8 +66,8 @@ static void adjust_menus(void) {
if(history_current) {
set_menus_for_packet_history(
- (gboolean) g_list_previous(history_current),
- (gboolean) g_list_next(history_current));
+ (g_list_previous(history_current) != NULL),
+ (g_list_next(history_current) != NULL));
} else {
/* we don't have any history */
set_menus_for_packet_history(FALSE, FALSE);
diff --git a/gtk/summary_dlg.c b/gtk/summary_dlg.c
index 71dcd55cbb..2909def87b 100644
--- a/gtk/summary_dlg.c
+++ b/gtk/summary_dlg.c
@@ -192,7 +192,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
/* Capture */
add_string_to_table(table, &row, "", "");
- add_string_to_table_sensitive(table, &row, "Capture", "", (gboolean) summary.iface);
+ add_string_to_table_sensitive(table, &row, "Capture", "", (summary.iface != NULL));
/* interface */
if (summary.iface) {
@@ -200,7 +200,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
} else {
g_snprintf(string_buff, SUM_STR_MAX, "unknown");
}
- add_string_to_table_sensitive(table, &row, "Interface:", string_buff, (gboolean) summary.iface);
+ add_string_to_table_sensitive(table, &row, "Interface:", string_buff, (summary.iface) != NULL);
/* Dropped count */
if (summary.drops_known) {
@@ -208,7 +208,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
} else {
g_snprintf(string_buff, SUM_STR_MAX, "unknown");
}
- add_string_to_table_sensitive(table, &row, "Dropped packets:", string_buff, (gboolean) summary.iface);
+ add_string_to_table_sensitive(table, &row, "Dropped packets:", string_buff, (summary.iface != NULL));
#ifdef HAVE_LIBPCAP
/* Capture filter */
@@ -221,7 +221,7 @@ summary_open_cb(GtkWidget *w _U_, gpointer d _U_)
g_snprintf(string_buff, SUM_STR_MAX, "unknown");
}
}
- add_string_to_table_sensitive(table, &row, "Capture filter:", string_buff, (gboolean) summary.iface);
+ add_string_to_table_sensitive(table, &row, "Capture filter:", string_buff, (summary.iface != NULL));
#endif