gcc 4 doesn't like my macro for getting the interface description: it says there...
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 22 Aug 2007 18:56:20 +0000 (18:56 +0000)
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 22 Aug 2007 18:56:20 +0000 (18:56 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@22588 f5534014-38df-0310-8fa8-9805f1628bb7

capture_opts.h
capture_ui_utils.c
capture_ui_utils.h
gtk/main.c
summary.c

index fc0c92a16c2fd04722c41f33aa63f90c88b16c27..2f96886d908e3f0f13c2025544a1eb9586fb2d03 100644 (file)
@@ -53,7 +53,8 @@ typedef struct capture_options_tag {
                                      *< set this field because doing so
                                      *< requires too many dependencies.
                                      *< Readers of this field should use
-                                     *< GET_IFACE_DESCR to access it. */
+                                     *< get_iface_description() from
+                                     *< "capture_ui_utils.h" to access it. */
 
 #ifdef _WIN32
     int      buffer_size;           /**< the capture buffer size (MB) */
@@ -105,15 +106,6 @@ typedef struct capture_options_tag {
     gboolean output_to_pipe;        /**< save_file is a pipe (named or stdout) */
 } capture_options;
 
-/*  Get iface_descr (and set it if it's not set already).
- *  It is assumed the caller includes capture_ui_utils.h (ugh, but what else
- *  can we do?)
- */
-#define GET_IFACE_DESCR(capture_opts) capture_opts->iface_descr ? \
-                                     capture_opts->iface_descr : \
-                                     capture_opts->iface_descr = get_interface_descriptive_name(capture_opts->iface)
-
-
 /* initialize the capture_options with some reasonable values */
 extern void
 capture_opts_init(capture_options *capture_opts, void *cfile);
index 33a4b9c1fedd0d80738ac4ea76579ef9759104f2..04d806b0bd03c8af46f92848aa6f5980bd479b06 100644 (file)
@@ -346,4 +346,17 @@ get_if_name(const char *if_text)
   return if_name;
 }
 
+/*  Return capture_opts->iface_descr (after setting it if it is not set)
+ *  This is necessary because capture_opts.c can't set iface_descr (at least
+ *  not without adding significant dependencies there).
+ */
+const char *
+get_iface_description(capture_options *capture_opts)
+{
+       if (!capture_opts->iface_descr)
+               capture_opts->iface_descr = get_interface_descriptive_name(capture_opts->iface);
+
+       return(capture_opts->iface_descr);
+
+}
 #endif /* HAVE_LIBPCAP */
index 637c6ccc28f25bb46bc63d7687a900a26541c36a..8370b31d4a996591b4a9732b59033acd84d8dabe 100644 (file)
@@ -25,6 +25,8 @@
 #ifndef __CAPTURE_UI_UTILS_H__
 #define __CAPTURE_UI_UTILS_H__
 
+#include "capture_opts.h"
+
 /** @file
  *  GList of available capture interfaces.
  */
@@ -74,6 +76,14 @@ const char *get_if_name(const char *if_text);
  *
  * @return The descriptive name (must be g_free'd later)
  */
-char * build_capture_combo_name(GList *if_list, gchar *if_name);
+char *build_capture_combo_name(GList *if_list, gchar *if_name);
+
+/** Return the interface description (after setting it if not already set)
+ *
+ * @param capture_opts The capture_options structure that contains the used interface
+ *
+ * @return A pointer to capture_ops->iface_descr
+ */
+const char *get_iface_description(capture_options *capture_opts);
 
 #endif
index 61d3755b9a5a496ba914d40c3f80c99d9a78102b..2abe89975c7195810fde720640411d049049e246 100644 (file)
 #include "../epan/emem.h"
 #include "file_util.h"
 #if GTK_MAJOR_VERSION >= 2
+#ifdef HAVE_LIBPCAP
 #include "../image/wsicon16.xpm"
 #include "../image/wsicon32.xpm"
 #include "../image/wsicon48.xpm"
 #include "../image/wsiconcap32.xpm"
 #include "../image/wsiconcap48.xpm"
 #endif
+#endif
 #ifdef SHOW_WELCOME_PAGE
 #include "../image/wssplash.xpm"
 #endif
@@ -1608,7 +1610,7 @@ main_cf_cb_live_capture_prepared(capture_options *capture_opts)
 
     if(capture_opts->iface) {
         title = g_strdup_printf("%s: Capturing - Wireshark",
-                               GET_IFACE_DESCR(capture_opts));
+                               get_iface_description(capture_opts));
     } else {
         title = g_strdup_printf("Capturing - Wireshark");
     }
@@ -1643,7 +1645,7 @@ main_cf_cb_live_capture_update_started(capture_options *capture_opts)
        switching to the next multiple file. */
     if(capture_opts->iface) {
         title = g_strdup_printf("%s: Capturing - Wireshark",
-                               GET_IFACE_DESCR(capture_opts));
+                               get_iface_description(capture_opts));
     } else {
         title = g_strdup_printf("Capturing - Wireshark");
     }
