aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-01-14 05:39:57 +0000
committerGuy Harris <guy@alum.mit.edu>2014-01-14 05:39:57 +0000
commitc6c1887a0b9a028802826243fc61e8669f28f37e (patch)
treeb24c191eccb22190962de0a766eeb9e4574d101b
parente1f6ad8387f43135e62caf8c21014a38985ec8a8 (diff)
Have ip6_to_str() and tvb_ip6_to_str() return const pointers, as the
ip_to_str equivalents do. Don't cast away constness, and don't make it necessary to do so. svn path=/trunk/; revision=54767
-rw-r--r--epan/address_to_str.c4
-rw-r--r--epan/dissectors/packet-smb-common.c4
-rw-r--r--epan/dissectors/packet-smb-common.h2
-rw-r--r--epan/dissectors/packet-smb.c10
-rw-r--r--epan/to_str.h4
5 files changed, 12 insertions, 12 deletions
diff --git a/epan/address_to_str.c b/epan/address_to_str.c
index 93b9f554d8..167f5084e5 100644
--- a/epan/address_to_str.c
+++ b/epan/address_to_str.c
@@ -117,7 +117,7 @@ tvb_ip_to_str(tvbuff_t *tvb, const gint offset)
/* XXX FIXME
remove this one later when every call has been converted to ep_address_to_str()
*/
-gchar *
+const gchar *
ip6_to_str(const struct e_in6_addr *ad) {
gchar *str;
@@ -127,7 +127,7 @@ ip6_to_str(const struct e_in6_addr *ad) {
}
#define IPV6_LENGTH 16
-gchar *
+const gchar *
tvb_ip6_to_str(tvbuff_t *tvb, const gint offset)
{
gchar *buf;
diff --git a/epan/dissectors/packet-smb-common.c b/epan/dissectors/packet-smb-common.c
index 0d77f6b987..71e5e7aeda 100644
--- a/epan/dissectors/packet-smb-common.c
+++ b/epan/dissectors/packet-smb-common.c
@@ -128,7 +128,7 @@ int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_i
#define MAX_UNICODE_STR_LEN 256
int dissect_ms_compressed_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index,
- char **data)
+ const char **data)
{
int compr_len;
const guchar *str = NULL;
@@ -138,7 +138,7 @@ int dissect_ms_compressed_string(tvbuff_t *tvb, proto_tree *tree, int offset, in
proto_tree_add_string(tree, hf_index, tvb, offset, compr_len, str);
if (data)
- *data = (char*) str;
+ *data = str;
return offset + compr_len;
}
diff --git a/epan/dissectors/packet-smb-common.h b/epan/dissectors/packet-smb-common.h
index b49a647f61..216457b3dc 100644
--- a/epan/dissectors/packet-smb-common.h
+++ b/epan/dissectors/packet-smb-common.h
@@ -37,7 +37,7 @@ int display_unicode_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_i
int display_ms_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index, char **data);
int dissect_ms_compressed_string(tvbuff_t *tvb, proto_tree *tree, int offset, int hf_index,
- char **data);
+ const char **data);
const gchar *get_unicode_or_ascii_string(tvbuff_t *tvb, int *offsetp,
gboolean useunicode, int *len, gboolean nopad, gboolean exactlen,
diff --git a/epan/dissectors/packet-smb.c b/epan/dissectors/packet-smb.c
index 8262ae3105..22b1760c28 100644
--- a/epan/dissectors/packet-smb.c
+++ b/epan/dissectors/packet-smb.c
@@ -993,17 +993,17 @@ const gchar *tree_ip_str(packet_info *pinfo, guint16 cmd) {
if ( cmd == SMB_COM_READ_ANDX ||
cmd == SMB_COM_READ ||
cmd == SMB2_COM_READ) {
- buf = (gchar *)ip_to_str((const guint8 *)pinfo->src.data);
+ buf = ip_to_str((const guint8 *)pinfo->src.data);
} else {
- buf = (gchar *)ip_to_str((const guint8 *)pinfo->dst.data);
+ buf = ip_to_str((const guint8 *)pinfo->dst.data);
}
} else {
if ( cmd == SMB_COM_READ_ANDX ||
cmd == SMB_COM_READ ||
cmd == SMB2_COM_READ) {
- buf = (gchar *)ip6_to_str((const struct e_in6_addr *)pinfo->src.data);
+ buf = ip6_to_str((const struct e_in6_addr *)pinfo->src.data);
} else {
- buf = (gchar *)ip6_to_str((const struct e_in6_addr *)pinfo->dst.data);
+ buf = ip6_to_str((const struct e_in6_addr *)pinfo->dst.data);
}
}
@@ -7227,7 +7227,7 @@ dissect_session_setup_andx_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree
/* If we have found a uid->acct_name mapping, store it */
if (!pinfo->fd->flags.visited && si->sip) {
int idx = 0;
- if ((ntlmssph = (ntlmssp_header_t *)fetch_tapped_data(ntlmssp_tap_id, idx + 1 )) != NULL) {
+ if ((ntlmssph = (const ntlmssp_header_t *)fetch_tapped_data(ntlmssp_tap_id, idx + 1 )) != NULL) {
if (ntlmssph && (ntlmssph->type == 3)) {
smb_uid_t *smb_uid;
diff --git a/epan/to_str.h b/epan/to_str.h
index beb63eab8b..19e3a552a2 100644
--- a/epan/to_str.h
+++ b/epan/to_str.h
@@ -66,8 +66,8 @@ extern const gchar* fc_to_str(const guint8 *);
extern gchar* fcwwn_to_str (const guint8 *);
WS_DLL_PUBLIC const gchar* tvb_fc_to_str(tvbuff_t *tvb, const gint offset);
WS_DLL_PUBLIC gchar* tvb_fcwwn_to_str (tvbuff_t *tvb, const gint offset);
-WS_DLL_PUBLIC gchar* ip6_to_str(const struct e_in6_addr *);
-WS_DLL_PUBLIC gchar* tvb_ip6_to_str(tvbuff_t *tvb, const gint offset);
+WS_DLL_PUBLIC const gchar* ip6_to_str(const struct e_in6_addr *);
+WS_DLL_PUBLIC const gchar* tvb_ip6_to_str(tvbuff_t *tvb, const gint offset);
void ip6_to_str_buf(const struct e_in6_addr *, gchar *);
extern gchar* ipx_addr_to_str(const guint32, const guint8 *);
extern gchar* ipxnet_to_string(const guint8 *ad);