aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Zawadzki <darkjames-ws@darkjames.pl>2012-04-09 18:44:10 +0000
committerJakub Zawadzki <darkjames-ws@darkjames.pl>2012-04-09 18:44:10 +0000
commit23494db817c6a5e0262a5312d7b97e1e601091f7 (patch)
tree37ce8ddd63232d2fb8256477fd509a5846d3b678
parent1e6301fa8b049cf9e9086c034b6550449b2d6402 (diff)
Add missing const attribute to some char *
Fix some "assignment discards qualifiers from pointer target type", etc svn path=/trunk/; revision=41996
-rw-r--r--epan/dissectors/packet-ieee80211.c2
-rw-r--r--epan/dissectors/packet-nfs.c2
-rw-r--r--epan/dissectors/packet-nfs.h2
-rw-r--r--epan/dissectors/packet-pdcp-lte.c12
-rw-r--r--epan/dissectors/packet-scsi.c2
-rw-r--r--epan/dissectors/packet-smb2.c24
-rw-r--r--epan/dissectors/packet-ssh.c2
-rw-r--r--epan/dissectors/packet-windows-common.h4
-rw-r--r--epan/strutil.c2
-rw-r--r--rawshark.c4
-rw-r--r--ui/gtk/filter_autocomplete.c9
-rw-r--r--ui/gtk/firewall_dlg.c4
12 files changed, 35 insertions, 34 deletions
diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c
index 343d9019b4..bd844987fe 100644
--- a/epan/dissectors/packet-ieee80211.c
+++ b/epan/dissectors/packet-ieee80211.c
@@ -178,7 +178,7 @@ static guint num_wepkeys_uat = 0;
static void* uat_wep_key_record_copy_cb(void* n, const void* o, size_t siz _U_) {
uat_wep_key_record_t* new_key = (uat_wep_key_record_t *)n;
- const uat_wep_key_record_t* old_key = (uat_wep_key_record_t *)o;
+ const uat_wep_key_record_t* old_key = (const uat_wep_key_record_t *)o;
if (old_key->string) {
new_key->string = g_strdup(old_key->string);
diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c
index d3af97b134..240ed1d717 100644
--- a/epan/dissectors/packet-nfs.c
+++ b/epan/dissectors/packet-nfs.c
@@ -4814,7 +4814,7 @@ static const true_false_string tfs_access_rights = {"allowed", "*Access Denied*"
proto_tree*
display_access_items(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree,
- guint32 amask, char mtype, int version, GString* optext, char* label)
+ guint32 amask, char mtype, int version, GString* optext, const char* label)
{
gboolean nfsv3 = (version==3 ? TRUE : FALSE);
proto_item* access_item = NULL;
diff --git a/epan/dissectors/packet-nfs.h b/epan/dissectors/packet-nfs.h
index 508c7658b0..09764999b3 100644
--- a/epan/dissectors/packet-nfs.h
+++ b/epan/dissectors/packet-nfs.h
@@ -197,7 +197,7 @@ extern int dissect_fattr(tvbuff_t *tvb, int offset, proto_tree *tree,
const char* name);
extern proto_tree* display_access_items(tvbuff_t* tvb, int offset, packet_info* pinfo, proto_tree* tree,
- guint32 amask, char mtype, int version, GString* optext, char* label);
+ guint32 amask, char mtype, int version, GString* optext, const char* label);
extern int dissect_access_reply(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree* tree,
int version, GString *optext);
diff --git a/epan/dissectors/packet-pdcp-lte.c b/epan/dissectors/packet-pdcp-lte.c
index 50454b8d32..f744a8d057 100644
--- a/epan/dissectors/packet-pdcp-lte.c
+++ b/epan/dissectors/packet-pdcp-lte.c
@@ -347,8 +347,8 @@ static GHashTable *pdcp_sequence_analysis_channel_hash = NULL;
/* Equal keys */
static gint pdcp_channel_equal(gconstpointer v, gconstpointer v2)
{
- const pdcp_channel_hash_key* val1 = (pdcp_channel_hash_key *)v;
- const pdcp_channel_hash_key* val2 = (pdcp_channel_hash_key *)v2;
+ const pdcp_channel_hash_key* val1 = (const pdcp_channel_hash_key *)v;
+ const pdcp_channel_hash_key* val2 = (const pdcp_channel_hash_key *)v2;
/* All fields must match */
return (memcmp(val1, val2, sizeof(pdcp_channel_hash_key)) == 0);
@@ -357,7 +357,7 @@ static gint pdcp_channel_equal(gconstpointer v, gconstpointer v2)
/* Compute a hash value for a given key. */
static guint pdcp_channel_hash_func(gconstpointer v)
{
- const pdcp_channel_hash_key* val1 = (pdcp_channel_hash_key *)v;
+ const pdcp_channel_hash_key* val1 = (const pdcp_channel_hash_key *)v;
/* TODO: use multipliers */
return val1->ueId + val1->plane + val1->channelId + val1->direction;
@@ -376,8 +376,8 @@ typedef struct {
static gint pdcp_result_hash_equal(gconstpointer v, gconstpointer v2)
{
- const pdcp_result_hash_key* val1 = (pdcp_result_hash_key *)v;
- const pdcp_result_hash_key* val2 = (pdcp_result_hash_key *)v2;
+ const pdcp_result_hash_key* val1 = (const pdcp_result_hash_key *)v;
+ const pdcp_result_hash_key* val2 = (const pdcp_result_hash_key *)v2;
/* All fields must match */
return (memcmp(val1, val2, sizeof(pdcp_result_hash_key)) == 0);
@@ -386,7 +386,7 @@ static gint pdcp_result_hash_equal(gconstpointer v, gconstpointer v2)
/* Compute a hash value for a given key. */
static guint pdcp_result_hash_func(gconstpointer v)
{
- const pdcp_result_hash_key* val1 = (pdcp_result_hash_key *)v;
+ const pdcp_result_hash_key* val1 = (const pdcp_result_hash_key *)v;
/* TODO: check collision-rate / execution-time of these multipliers? */
return val1->frameNumber + (val1->channelId<<13) +
diff --git a/epan/dissectors/packet-scsi.c b/epan/dissectors/packet-scsi.c
index e7d944c0a2..cf120587e9 100644
--- a/epan/dissectors/packet-scsi.c
+++ b/epan/dissectors/packet-scsi.c
@@ -827,7 +827,7 @@ typedef void (*log_parameter_dissector)(tvbuff_t *tvb, packet_info *pinfo, proto
typedef struct _log_page_parameters_t {
guint32 number;
- char *name;
+ const char *name;
log_parameter_dissector dissector;
} log_page_parameters_t;
static const log_page_parameters_t tape_alert_log_parameters[] = {
diff --git a/epan/dissectors/packet-smb2.c b/epan/dissectors/packet-smb2.c
index 592f5cf74c..807d489b9b 100644
--- a/epan/dissectors/packet-smb2.c
+++ b/epan/dissectors/packet-smb2.c
@@ -501,14 +501,14 @@ static const value_string smb2_find_info_levels[] = {
static gint
smb2_saved_info_equal_unmatched(gconstpointer k1, gconstpointer k2)
{
- smb2_saved_info_t *key1 = (smb2_saved_info_t *)k1;
- smb2_saved_info_t *key2 = (smb2_saved_info_t *)k2;
+ const smb2_saved_info_t *key1 = (const smb2_saved_info_t *)k1;
+ const smb2_saved_info_t *key2 = (const smb2_saved_info_t *)k2;
return key1->seqnum==key2->seqnum;
}
static guint
smb2_saved_info_hash_unmatched(gconstpointer k)
{
- smb2_saved_info_t *key = (smb2_saved_info_t *)k;
+ const smb2_saved_info_t *key = (const smb2_saved_info_t *)k;
guint32 hash;
hash=(guint32) (key->seqnum&0xffffffff);
@@ -522,14 +522,14 @@ smb2_saved_info_hash_unmatched(gconstpointer k)
static gint
smb2_saved_info_equal_matched(gconstpointer k1, gconstpointer k2)
{
- smb2_saved_info_t *key1 = (smb2_saved_info_t *)k1;
- smb2_saved_info_t *key2 = (smb2_saved_info_t *)k2;
+ const smb2_saved_info_t *key1 = (const smb2_saved_info_t *)k1;
+ const smb2_saved_info_t *key2 = (const smb2_saved_info_t *)k2;
return key1->seqnum==key2->seqnum;
}
static guint
smb2_saved_info_hash_matched(gconstpointer k)
{
- smb2_saved_info_t *key = (smb2_saved_info_t *)k;
+ const smb2_saved_info_t *key = (const smb2_saved_info_t *)k;
guint32 hash;
hash=(guint32) (key->seqnum&0xffffffff);
@@ -546,14 +546,14 @@ smb2_saved_info_hash_matched(gconstpointer k)
static gint
smb2_tid_info_equal(gconstpointer k1, gconstpointer k2)
{
- smb2_tid_info_t *key1 = (smb2_tid_info_t *)k1;
- smb2_tid_info_t *key2 = (smb2_tid_info_t *)k2;
+ const smb2_tid_info_t *key1 = (const smb2_tid_info_t *)k1;
+ const smb2_tid_info_t *key2 = (const smb2_tid_info_t *)k2;
return key1->tid==key2->tid;
}
static guint
smb2_tid_info_hash(gconstpointer k)
{
- smb2_tid_info_t *key = (smb2_tid_info_t *)k;
+ const smb2_tid_info_t *key = (const smb2_tid_info_t *)k;
guint32 hash;
hash=key->tid;
@@ -570,14 +570,14 @@ smb2_tid_info_hash(gconstpointer k)
static gint
smb2_sesid_info_equal(gconstpointer k1, gconstpointer k2)
{
- smb2_sesid_info_t *key1 = (smb2_sesid_info_t *)k1;
- smb2_sesid_info_t *key2 = (smb2_sesid_info_t *)k2;
+ const smb2_sesid_info_t *key1 = (const smb2_sesid_info_t *)k1;
+ const smb2_sesid_info_t *key2 = (const smb2_sesid_info_t *)k2;
return key1->sesid==key2->sesid;
}
static guint
smb2_sesid_info_hash(gconstpointer k)
{
- smb2_sesid_info_t *key = (smb2_sesid_info_t *)k;
+ const smb2_sesid_info_t *key = (const smb2_sesid_info_t *)k;
guint32 hash;
hash=(guint32)( ((key->sesid>>32)&0xffffffff)+((key->sesid)&0xffffffff) );
diff --git a/epan/dissectors/packet-ssh.c b/epan/dissectors/packet-ssh.c
index e07dc416c5..230aa5f0ff 100644
--- a/epan/dissectors/packet-ssh.c
+++ b/epan/dissectors/packet-ssh.c
@@ -946,7 +946,7 @@ ssh_gslist_compare_strings(gconstpointer a, gconstpointer b)
return -1;
if (b == NULL)
return 1;
- return strcmp((char*)a,(char*)b);
+ return strcmp((const char*)a,(const char*)b);
}
/* expects that *result is NULL */
diff --git a/epan/dissectors/packet-windows-common.h b/epan/dissectors/packet-windows-common.h
index 32e5781ee1..be8699cf8f 100644
--- a/epan/dissectors/packet-windows-common.h
+++ b/epan/dissectors/packet-windows-common.h
@@ -209,8 +209,8 @@ int dissect_nt_64bit_time(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_da
*/
typedef struct _sid_strings {
- char* sid;
- char* name;
+ const char* sid;
+ const char* name;
} sid_strings;
/* Dissect a NT SID. Label it with 'name' and return a string version
diff --git a/epan/strutil.c b/epan/strutil.c
index 790eb5c4bd..d446fa08b0 100644
--- a/epan/strutil.c
+++ b/epan/strutil.c
@@ -521,7 +521,7 @@ uri_str_to_bytes(const char *uri_str, GByteArray *bytes) {
val = (guint8) strtoul((char *)hex_digit, NULL, 16);
g_byte_array_append(bytes, &val, 1);
} else {
- g_byte_array_append(bytes, (guint8 *) p, 1);
+ g_byte_array_append(bytes, (const guint8 *) p, 1);
}
p++;
diff --git a/rawshark.c b/rawshark.c
index 73131c5b1d..de04ec7134 100644
--- a/rawshark.c
+++ b/rawshark.c
@@ -1330,7 +1330,7 @@ static gboolean print_field_value(field_info *finfo, int cmd_line_index)
if (hfinfo->display & BASE_RANGE_STRING) {
g_string_append(label_s, rval_to_str(svalue, RVALS(hfinfo->strings), "Unknown"));
} else if (hfinfo->display & BASE_EXT_STRING) {
- g_string_append(label_s, val_to_str_ext(svalue, (value_string_ext *) hfinfo->strings, "Unknown"));
+ g_string_append(label_s, val_to_str_ext(svalue, (const value_string_ext *) hfinfo->strings, "Unknown"));
} else {
g_string_append(label_s, val_to_str(svalue, cVALS(hfinfo->strings), "Unknown"));
}
@@ -1343,7 +1343,7 @@ static gboolean print_field_value(field_info *finfo, int cmd_line_index)
if (!hfinfo->bitmask && hfinfo->display & BASE_RANGE_STRING) {
g_string_append(label_s, rval_to_str(uvalue, RVALS(hfinfo->strings), "Unknown"));
} else if (hfinfo->display & BASE_EXT_STRING) {
- g_string_append(label_s, val_to_str_ext(uvalue, (value_string_ext *) hfinfo->strings, "Unknown"));
+ g_string_append(label_s, val_to_str_ext(uvalue, (const value_string_ext *) hfinfo->strings, "Unknown"));
} else {
g_string_append(label_s, val_to_str(uvalue, cVALS(hfinfo->strings), "Unknown"));
}
diff --git a/ui/gtk/filter_autocomplete.c b/ui/gtk/filter_autocomplete.c
index 6a67b51eb8..ad67bb51ea 100644
--- a/ui/gtk/filter_autocomplete.c
+++ b/ui/gtk/filter_autocomplete.c
@@ -78,10 +78,11 @@ is_protocol_name_being_typed(GtkWidget *filter_te, int str_len)
int op_len, cursor_pos;
gchar *start;
gchar *pos;
- static gchar *logic_ops[] = { "!", "not",
- "||", "or",
- "&&", "and",
- "^^", "xor" };
+ static const gchar *logic_ops[] =
+ { "!", "not",
+ "||", "or",
+ "&&", "and",
+ "^^", "xor" };
/* If the cursor is located at the beginning of the filter editable text,
* then it's _probably_ a protocol name.
diff --git a/ui/gtk/firewall_dlg.c b/ui/gtk/firewall_dlg.c
index 106094350a..5a270c539f 100644
--- a/ui/gtk/firewall_dlg.c
+++ b/ui/gtk/firewall_dlg.c
@@ -139,8 +139,8 @@ static void sf_pf_ipv4_port(GString *rtxt, gchar *addr, guint32 port, port_type
static void sf_netsh_ipv4_port(GString *rtxt, gchar *addr, guint32 port, port_type ptype, gboolean inbound, gboolean deny);
typedef struct _fw_product_t {
- gchar *name;
- gchar *comment_pfx;
+ const gchar *name;
+ const gchar *comment_pfx;
syntax_func mac_func;
syntax_func ipv4_func;
syntax_func port_func;