@@ -1660,7 +1662,7 @@ main_cf_cb_live_capture_update_started(capture_options *capture_opts)
 
     if(capture_opts->iface) {
         capture_msg = g_strdup_printf(" %s: <live capture in progress> to file: %s",
-                                     GET_IFACE_DESCR(capture_opts),
+                                     get_iface_description(capture_opts),
                                      (capture_opts->save_file) ? capture_opts->save_file : "");
     } else {
         capture_msg = g_strdup_printf(" <live capture in progress> to file: %s",
@@ -1687,7 +1689,7 @@ main_cf_cb_live_capture_update_continue(capture_file *cf)
     /* XXX - don't show the highest expert level unless the TCP checksum offloading is "solved" */
     if (cf->f_datalen/1024/1024 > 10) {
         capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld MB [Expert: %s]",
-                                     GET_IFACE_DESCR(capture_opts),
+                                     get_iface_description(capture_opts),
                                      capture_opts->save_file,
                                      cf->f_datalen/1024/1024,
                                      val_to_str(expert_get_highest_severity(),
@@ -1695,7 +1697,7 @@ main_cf_cb_live_capture_update_continue(capture_file *cf)
                                                 "Unknown (%u)"));
     } else if (cf->f_datalen/1024 > 10) {
         capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld KB [Expert: %s]",
-                                     GET_IFACE_DESCR(capture_opts),
+                                     get_iface_description(capture_opts),
                                      capture_opts->save_file,
                                      cf->f_datalen/1024,
                                      val_to_str(expert_get_highest_severity(),
@@ -1703,7 +1705,7 @@ main_cf_cb_live_capture_update_continue(capture_file *cf)
                                                 "Unknown (%u)"));
     } else {
         capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %lld Bytes [Expert: %s]",
-                                     GET_IFACE_DESCR(capture_opts),
+                                     get_iface_description(capture_opts),
                                      capture_opts->save_file,
                                      cf->f_datalen,
                                      val_to_str(expert_get_highest_severity(),
@@ -1713,17 +1715,17 @@ main_cf_cb_live_capture_update_continue(capture_file *cf)
 #endif
     if (cf->f_datalen/1024/1024 > 10) {
         capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d MB",
-                                     GET_IFACE_DESCR(capture_opts),
+                                     get_iface_description(capture_opts),
                                      capture_opts->save_file,
                                      cf->f_datalen/1024/1024);
     } else if (cf->f_datalen/1024 > 10) {
         capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d KB",
-                                     GET_IFACE_DESCR(capture_opts),
+                                     get_iface_description(capture_opts),
                                      capture_opts->save_file,
                                      cf->f_datalen/1024);
     } else {
         capture_msg = g_strdup_printf(" %s: <live capture in progress> File: %s %" G_GINT64_MODIFIER "d Bytes",
-                                     GET_IFACE_DESCR(capture_opts),
+                                     get_iface_description(capture_opts),
                                      capture_opts->save_file,
                                      cf->f_datalen);
     }
@@ -1788,7 +1790,7 @@ main_cf_cb_live_capture_fixed_started(capture_options *capture_opts)
     statusbar_pop_file_msg();
 
     capture_msg = g_strdup_printf(" %s: <live capture in progress> to file: %s",
-                                 GET_IFACE_DESCR(capture_opts),
+                                 get_iface_description(capture_opts),
                                  (capture_opts->save_file) ? capture_opts->save_file : "");
 
     statusbar_push_file_msg(capture_msg);
index 2d8b92651e23803c584c4ee3d726ec63dc195f98..0ac1b8a5f168ee92613b8157c44b746055045dd7 100644 (file)
--- a/summary.c
+++ b/summary.c
@@ -123,6 +123,6 @@ summary_fill_in_capture(capture_options *capture_opts, summary_tally *st)
 {
   st->cfilter = capture_opts->cfilter;
   st->iface = capture_opts->iface;
-  st->iface_descr = GET_IFACE_DESCR(capture_opts);
+  st->iface_descr = get_iface_description(capture_opts);
 }
 #endif