Don't cast away constness for the key in g_hash_table_lookup().
authorGuy Harris <guy@alum.mit.edu>
Mon, 28 Dec 2015 21:00:39 +0000 (13:00 -0800)
committerGuy Harris <guy@alum.mit.edu>
Mon, 28 Dec 2015 22:24:56 +0000 (22:24 +0000)
Change-Id: Ibd5cf8947028d90a734de629e3c4202af9d0514b
Reviewed-on: https://code.wireshark.org/review/12887
Petri-Dish: Guy Harris <guy@alum.mit.edu>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Guy Harris <guy@alum.mit.edu>
asn1/p1/packet-p1-template.c
epan/dissectors/packet-p1.c
epan/packet.c
epan/proto.c
epan/wslua/wslua_pinfo.c

index 8858abee70229b32bac8ab854d426e3c3b4fe3ee..d9a28d794d8c3eaca2f1abe263ed795fe7145d61 100644 (file)
@@ -112,7 +112,7 @@ static p1_address_ctx_t *get_do_address_ctx(asn1_ctx_t* actx)
 
     if (actx->pinfo->private_table) {
         /* First check if called from an extension attribute */
-        ctx = (p1_address_ctx_t *)g_hash_table_lookup(actx->pinfo->private_table, (gpointer)P1_ADDRESS_CTX);
+        ctx = (p1_address_ctx_t *)g_hash_table_lookup(actx->pinfo->private_table, P1_ADDRESS_CTX);
     }
 
     if (!ctx) {
index 41603f3c05952b082bbe697b48ab46cb25631a7f..c2dfc893637d54d16c28bd9934bf7fd83c5969bd 100644 (file)
@@ -915,7 +915,7 @@ static p1_address_ctx_t *get_do_address_ctx(asn1_ctx_t* actx)
 
     if (actx->pinfo->private_table) {
         /* First check if called from an extension attribute */
-        ctx = (p1_address_ctx_t *)g_hash_table_lookup(actx->pinfo->private_table, (gpointer)P1_ADDRESS_CTX);
+        ctx = (p1_address_ctx_t *)g_hash_table_lookup(actx->pinfo->private_table, P1_ADDRESS_CTX);
     }
 
     if (!ctx) {
index 0d810ee9a816400b3b696c59dea936f8da3db02a..0e3c02b5f3b5b6c2a5fab64eec3d868e3fa8b583 100644 (file)
@@ -2156,7 +2156,7 @@ has_heur_dissector_list(const gchar *name) {
 
 heur_dtbl_entry_t* find_heur_dissector_by_unique_short_name(const char *short_name)
 {
-       return (heur_dtbl_entry_t*)g_hash_table_lookup(heuristic_short_names, (gpointer)short_name);
+       return (heur_dtbl_entry_t*)g_hash_table_lookup(heuristic_short_names, short_name);
 }
 
 void
@@ -2205,7 +2205,7 @@ heur_dissector_add(const char *name, heur_dissector_t dissector, const char *dis
        }
 
        /* Ensure short_name is unique */
-       if (g_hash_table_lookup(heuristic_short_names, (gpointer)short_name) != NULL) {
+       if (g_hash_table_lookup(heuristic_short_names, short_name) != NULL) {
                g_error("Duplicate heuristic short_name \"%s\"!"
                        " This might be caused by an inappropriate plugin or a development error.", short_name);
        }
index 783af76eea5d85cb31a4079a727e84d106cda4c1..396eac480d306d4c4b5526a9c921bdf8175dde66 100644 (file)
@@ -5321,7 +5321,7 @@ proto_register_protocol(const char *name, const char *short_name,
        }
        g_hash_table_insert(proto_names, key, (gpointer)name);
 
-       existing_protocol = (const protocol_t *)g_hash_table_lookup(proto_short_names, (gpointer)short_name);
+       existing_protocol = (const protocol_t *)g_hash_table_lookup(proto_short_names, short_name);
        if (existing_protocol != NULL) {
                g_error("Duplicate protocol short_name \"%s\"!"
                        " This might be caused by an inappropriate plugin or a development error.", short_name);
@@ -5339,7 +5339,7 @@ proto_register_protocol(const char *name, const char *short_name,
                        " Allowed are lower characters, digits, '-', '_' and '.'."
                        " This might be caused by an inappropriate plugin or a development error.", filter_name);
        }
-       existing_protocol = (const protocol_t *)g_hash_table_lookup(proto_filter_names, (gpointer)filter_name);
+       existing_protocol = (const protocol_t *)g_hash_table_lookup(proto_filter_names, filter_name);
        if (existing_protocol != NULL) {
                g_error("Duplicate protocol filter_name \"%s\"!"
                        " This might be caused by an inappropriate plugin or a development error.", filter_name);
@@ -5533,7 +5533,7 @@ proto_get_id_by_filter_name(const gchar *filter_name)
 
        DISSECTOR_ASSERT_HINT(filter_name, "No filter name present");
 
-       protocol = (const protocol_t *)g_hash_table_lookup(proto_filter_names, (gpointer)filter_name);
+       protocol = (const protocol_t *)g_hash_table_lookup(proto_filter_names, filter_name);
 
        if (protocol == NULL)
                return -1;
@@ -5547,7 +5547,7 @@ proto_get_id_by_short_name(const gchar *short_name)
 
        DISSECTOR_ASSERT_HINT(short_name, "No short name present");
 
-       protocol = (const protocol_t *)g_hash_table_lookup(proto_short_names, (gpointer)short_name);
+       protocol = (const protocol_t *)g_hash_table_lookup(proto_short_names, short_name);
 
        if (protocol == NULL)
                return -1;
index 7484637e4023ab0db57dbb99839ee12cde854390..be095e679c81c27eee6e91a24b3b3036d7f47d32 100644 (file)
@@ -97,7 +97,7 @@ static int PrivateTable__index(lua_State* L) {
     const gchar* name = luaL_checkstring(L,2);
     const gchar* string;
 
-    string = (const gchar *)(g_hash_table_lookup (priv->table, (gpointer) name));
+    string = (const gchar *)(g_hash_table_lookup (priv->table, name));
 
     if (string) {
         lua_pushstring(L, string);