See if this makes it build cleanly.
[obnox/wireshark/wip.git] / capture_ui_utils.c
index 90b8b435bc953c7c9eeaaaace1b461c72fb6e269..48bca7a31b5d89204d9d4a37e37a86a48b95ee09 100644 (file)
@@ -38,6 +38,9 @@
 #include "epan/ex-opt.h"
 #include "capture_ifinfo.h"
 #include "capture_ui_utils.h"
+#include "ui/simple_dialog.h"
+#include "wiretap/wtap.h"
+#include "epan/to_str.h"
 
 /*
  * Find user-specified capture device description that matches interface
@@ -395,33 +398,26 @@ 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
+/*  Return interface_opts->descr (after setting it if it is not set)
+ *  This is necessary because capture_opts.c can't set 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)
-               capture_opts->iface_descr = get_interface_descriptive_name(capture_opts->iface);
-
-       return(capture_opts->iface_descr);
-
-}
-
 const char *
 get_iface_description_for_interface(capture_options *capture_opts, guint i)
 {
-       interface_options interface_opts;
-
-       interface_opts = g_array_index(capture_opts->ifaces, interface_options, i);
-       if (!interface_opts.descr && interface_opts.name) {
-               interface_opts.descr = get_interface_descriptive_name(interface_opts.name);
-       }
-       capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, i);
-       g_array_insert_val(capture_opts->ifaces, i, interface_opts);
-
-       return (interface_opts.descr);
+  interface_options interface_opts;
+
+  if (i < capture_opts->ifaces->len) {
+    interface_opts = g_array_index(capture_opts->ifaces, interface_options, i);
+    if (!interface_opts.descr && interface_opts.name) {
+      interface_opts.descr = get_interface_descriptive_name(interface_opts.name);
+      capture_opts->ifaces = g_array_remove_index(capture_opts->ifaces, i);
+      g_array_insert_val(capture_opts->ifaces, i, interface_opts);
+    }
+    return (interface_opts.descr);
+  } else {
+    return (NULL);
+  }
 }
 
 #endif /* HAVE_LIBPCAP */