aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2018-02-27 15:05:27 +0100
committerMichael Mann <mmann78@netscape.net>2018-02-28 01:08:41 +0000
commitbbb6bcbbab9c35caecc8e0ff997b6da6b2e91210 (patch)
treebb6d12ef948ea68490d857ce51b2eddc3042a51a
parent7a79a6019e21257a7d6f275ce8d6441034a945ab (diff)
rtspstat: use integer cast in g_hash_table.
Change-Id: I5ebdbe5a94ed377c120411c46daca3903036fe42 Reviewed-on: https://code.wireshark.org/review/26140 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann <mmann78@netscape.net>
-rw-r--r--ui/cli/tap-rtspstat.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/ui/cli/tap-rtspstat.c b/ui/cli/tap-rtspstat.c
index ec2de3edd5..5fed0a1e38 100644
--- a/ui/cli/tap-rtspstat.c
+++ b/ui/cli/tap-rtspstat.c
@@ -57,18 +57,16 @@ rtsp_init_hash( rtspstat_t *sp)
{
int i;
- sp->hash_responses = g_hash_table_new( g_int_hash, g_int_equal);
+ sp->hash_responses = g_hash_table_new(g_direct_hash, g_direct_equal);
for (i=0 ; rtsp_status_code_vals[i].strptr ; i++ )
{
- gint *key = g_new (gint, 1);
rtsp_response_code_t *sc = g_new (rtsp_response_code_t, 1);
- *key = rtsp_status_code_vals[i].value;
sc->packets = 0;
- sc->response_code = *key;
+ sc->response_code = rtsp_status_code_vals[i].value;
sc->name = rtsp_status_code_vals[i].strptr;
sc->sp = sp;
- g_hash_table_insert( sc->sp->hash_responses, key, sc);
+ g_hash_table_insert( sc->sp->hash_responses, GINT_TO_POINTER(rtsp_status_code_vals[i].value), sc);
}
sp->hash_requests = g_hash_table_new( g_str_hash, g_str_equal);
}
@@ -81,10 +79,10 @@ rtsp_draw_hash_requests( gchar *key _U_ , rtsp_request_methode_t *data, gchar *
}
static void
-rtsp_draw_hash_responses( gint * key _U_ , rtsp_response_code_t *data, char * format)
+rtsp_draw_hash_responses( gpointer* key _U_ , rtsp_response_code_t *data, char * format)
{
if (data == NULL) {
- g_warning("No data available, key=%d\n", *key);
+ g_warning("No data available, key=%d\n", GPOINTER_TO_INT(key));
exit(EXIT_FAILURE);
}
if (data->packets == 0)
@@ -134,14 +132,13 @@ rtspstat_packet(void *psp , packet_info *pinfo _U_, epan_dissect_t *edt _U_, con
/* We are only interested in reply packets with a status code */
/* Request or reply packets ? */
if (value->response_code != 0) {
- guint *key = g_new(guint, 1);
rtsp_response_code_t *sc;
- *key = value->response_code;
sc = (rtsp_response_code_t *)g_hash_table_lookup(
sp->hash_responses,
- key);
+ GINT_TO_POINTER(value->response_code));
if (sc == NULL) {
+ gint key;
/* non standard status code ; we classify it as others
* in the relevant category (Informational,Success,Redirection,Client Error,Server Error)
*/
@@ -150,23 +147,23 @@ rtspstat_packet(void *psp , packet_info *pinfo _U_, epan_dissect_t *edt _U_, con
return 0;
}
else if (i < 200) {
- *key = 199; /* Hopefully, this status code will never be used */
+ key = 199; /* Hopefully, this status code will never be used */
}
else if (i < 300) {
- *key = 299;
+ key = 299;
}
else if (i < 400) {
- *key = 399;
+ key = 399;
}
else if (i < 500) {
- *key = 499;
+ key = 499;
}
else {
- *key = 599;
+ key = 599;
}
sc = (rtsp_response_code_t *)g_hash_table_lookup(
sp->hash_responses,
- key);
+ GINT_TO_POINTER(key));
if (sc == NULL)
return 0;
}