Squelch more const warnings (and fix some memory leaks that found).
[obnox/wireshark/wip.git] / gtk / h225_ras_srt.c
index f6b8e1ab5f2a6c854d18d688f7dfb03572928707..92a6da1c3e51404b4e8cedad363ed55b8c3a1d84 100644 (file)
@@ -2,7 +2,7 @@
  * h225 RAS Service Response Time statistics for ethereal
  * Copyright 2003 Lars Roland
  *
- * $Id: h225_ras_srt.c,v 1.17 2004/05/23 23:24:05 ulfl Exp $
+ * $Id$
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -40,9 +40,9 @@
 #include <epan/value_string.h>
 
 #include "tap_menu.h"
-#include "../tap.h"
+#include <epan/tap.h>
 #include "../register.h"
-#include "../packet-h225.h"
+#include <epan/dissectors/packet-h225.h>
 #include "../timestats.h"
 #include "gtk_stat_util.h"
 #include "compat_macros.h"
@@ -55,9 +55,7 @@
 #include "ui_util.h"
 
 
-extern GtkWidget *main_display_filter_widget;
-
-static void gtk_h225rassrt_init(char *optarg);
+static void gtk_h225rassrt_init(const char *optarg);
 
 static tap_dfilter_dlg h225_rassrt_dlg = {
        "H.225 RAS Service Response Time",
@@ -144,10 +142,10 @@ h225rassrt_reset(void *phs)
 
 
 static int
-h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, void *phi)
+h225rassrt_packet(void *phs, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *phi)
 {
        h225rassrt_t *hs=(h225rassrt_t *)phs;
-       h225_packet_info *pi=phi;
+       const h225_packet_info *pi=phi;
 
        ras_type rasmsg_type = RAS_OTHER;
        ras_category rascategory = RAS_OTHERS;
@@ -270,7 +268,8 @@ win_destroy_cb(GtkWindow *win _U_, gpointer data)
 }
 
 
-static gchar *titles[]={"RAS-Type",
+static const gchar *titles[]={
+                       "RAS-Type",
                        "Measurements",
                        "Min RTT",
                        "Max RTT",
@@ -283,19 +282,18 @@ static gchar *titles[]={"RAS-Type",
                        "Repeated Responses" };
 
 static void
-gtk_h225rassrt_init(char *optarg)
+gtk_h225rassrt_init(const char *optarg)
 {
        h225rassrt_t *hs;
-       char *filter=NULL;
+       const char *filter=NULL;
        GString *error_string;
-    GtkWidget *bbox;
-    GtkWidget *close_bt;
+       GtkWidget *bbox;
+       GtkWidget *close_bt;
 
        if(strncmp(optarg,"h225,srt,",9) == 0){
                filter=optarg+9;
        } else {
-               filter=g_malloc(1);
-               *filter='\0';
+               filter="";
        }
 
        hs=g_malloc(sizeof(h225rassrt_t));
@@ -304,15 +302,15 @@ gtk_h225rassrt_init(char *optarg)
        h225rassrt_reset(hs);
 
        hs->win=window_new(GTK_WINDOW_TOPLEVEL, "h225-ras-srt");
+       gtk_window_set_default_size(GTK_WINDOW(hs->win), 600, 300);
 
        hs->vbox=gtk_vbox_new(FALSE, 3);
        gtk_container_set_border_width(GTK_CONTAINER(hs->vbox), 12);
 
-       init_main_stat_window(hs->win, hs->vbox, "ITU-T H.225 RAS Service Response Time", filter);
+       init_main_stat_window(hs->win, hs->vbox, "H.225 RAS Service Response Time", filter);
 
         /* init a scrolled window*/
        hs->scrolled_window = scrolled_window_new(NULL, NULL);
-       WIDGET_SET_SIZE(hs->scrolled_window, 600, 160);
 
        hs->table = create_stat_table(hs->scrolled_window, hs->vbox, 11, titles);
 
@@ -330,23 +328,22 @@ gtk_h225rassrt_init(char *optarg)
        gtk_box_pack_end(GTK_BOX(hs->vbox), bbox, FALSE, FALSE, 0);
 
        close_bt = OBJECT_GET_DATA(bbox, GTK_STOCK_CLOSE);
-    window_set_cancel_button(hs->win, close_bt, window_cancel_button_cb);
+       window_set_cancel_button(hs->win, close_bt, window_cancel_button_cb);
 
-    SIGNAL_CONNECT(hs->win, "delete_event", window_delete_event_cb, NULL);
-    SIGNAL_CONNECT(hs->win, "destroy", win_destroy_cb, hs);
+       SIGNAL_CONNECT(hs->win, "delete_event", window_delete_event_cb, NULL);
+       SIGNAL_CONNECT(hs->win, "destroy", win_destroy_cb, hs);
 
        gtk_widget_show_all(hs->win);
-    window_present(hs->win);
+       window_present(hs->win);
 
-    /* XXX - shouldn't this be retap_packets? */
-    redissect_packets(&cfile);
+       cf_retap_packets(&cfile);
 }
 
 void
 register_tap_listener_gtk_h225rassrt(void)
 {
-       register_ethereal_tap("h225,srt", gtk_h225rassrt_init);
+       register_tap_listener_cmd_arg("h225,srt", gtk_h225rassrt_init);
 
-       register_tap_menu_item("ITU-T H.225 RAS...", REGISTER_TAP_GROUP_RESPONSE_TIME,
+       register_tap_menu_item("H.225 RAS...", REGISTER_TAP_GROUP_RESPONSE_TIME,
            gtk_tap_dfilter_dlg_cb, NULL, NULL, &(h225_rassrt_dlg));
 }