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
This commit is contained in:
Guy Harris 2014-01-14 05:39:57 +00:00
parent e1f6ad8387
commit c6c1887a0b
5 changed files with 12 additions and 12 deletions

View File

@ -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;

View File

@ -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;
}

View File

@ -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,

View File

@ -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;

View File

@ -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);