From 59932f27227c4769be94fb46936d123d1770c1a2 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 2 Dec 2002 23:43:30 +0000 Subject: [PATCH] Don't cast away constness, and fix variable and structure member qualifiers as necessary to ensure that we don't have to. "strcmp()", "strcasecmp()", and "memcmp()" don't return booleans; don't test their results as if they did. Use "guint8", not "guchar", for a pointer to (one or more) 8-bit bytes. Update Michael Tuexen's e-mail address. svn path=/trunk/; revision=6726 --- conditions.c | 4 ++-- follow.c | 6 +++--- ncp2222.py | 4 ++-- packet-diameter.c | 28 +++++++++++++--------------- packet-fddi.c | 16 ++++++++-------- packet-giop.c | 24 ++++++++++++------------ packet-http.c | 4 ++-- packet-icmpv6.c | 4 ++-- packet-ipx.c | 6 +++--- packet-iscsi.c | 14 +++++++------- packet-lmp.c | 34 +++++++++++++++++----------------- packet-m2tp.c | 6 +++--- packet-m2ua.c | 12 ++++++------ packet-m3ua.c | 8 ++++---- packet-ncp2222.inc | 28 ++++++++++++++-------------- packet-ndps.c | 12 ++++++------ packet-nfs.c | 38 +++++++++++++++++++++----------------- packet-nfs.h | 4 ++-- packet-nlm.c | 18 ++++++++++-------- packet-null.c | 4 ++-- packet-ospf.c | 6 +++--- packet-pim.c | 8 ++++---- packet-radius.c | 8 ++++---- packet-rpc.c | 26 +++++++++++++------------- packet-rsvp.c | 16 ++++++++-------- packet-sap.c | 4 ++-- packet-scsi.c | 14 +++++++------- packet-sctp.c | 8 ++++---- packet-sua.c | 12 ++++++------ packet-tcp.c | 8 ++++---- reassemble.c | 14 +++++++------- tethereal.c | 6 +++--- 32 files changed, 204 insertions(+), 200 deletions(-) diff --git a/conditions.c b/conditions.c index b9ae406f27..74f08b49a8 100644 --- a/conditions.c +++ b/conditions.c @@ -1,7 +1,7 @@ /* conditions.c * Implementation for condition handler. * - * $Id: conditions.c,v 1.3 2002/08/28 21:00:06 jmayer Exp $ + * $Id: conditions.c,v 1.4 2002/12/02 23:43:25 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -161,7 +161,7 @@ gboolean cnd_register_class(const char* class_id, static char* pkey = NULL; void cnd_unregister_class(const char* class_id){ - char *key = (char*)class_id; + const char *key = (const char*)class_id; _cnd_class *cls = NULL; /* check if hash table is already initialized */ _cnd_init(); diff --git a/follow.c b/follow.c index 6e1e7e439d..13df130b88 100644 --- a/follow.c +++ b/follow.c @@ -1,6 +1,6 @@ /* follow.c * - * $Id: follow.c,v 1.31 2002/08/28 21:00:06 jmayer Exp $ + * $Id: follow.c,v 1.32 2002/12/02 23:43:25 guy Exp $ * * Copyright 1998 Mike Hall * @@ -88,8 +88,8 @@ build_follow_filter( packet_info *pi ) { /* TCP over IPv6 */ sprintf( buf, "(ipv6.addr eq %s and ipv6.addr eq %s) and (tcp.port eq %d and tcp.port eq %d)", - ip6_to_str((struct e_in6_addr *)pi->net_src.data), - ip6_to_str((struct e_in6_addr *)pi->net_dst.data), + ip6_to_str((const struct e_in6_addr *)pi->net_src.data), + ip6_to_str((const struct e_in6_addr *)pi->net_dst.data), pi->srcport, pi->destport ); len = 16; is_ipv6 = TRUE; diff --git a/ncp2222.py b/ncp2222.py index b1c6ec041c..759d2be236 100755 --- a/ncp2222.py +++ b/ncp2222.py @@ -24,7 +24,7 @@ http://developer.novell.com/ndk/doc/docui/index.htm#../ncp/ncp__enu/data/ for a badly-formatted HTML version of the same PDF. -$Id: ncp2222.py,v 1.39 2002/10/21 18:56:50 guy Exp $ +$Id: ncp2222.py,v 1.40 2002/12/02 23:43:25 guy Exp $ Copyright (c) 2000-2002 by Gilbert Ramirez @@ -6257,7 +6257,7 @@ final_registration_ncp2222(void) # Create dfilter_t's for conditional_record's print """ for (i = 0; i < NUM_REQ_CONDS; i++) { - if (!dfilter_compile((gchar*)req_conds[i].dfilter_text, + if (!dfilter_compile((const gchar*)req_conds[i].dfilter_text, &req_conds[i].dfilter)) { g_message("NCP dissector failed to compiler dfilter: %s\\n", req_conds[i].dfilter_text); diff --git a/packet-diameter.c b/packet-diameter.c index 4da97c703e..bfd9563ba5 100644 --- a/packet-diameter.c +++ b/packet-diameter.c @@ -1,7 +1,7 @@ /* packet-diameter.c * Routines for Diameter packet disassembly * - * $Id: packet-diameter.c,v 1.50 2002/08/28 21:00:12 jmayer Exp $ + * $Id: packet-diameter.c,v 1.51 2002/12/02 23:43:26 guy Exp $ * * Copyright (c) 2001 by David Frascone * @@ -387,10 +387,9 @@ xmlParseAVP(xmlNodePtr cur) cur = cur->xmlChildrenNode; while (cur != NULL ) { - if (!strcasecmp((char *)cur->name, "type")) { + if (strcasecmp(cur->name, "type") == 0) { type = XmlStub.xmlGetProp(cur, "type-name"); - } - if (!strcasecmp((char *)cur->name, "enum")) { + } else if (strcasecmp(cur->name, "enum") == 0) { char *valueName=NULL, *valueCode=NULL; ValueName *ve = NULL; valueName = XmlStub.xmlGetProp(cur, "name"); @@ -407,8 +406,7 @@ xmlParseAVP(xmlNodePtr cur) ve->next = vEntry; vEntry = ve; - } - if (!strcasecmp((char *)cur->name, "grouped")) { + } else if (strcasecmp(cur->name, "grouped") == 0) { /* WORK Recurse here for grouped AVPs */ type = "grouped"; } @@ -628,19 +626,19 @@ xmlDictionaryParseSegment(xmlNodePtr cur, int base) */ cur = cur->xmlChildrenNode; while (cur != NULL) { - if (!strcasecmp((char *)cur->name, "avp")) { + if (strcasecmp(cur->name, "avp") == 0) { /* we have an avp!!! */ xmlParseAVP(cur); - } else if (!strcasecmp((char *)cur->name, "vendor")) { + } else if (strcasecmp(cur->name, "vendor") == 0) { /* we have a vendor */ xmlParseVendor(cur); /* For now, ignore typedefn and text */ - } else if (!strcasecmp((char *)cur->name, "command")) { + } else if (strcasecmp(cur->name, "command") == 0) { /* Found a command */ xmlParseCommand(cur); - } else if (!strcasecmp((char *)cur->name, "text")) { - } else if (!strcasecmp((char *)cur->name, "comment")) { - } else if (!strcasecmp((char *)cur->name, "typedefn")) { + } else if (strcasecmp(cur->name, "text") == 0) { + } else if (strcasecmp(cur->name, "comment") == 0) { + } else if (strcasecmp(cur->name, "typedefn") == 0) { /* WORK -- parse in valid types . . . */ } else { /* IF we got here, we're an error */ @@ -662,13 +660,13 @@ xmlDictionaryParse(xmlNodePtr cur) { /* We should expect a base protocol, followed by multiple applicaitons */ while (cur != NULL) { - if (!strcasecmp((char *)cur->name, "base")) { + if (strcasecmp(cur->name, "base") == 0) { /* Base protocol. Descend and parse */ xmlDictionaryParseSegment(cur, 1); - } else if (!strcasecmp((char *)cur->name, "application")) { + } else if (strcasecmp(cur->name, "application") == 0) { /* Application. Descend and parse */ xmlDictionaryParseSegment(cur, 0); - } else if (!strcasecmp((char *)cur->name, "text")) { + } else if (strcasecmp(cur->name, "text") == 0) { /* Ignore text */ } else { g_warning( "Diameter: XML Expecting a base or an application (got \"%s\")", diff --git a/packet-fddi.c b/packet-fddi.c index 87b4e51786..7c173d3b84 100644 --- a/packet-fddi.c +++ b/packet-fddi.c @@ -3,7 +3,7 @@ * * Laurent Deniel * - * $Id: packet-fddi.c,v 1.58 2002/08/28 21:00:13 jmayer Exp $ + * $Id: packet-fddi.c,v 1.59 2002/12/02 23:43:26 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -125,7 +125,7 @@ static dissector_handle_t llc_handle; static dissector_handle_t data_handle; static void -swap_mac_addr(guchar *swapped_addr, const guchar *orig_addr) +swap_mac_addr(guint8 *swapped_addr, const guint8 *orig_addr) { int i; @@ -300,10 +300,10 @@ dissect_fddi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* Extract the destination address, possibly bit-swapping it. */ if (bitswapped) - swap_mac_addr(dst, (guchar *) tvb_get_ptr(tvb, FDDI_P_DHOST, 6)); + swap_mac_addr(dst, tvb_get_ptr(tvb, FDDI_P_DHOST, 6)); else - memcpy(dst, (guchar *) tvb_get_ptr(tvb, FDDI_P_DHOST, 6), sizeof dst); - swap_mac_addr(dst_swapped, (guchar*) tvb_get_ptr(tvb, FDDI_P_DHOST, 6)); + memcpy(dst, tvb_get_ptr(tvb, FDDI_P_DHOST, 6), sizeof dst); + swap_mac_addr(dst_swapped, tvb_get_ptr(tvb, FDDI_P_DHOST, 6)); /* XXX - copy them to some buffer associated with "pi", rather than just making "dst" static? */ @@ -321,10 +321,10 @@ dissect_fddi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* Extract the source address, possibly bit-swapping it. */ if (bitswapped) - swap_mac_addr(src, (guchar *) tvb_get_ptr(tvb, FDDI_P_SHOST, 6)); + swap_mac_addr(src, tvb_get_ptr(tvb, FDDI_P_SHOST, 6)); else - memcpy(src, (guchar *) tvb_get_ptr(tvb, FDDI_P_SHOST, 6), sizeof src); - swap_mac_addr(src_swapped, (guchar*) tvb_get_ptr(tvb, FDDI_P_SHOST, 6)); + memcpy(src, tvb_get_ptr(tvb, FDDI_P_SHOST, 6), sizeof src); + swap_mac_addr(src_swapped, tvb_get_ptr(tvb, FDDI_P_SHOST, 6)); /* XXX - copy them to some buffer associated with "pi", rather than just making "src" static? */ diff --git a/packet-giop.c b/packet-giop.c index 10afda33a0..92e843eed8 100644 --- a/packet-giop.c +++ b/packet-giop.c @@ -9,7 +9,7 @@ * Frank Singleton * Trevor Shepherd * - * $Id: packet-giop.c,v 1.63 2002/08/28 21:00:13 jmayer Exp $ + * $Id: packet-giop.c,v 1.64 2002/12/02 23:43:26 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -853,8 +853,8 @@ static void add_sub_handle_repoid_to_comp_req_list(guint32 fn, giop_sub_handle_t /* giop_complete_reply_hash "EQUAL" Functions */ static gint complete_reply_equal_fn(gconstpointer v, gconstpointer w) { - struct complete_reply_hash_key *mk1 = (struct complete_reply_hash_key *)v; - struct complete_reply_hash_key *mk2 = (struct complete_reply_hash_key *)w; + const struct complete_reply_hash_key *mk1 = (const struct complete_reply_hash_key *)v; + const struct complete_reply_hash_key *mk2 = (const struct complete_reply_hash_key *)w; if (mk1->fn == mk2->fn) { return 1; @@ -867,7 +867,7 @@ static gint complete_reply_equal_fn(gconstpointer v, gconstpointer w) { static guint32 complete_reply_hash_fn(gconstpointer v) { guint32 val; /* init hash value */ - struct complete_reply_hash_key *key = (struct complete_reply_hash_key *)v; + const struct complete_reply_hash_key *key = (const struct complete_reply_hash_key *)v; val = key->fn; /* simple and unique */ @@ -969,10 +969,10 @@ static guint32 get_mfn_from_fn_and_reqid(guint32 fn, guint32 reqid) { /* Module Hash "EQUAL" Functions */ static gint giop_hash_module_equal(gconstpointer v, gconstpointer w) { - struct giop_module_key *mk1 = (struct giop_module_key *)v; - struct giop_module_key *mk2 = (struct giop_module_key *)w; + const struct giop_module_key *mk1 = (const struct giop_module_key *)v; + const struct giop_module_key *mk2 = (const struct giop_module_key *)w; - if (!strcmp(mk1->module, mk2->module)) { + if (strcmp(mk1->module, mk2->module) == 0) { return 1; } @@ -986,7 +986,7 @@ static guint32 giop_hash_module_hash(gconstpointer v) { int i,len; guint32 val = 0; /* init hash value */ - struct giop_module_key *key = (struct giop_module_key *)v; + const struct giop_module_key *key = (const struct giop_module_key *)v; /* * Hmm, try this simple hashing scheme for now. @@ -1067,15 +1067,15 @@ void register_giop_user_module(giop_sub_dissector_t *sub, gchar *name, gchar *mo /* Object Key Hash "EQUAL" Functions */ static gint giop_hash_objkey_equal(gconstpointer v, gconstpointer w) { - struct giop_object_key *v1 = (struct giop_object_key *)v; - struct giop_object_key *v2 = (struct giop_object_key *)w; + const struct giop_object_key *v1 = (const struct giop_object_key *)v; + const struct giop_object_key *v2 = (const struct giop_object_key *)w; if (v1->objkey_len != v2->objkey_len) return 0; /* no match because different length */ /* Now do a byte comaprison */ - if (!memcmp(v1->objkey,v2->objkey, v1->objkey_len)) { + if (memcmp(v1->objkey,v2->objkey, v1->objkey_len) == 0) { return 1; /* compares ok */ } @@ -1089,7 +1089,7 @@ static gint giop_hash_objkey_equal(gconstpointer v, gconstpointer w) { /* Object Key Hash "HASH" Functions */ static guint32 giop_hash_objkey_hash(gconstpointer v) { - struct giop_object_key *key = (struct giop_object_key *)v; + const struct giop_object_key *key = (const struct giop_object_key *)v; guint32 i; guint32 val = 0; /* init hash value */ diff --git a/packet-http.c b/packet-http.c index 4e31abf55e..e94568944e 100644 --- a/packet-http.c +++ b/packet-http.c @@ -6,7 +6,7 @@ * Copyright 2002, Tim Potter * Copyright 1999, Andrew Tridgell * - * $Id: packet-http.c,v 1.59 2002/11/08 05:06:36 guy Exp $ + * $Id: packet-http.c,v 1.60 2002/12/02 23:43:26 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -428,7 +428,7 @@ is_http_request_or_reply(const guchar *data, int linelen, http_type_t *type) *type = HTTP_RESPONSE; isHttpRequestOrReply = TRUE; /* response */ } else { - guchar * ptr = (guchar *)data; + const guchar * ptr = (const guchar *)data; int index = 0; /* Look for the space following the Method */ diff --git a/packet-icmpv6.c b/packet-icmpv6.c index a003f2b82b..3b311f0f6c 100644 --- a/packet-icmpv6.c +++ b/packet-icmpv6.c @@ -1,7 +1,7 @@ /* packet-icmpv6.c * Routines for ICMPv6 packet disassembly * - * $Id: packet-icmpv6.c,v 1.67 2002/08/28 21:00:17 jmayer Exp $ + * $Id: packet-icmpv6.c,v 1.68 2002/12/02 23:43:26 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1268,7 +1268,7 @@ dissect_icmpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) (guint16)g_ntohs(dp->icmp6_maxdelay)); proto_tree_add_text(icmp6_tree, tvb, offset + sizeof(*dp), 16, "Multicast Address: %s", - ip6_to_str((struct e_in6_addr *)(tvb_get_ptr(tvb, offset + sizeof *dp, sizeof (struct e_in6_addr))))); + ip6_to_str((const struct e_in6_addr *)(tvb_get_ptr(tvb, offset + sizeof *dp, sizeof (struct e_in6_addr))))); break; case ND_ROUTER_SOLICIT: dissect_icmpv6opt(tvb, offset + sizeof(*dp), pinfo, icmp6_tree); diff --git a/packet-ipx.c b/packet-ipx.c index 76ef80bb41..e24bc9f7b1 100644 --- a/packet-ipx.c +++ b/packet-ipx.c @@ -2,7 +2,7 @@ * Routines for NetWare's IPX * Gilbert Ramirez * - * $Id: packet-ipx.c,v 1.116 2002/10/19 01:17:13 guy Exp $ + * $Id: packet-ipx.c,v 1.117 2002/12/02 23:43:26 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -886,9 +886,9 @@ dissect_ipxsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_tree_add_text(s_tree, tvb, cursor, 2, "Server Type: %s (0x%04X)", server_type(server.server_type), server.server_type); proto_tree_add_text(s_tree, tvb, cursor+50, 4, "Network: %s", - ipxnet_to_string((guint8*)tvb_get_ptr(tvb, cursor+50, 4))); + ipxnet_to_string(tvb_get_ptr(tvb, cursor+50, 4))); proto_tree_add_text(s_tree, tvb, cursor+54, 6, "Node: %s", - ether_to_str((guint8*)tvb_get_ptr(tvb, cursor+54, 6))); + ether_to_str(tvb_get_ptr(tvb, cursor+54, 6))); proto_tree_add_text(s_tree, tvb, cursor+60, 2, "Socket: %s (0x%04x)", socket_text(server.server_port), server.server_port); proto_tree_add_text(s_tree, tvb, cursor+62, 2, diff --git a/packet-iscsi.c b/packet-iscsi.c index 9cbbbdefa0..00a2168408 100644 --- a/packet-iscsi.c +++ b/packet-iscsi.c @@ -2,7 +2,7 @@ * Routines for iSCSI dissection * Copyright 2001, Eurologic and Mark Burton * - * $Id: packet-iscsi.c,v 1.41 2002/11/14 19:08:17 guy Exp $ + * $Id: packet-iscsi.c,v 1.42 2002/12/02 23:43:26 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -588,7 +588,7 @@ static guint32 crc32Table[256] = { static guint32 calculateCRC32(const void *buf, int len, guint32 crc) { - guint8 *p = (guint8 *)buf; + const guint8 *p = (const guint8 *)buf; crc = CRC32C_SWAP(crc); while(len-- > 0) crc = crc32Table[(crc ^ *p++) & 0xff] ^ (crc >> 8); @@ -601,8 +601,8 @@ calculateCRC32(const void *buf, int len, guint32 crc) { static gint iscsi_equal(gconstpointer v, gconstpointer w) { - iscsi_conv_key_t *v1 = (iscsi_conv_key_t *)v; - iscsi_conv_key_t *v2 = (iscsi_conv_key_t *)w; + const iscsi_conv_key_t *v1 = (const iscsi_conv_key_t *)v; + const iscsi_conv_key_t *v2 = (const iscsi_conv_key_t *)w; return (v1->conv_idx == v2->conv_idx); } @@ -610,7 +610,7 @@ iscsi_equal(gconstpointer v, gconstpointer w) static guint iscsi_hash (gconstpointer v) { - iscsi_conv_key_t *key = (iscsi_conv_key_t *)v; + const iscsi_conv_key_t *key = (const iscsi_conv_key_t *)v; guint val; val = key->conv_idx; @@ -856,7 +856,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off if (opcode != ISCSI_OPCODE_SCSI_COMMAND) { - col_append_str(pinfo->cinfo, COL_INFO, (char *)opcode_str); + col_append_str(pinfo->cinfo, COL_INFO, opcode_str); if (opcode == ISCSI_OPCODE_SCSI_RESPONSE || (opcode == ISCSI_OPCODE_SCSI_DATA_IN && @@ -912,7 +912,7 @@ dissect_iscsi_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint off /* create display subtree for the protocol */ tp = proto_tree_add_protocol_format(tree, proto_iscsi, tvb, offset, -1, "iSCSI (%s)", - (char *)opcode_str); + opcode_str); ti = proto_item_add_subtree(tp, ett_iscsi); proto_tree_add_uint(ti, hf_iscsi_Opcode, tvb, diff --git a/packet-lmp.c b/packet-lmp.c index ae4c5e05c9..54dbeab46b 100644 --- a/packet-lmp.c +++ b/packet-lmp.c @@ -3,7 +3,7 @@ * * (c) Copyright Ashok Narayanan * - * $Id: packet-lmp.c,v 1.13 2002/10/17 01:29:30 guy Exp $ + * $Id: packet-lmp.c,v 1.14 2002/12/02 23:43:26 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -953,9 +953,9 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case 2: proto_item_append_text(ti, ": IPv6 %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); proto_tree_add_text(lmp_object_tree, tvb, offset2, 16, "IPv6: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); break; case 3: l = (class == LMP_CLASS_LOCAL_LINK_ID) ? @@ -984,9 +984,9 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case 2: proto_item_append_text(ti, ": IPv6 %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); proto_tree_add_text(lmp_object_tree, tvb, offset2, 16, "IPv6: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); break; case 3: l = (class == LMP_CLASS_LOCAL_INTERFACE_ID) ? @@ -1143,12 +1143,12 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case 2: proto_item_append_text(ti, ": IPv6: Local %s, Remote %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2+4, 16)), - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2+8, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2+4, 16)), + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2+8, 16))); proto_tree_add_text(lmp_object_tree, tvb, offset2+4, 16, "TE-Link Local ID - IPv6: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); proto_tree_add_text(lmp_object_tree, tvb, offset2+20,16, "TE-Link Remote ID - IPv6: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2+4, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2+4, 16))); break; case 3: proto_item_append_text(ti, ": Unnumbered: Local %d, Remote %d", @@ -1192,14 +1192,14 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case 2: proto_item_append_text(ti, ": IPv6: Local %s, Remote %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2+4, 16)), - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2+8, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2+4, 16)), + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2+8, 16))); proto_tree_add_text(lmp_object_tree, tvb, offset2+4, 16, "Data-Link Local ID - IPv6: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); proto_tree_add_text(lmp_object_tree, tvb, offset2+20,16, "Data-Link Remote ID - IPv6: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2+4, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2+4, 16))); l = 36; break; case 3: @@ -1299,11 +1299,11 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case 2: if (j < 4) proto_item_append_text(ti, ": [IPv6-%s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2+l, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2+l, 16))); proto_item_append_text(ti2, ": IPv6 %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2+l, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2+l, 16))); proto_tree_add_text(lmp_subobj_tree, tvb, offset2, 16, "Interface ID: IPv6: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2+l, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2+l, 16))); l += 16; break; case 3: @@ -1358,7 +1358,7 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; case 2: proto_tree_add_text(lmp_object_tree, tvb, offset2+l, 16, "Interface ID: IPv6: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2+l,16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2+l,16))); l += 16; break; case 3: diff --git a/packet-m2tp.c b/packet-m2tp.c index 0052394449..715e1a6248 100644 --- a/packet-m2tp.c +++ b/packet-m2tp.c @@ -5,7 +5,7 @@ * * Copyright 2001, Heinz Prantner * - * $Id: packet-m2tp.c,v 1.4 2002/08/28 21:00:20 jmayer Exp $ + * $Id: packet-m2tp.c,v 1.5 2002/12/02 23:43:26 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -335,12 +335,12 @@ static void dissect_m2tp_info_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item) { guint16 length, info_string_length; - char *info_string; + const char *info_string; if (parameter_tree) { length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET); info_string_length = length - PARAMETER_HEADER_LENGTH; - info_string = (char *)tvb_get_ptr(parameter_tvb, INFO_STRING_OFFSET, info_string_length); + info_string = (const char *)tvb_get_ptr(parameter_tvb, INFO_STRING_OFFSET, info_string_length); proto_tree_add_string(parameter_tree, hf_m2tp_info_string, parameter_tvb, INFO_STRING_OFFSET, info_string_length, info_string); proto_item_set_text(parameter_item, "Info String (%.*s)", info_string_length, info_string); } diff --git a/packet-m2ua.c b/packet-m2ua.c index 6880f9331f..9244307830 100644 --- a/packet-m2ua.c +++ b/packet-m2ua.c @@ -6,9 +6,9 @@ * - provide better handling of length parameters * - provide good information in summary window * - * Copyright 2002, Michael Tuexen + * Copyright 2002, Michael Tuexen * - * $Id: packet-m2ua.c,v 1.4 2002/08/28 21:00:20 jmayer Exp $ + * $Id: packet-m2ua.c,v 1.5 2002/12/02 23:43:26 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -307,12 +307,12 @@ static void dissect_m2ua_interface_identifier_text_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item) { guint16 length, id_length; - char *id; + const char *id; length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET); id_length = length - PARAMETER_HEADER_LENGTH; - id = (char *)tvb_get_ptr(parameter_tvb, INTERFACE_IDENTIFIER_TEXT_OFFSET, id_length); + id = (const char *)tvb_get_ptr(parameter_tvb, INTERFACE_IDENTIFIER_TEXT_OFFSET, id_length); proto_tree_add_string(parameter_tree, hf_m2ua_interface_id_text, parameter_tvb, INTERFACE_IDENTIFIER_TEXT_OFFSET, id_length, id); proto_item_set_text(parameter_item, "Interface identifier (Text: %.*s)", id_length, id); } @@ -323,12 +323,12 @@ static void dissect_m2ua_info_string_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item) { guint16 length, info_string_length; - char *info_string; + const char *info_string; length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET); info_string_length = length - PARAMETER_HEADER_LENGTH; - info_string = (char *)tvb_get_ptr(parameter_tvb, INFO_STRING_OFFSET, info_string_length); + info_string = (const char *)tvb_get_ptr(parameter_tvb, INFO_STRING_OFFSET, info_string_length); proto_tree_add_string(parameter_tree, hf_m2ua_info_string, parameter_tvb, INFO_STRING_OFFSET, info_string_length, info_string); proto_item_set_text(parameter_item, "Info String (%.*s)", info_string_length, info_string); } diff --git a/packet-m3ua.c b/packet-m3ua.c index 36de6e4cde..456e06a739 100644 --- a/packet-m3ua.c +++ b/packet-m3ua.c @@ -7,9 +7,9 @@ * - provide better handling of length parameters * - provide good information in summary window * - * Copyright 2000, 2001, 2002, Michael Tuexen + * Copyright 2000, 2001, 2002, Michael Tuexen * - * $Id: packet-m3ua.c,v 1.21 2002/08/28 21:00:20 jmayer Exp $ + * $Id: packet-m3ua.c,v 1.22 2002/12/02 23:43:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -432,12 +432,12 @@ static void dissect_m3ua_info_string_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item) { guint16 length, info_string_length; - char *info_string; + const char *info_string; length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET); info_string_length = length - PARAMETER_HEADER_LENGTH; - info_string = (char *)tvb_get_ptr(parameter_tvb, INFO_STRING_OFFSET, info_string_length); + info_string = (const char *)tvb_get_ptr(parameter_tvb, INFO_STRING_OFFSET, info_string_length); proto_tree_add_string(parameter_tree, hf_m3ua_info_string, parameter_tvb, INFO_STRING_OFFSET, info_string_length, info_string); proto_item_set_text(parameter_item, "Info String (%.*s)", info_string_length, info_string); } diff --git a/packet-ncp2222.inc b/packet-ncp2222.inc index e3e7f9f4d1..5215330f1a 100644 --- a/packet-ncp2222.inc +++ b/packet-ncp2222.inc @@ -8,7 +8,7 @@ * Gilbert Ramirez * Modified to decode NDS packets by Greg Morris * - * $Id: packet-ncp2222.inc,v 1.46 2002/10/22 08:24:39 guy Exp $ + * $Id: packet-ncp2222.inc,v 1.47 2002/12/02 23:43:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -580,8 +580,8 @@ static GMemChunk *ncp_req_hash_values = NULL; gint ncp_equal(gconstpointer v, gconstpointer v2) { - ncp_req_hash_key *val1 = (ncp_req_hash_key*)v; - ncp_req_hash_key *val2 = (ncp_req_hash_key*)v2; + const ncp_req_hash_key *val1 = (const ncp_req_hash_key*)v; + const ncp_req_hash_key *val2 = (const ncp_req_hash_key*)v2; if (val1->conversation == val2->conversation && val1->nw_sequence == val2->nw_sequence ) { @@ -593,8 +593,8 @@ ncp_equal(gconstpointer v, gconstpointer v2) gint ncp_eid_equal(gconstpointer v, gconstpointer v2) { - ncp_req_eid_hash_key *val1 = (ncp_req_eid_hash_key*)v; - ncp_req_eid_hash_key *val2 = (ncp_req_eid_hash_key*)v2; + const ncp_req_eid_hash_key *val1 = (const ncp_req_eid_hash_key*)v; + const ncp_req_eid_hash_key *val2 = (const ncp_req_eid_hash_key*)v2; if (val1->nw_eid == val2->nw_eid ) { return 1; @@ -605,14 +605,14 @@ ncp_eid_equal(gconstpointer v, gconstpointer v2) guint ncp_hash(gconstpointer v) { - ncp_req_hash_key *ncp_key = (ncp_req_hash_key*)v; + const ncp_req_hash_key *ncp_key = (const ncp_req_hash_key*)v; return GPOINTER_TO_UINT(ncp_key->conversation) + ncp_key->nw_sequence; } guint ncp_eid_hash(gconstpointer v) { - ncp_req_eid_hash_key *ncp_eid_key = (ncp_req_eid_hash_key*)v; + const ncp_req_eid_hash_key *ncp_eid_key = (const ncp_req_eid_hash_key*)v; return GPOINTER_TO_UINT(ncp_eid_key->nw_eid); } @@ -1418,7 +1418,7 @@ return; * %s = string = 2 **************************************/ int -get_info_type(gchar* check_string) +get_info_type(const gchar* check_string) { guint length; guint i; @@ -4199,38 +4199,38 @@ dissect_ncp_request(tvbuff_t *tvb, packet_info *pinfo, finfo = g_ptr_array_index(parray, 0); - info_type = get_info_type((gchar*) ncp_rec->req_info_str->first_string); + info_type = get_info_type((const gchar*) ncp_rec->req_info_str->first_string); if (info_type == 2) { /* Is this a string or not? */ col_append_fstr(pinfo->cinfo, COL_INFO, - (gchar*) ncp_rec->req_info_str->first_string, + (const gchar*) ncp_rec->req_info_str->first_string, fvalue_get(finfo->value)); } else { col_append_fstr(pinfo->cinfo, COL_INFO, - (gchar*) ncp_rec->req_info_str->first_string, + (const gchar*) ncp_rec->req_info_str->first_string, fvalue_get_integer(finfo->value)); } } if (len > 1) { for (i = 1; i < len; i++) { finfo = g_ptr_array_index(parray, i); - info_type = get_info_type((gchar*) ncp_rec->req_info_str->repeat_string); + info_type = get_info_type((const gchar*) ncp_rec->req_info_str->repeat_string); if (info_type == 2) { /* Is this a string or not? */ col_append_fstr(pinfo->cinfo, COL_INFO, - (gchar*) ncp_rec->req_info_str->repeat_string, + (const gchar*) ncp_rec->req_info_str->repeat_string, fvalue_get(finfo->value)); } else { col_append_fstr(pinfo->cinfo, COL_INFO, - (gchar*) ncp_rec->req_info_str->repeat_string, + (const gchar*) ncp_rec->req_info_str->repeat_string, fvalue_get_integer(finfo->value)); } } diff --git a/packet-ndps.c b/packet-ndps.c index 10750179bf..7090f770fd 100644 --- a/packet-ndps.c +++ b/packet-ndps.c @@ -2,7 +2,7 @@ * Routines for NetWare's NDPS * Greg Morris * - * $Id: packet-ndps.c,v 1.9 2002/10/22 08:09:57 guy Exp $ + * $Id: packet-ndps.c,v 1.10 2002/12/02 23:43:27 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1750,8 +1750,8 @@ static GMemChunk *ndps_req_hash_values = NULL; gint ndps_equal(gconstpointer v, gconstpointer v2) { - ndps_req_hash_key *val1 = (ndps_req_hash_key*)v; - ndps_req_hash_key *val2 = (ndps_req_hash_key*)v2; + const ndps_req_hash_key *val1 = (const ndps_req_hash_key*)v; + const ndps_req_hash_key *val2 = (const ndps_req_hash_key*)v2; if (val1->conversation == val2->conversation && val1->ndps_xid == val2->ndps_xid ) { @@ -1763,7 +1763,7 @@ ndps_equal(gconstpointer v, gconstpointer v2) guint ndps_hash(gconstpointer v) { - ndps_req_hash_key *ndps_key = (ndps_req_hash_key*)v; + const ndps_req_hash_key *ndps_key = (const ndps_req_hash_key*)v; return GPOINTER_TO_UINT(ndps_key->conversation) + ndps_key->ndps_xid; } @@ -1947,7 +1947,7 @@ dissect_ndps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) foffset += 4; if (check_col(pinfo->cinfo, COL_INFO)) { - col_append_str(pinfo->cinfo, COL_INFO, (gchar*) ndps_program_string); + col_append_str(pinfo->cinfo, COL_INFO, (const gchar*) ndps_program_string); col_append_str(pinfo->cinfo, COL_INFO, ", "); } proto_tree_add_item(ndps_tree, hf_spx_ndps_version, tvb, foffset, 4, FALSE); @@ -1990,7 +1990,7 @@ dissect_ndps(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (ndps_func_string != NULL) { if (check_col(pinfo->cinfo, COL_INFO)) - col_append_str(pinfo->cinfo, COL_INFO, (gchar*) ndps_func_string); + col_append_str(pinfo->cinfo, COL_INFO, (const gchar*) ndps_func_string); foffset += 4; proto_tree_add_item(ndps_tree, hf_ndps_auth_null, tvb, foffset, 16, FALSE); diff --git a/packet-nfs.c b/packet-nfs.c index 26d4d04246..7fc755d27d 100644 --- a/packet-nfs.c +++ b/packet-nfs.c @@ -2,7 +2,7 @@ * Routines for nfs dissection * Copyright 1999, Uwe Girlich * Copyright 2000-2002, Mike Frisch (NFSv4 decoding) - * $Id: packet-nfs.c,v 1.83 2002/10/24 20:55:03 guy Exp $ + * $Id: packet-nfs.c,v 1.84 2002/12/02 23:43:28 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -400,8 +400,8 @@ GHashTable *nfs_fhandle_frame_table = NULL; static gint nfs_fhandle_data_equal(gconstpointer k1, gconstpointer k2) { - nfs_fhandle_data_t *key1 = (nfs_fhandle_data_t *)k1; - nfs_fhandle_data_t *key2 = (nfs_fhandle_data_t *)k2; + const nfs_fhandle_data_t *key1 = (const nfs_fhandle_data_t *)k1; + const nfs_fhandle_data_t *key2 = (const nfs_fhandle_data_t *)k2; return (key1->len==key2->len) &&(!memcmp(key1->fh, key2->fh, key1->len)); @@ -409,7 +409,7 @@ nfs_fhandle_data_equal(gconstpointer k1, gconstpointer k2) static guint nfs_fhandle_data_hash(gconstpointer k) { - nfs_fhandle_data_t *key = (nfs_fhandle_data_t *)k; + const nfs_fhandle_data_t *key = (const nfs_fhandle_data_t *)k; int i; int hash; @@ -506,7 +506,7 @@ typedef struct nfs_name_snoop { typedef struct nfs_name_snoop_key { int key; int fh_length; - unsigned char *fh; + const unsigned char *fh; } nfs_name_snoop_key_t; static GMemChunk *nfs_name_snoop_chunk = NULL; @@ -522,8 +522,8 @@ static GHashTable *nfs_name_snoop_known = NULL; static gint nfs_name_snoop_matched_equal(gconstpointer k1, gconstpointer k2) { - nfs_name_snoop_key_t *key1 = (nfs_name_snoop_key_t *)k1; - nfs_name_snoop_key_t *key2 = (nfs_name_snoop_key_t *)k2; + const nfs_name_snoop_key_t *key1 = (const nfs_name_snoop_key_t *)k1; + const nfs_name_snoop_key_t *key2 = (const nfs_name_snoop_key_t *)k2; return (key1->key==key2->key) &&(key1->fh_length==key2->fh_length) @@ -532,7 +532,7 @@ nfs_name_snoop_matched_equal(gconstpointer k1, gconstpointer k2) static guint nfs_name_snoop_matched_hash(gconstpointer k) { - nfs_name_snoop_key_t *key = (nfs_name_snoop_key_t *)k; + const nfs_name_snoop_key_t *key = (const nfs_name_snoop_key_t *)k; int i; guint hash; @@ -639,11 +639,11 @@ void nfs_name_snoop_add_name(int xid, tvbuff_t *tvb, int name_offset, int name_len, int parent_offset, int parent_len, unsigned char *name) { nfs_name_snoop_t *nns, *old_nns; - unsigned char *ptr=NULL; + const unsigned char *ptr=NULL; /* filter out all '.' and '..' names */ if(!name){ - ptr=(unsigned char *)tvb_get_ptr(tvb, name_offset, name_len); + ptr=(const unsigned char *)tvb_get_ptr(tvb, name_offset, name_len); if(ptr[0]=='.'){ if(ptr[1]==0){ return; @@ -707,6 +707,7 @@ nfs_name_snoop_add_name(int xid, tvbuff_t *tvb, int name_offset, int name_len, i static void nfs_name_snoop_add_fh(int xid, tvbuff_t *tvb, int fh_offset, int fh_length) { + unsigned char *fh; nfs_name_snoop_t *nns, *old_nns; nfs_name_snoop_key_t *key; @@ -723,8 +724,9 @@ nfs_name_snoop_add_fh(int xid, tvbuff_t *tvb, int fh_offset, int fh_length) } /* oki, we have a new entry */ - nns->fh=g_malloc(fh_length); - memcpy(nns->fh, tvb_get_ptr(tvb, fh_offset, fh_length), fh_length); + fh=g_malloc(fh_length); + memcpy(fh, tvb_get_ptr(tvb, fh_offset, fh_length), fh_length); + nns->fh=fh; nns->fh_length=fh_length; key=g_mem_chunk_alloc(nfs_name_snoop_key_chunk); @@ -800,7 +802,7 @@ nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_of if(!pinfo->fd->flags.visited){ key.key=0; key.fh_length=fh_length; - key.fh=(unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_length); + key.fh=(const unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_length); nns=g_hash_table_lookup(nfs_name_snoop_matched, &key); if(nns){ @@ -828,7 +830,7 @@ nfs_name_snoop_fh(packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int fh_of if(!nns){ key.key=pinfo->fd->num; key.fh_length=fh_length; - key.fh=(unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_length); + key.fh=(const unsigned char *)tvb_get_ptr(tvb, fh_offset, fh_length); nns=g_hash_table_lookup(nfs_name_snoop_known, &key); } @@ -1390,21 +1392,23 @@ dissect_fhandle_data(tvbuff_t *tvb, int offset, packet_info *pinfo, of an RPC call */ if(nfs_fhandle_reqrep_matching && (!hidden) ){ nfs_fhandle_data_t *old_fhd=NULL; + unsigned char *fh; if( !pinfo->fd->flags.visited ){ nfs_fhandle_data_t fhd; /* first check if we have seen this fhandle before */ fhd.len=fhlen; - fhd.fh=(unsigned char *)tvb_get_ptr(tvb, offset, fhlen); + fhd.fh=(const unsigned char *)tvb_get_ptr(tvb, offset, fhlen); old_fhd=g_hash_table_lookup(nfs_fhandle_data_table, (gconstpointer)&fhd); if(!old_fhd){ /* oh, a new fhandle, alloc struct and store it in the table*/ old_fhd=g_mem_chunk_alloc(nfs_fhandle_data_chunk); old_fhd->len=fhlen; - old_fhd->fh=g_malloc(fhlen); - memcpy(old_fhd->fh, fhd.fh, fhlen); + fh=g_malloc(fhlen); + memcpy(fh, fhd.fh, fhlen); + old_fhd->fh=fh; old_fhd->tvb=tvb_new_real_data(old_fhd->fh, old_fhd->len, old_fhd->len); g_hash_table_insert(nfs_fhandle_data_table, (gpointer)old_fhd, (gpointer)old_fhd); diff --git a/packet-nfs.h b/packet-nfs.h index 77cbfc688f..f5cb33f367 100644 --- a/packet-nfs.h +++ b/packet-nfs.h @@ -1,5 +1,5 @@ /* packet-nfs.h (c) 1999 Uwe Girlich */ -/* $Id: packet-nfs.h,v 1.11 2002/05/21 21:13:42 guy Exp $ */ +/* $Id: packet-nfs.h,v 1.12 2002/12/02 23:43:28 guy Exp $ */ #ifndef __PACKET_NFS_H__ #define __PACKET_NFS_H__ @@ -110,7 +110,7 @@ extern gboolean nfs_fhandle_reqrep_matching; extern GHashTable *nfs_fhandle_frame_table; typedef struct nfs_fhandle_data { int len; - unsigned char *fh; + const unsigned char *fh; tvbuff_t *tvb; } nfs_fhandle_data_t; void dissect_fhandle_hidden(packet_info *pinfo, proto_tree *tree, nfs_fhandle_data_t *nfd); diff --git a/packet-nlm.c b/packet-nlm.c index f597dd44a9..7f52dce1b7 100644 --- a/packet-nlm.c +++ b/packet-nlm.c @@ -1,7 +1,7 @@ /* packet-nlm.c * Routines for nlm dissection * - * $Id: packet-nlm.c,v 1.31 2002/11/01 00:48:38 sahlberg Exp $ + * $Id: packet-nlm.c,v 1.32 2002/12/02 23:43:28 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -108,7 +108,7 @@ typedef struct _nlm_msg_res_unmatched_data { int req_frame; nstime_t ns; int cookie_len; - char *cookie; + const char *cookie; } nlm_msg_res_unmatched_data; typedef struct _nlm_msg_res_matched_data { @@ -140,7 +140,7 @@ nlm_msg_res_matched_free_all(gpointer key_arg _U_, gpointer value, gpointer user static guint nlm_msg_res_unmatched_hash(gconstpointer k) { - nlm_msg_res_unmatched_data *umd = (nlm_msg_res_unmatched_data *)k; + const nlm_msg_res_unmatched_data *umd = (const nlm_msg_res_unmatched_data *)k; guint8 hash=0; int i; @@ -161,8 +161,8 @@ nlm_msg_res_matched_hash(gconstpointer k) static gint nlm_msg_res_unmatched_equal(gconstpointer k1, gconstpointer k2) { - nlm_msg_res_unmatched_data *umd1 = (nlm_msg_res_unmatched_data *)k1; - nlm_msg_res_unmatched_data *umd2 = (nlm_msg_res_unmatched_data *)k2; + const nlm_msg_res_unmatched_data *umd1 = (const nlm_msg_res_unmatched_data *)k1; + const nlm_msg_res_unmatched_data *umd2 = (const nlm_msg_res_unmatched_data *)k2; if(umd1->cookie_len!=umd2->cookie_len){ return 0; @@ -271,7 +271,7 @@ nlm_register_unmatched_res(packet_info *pinfo, tvbuff_t *tvb, int offset) nlm_msg_res_unmatched_data *old_umd; umd.cookie_len=tvb_get_ntohl(tvb, offset); - umd.cookie=(char *)tvb_get_ptr(tvb, offset+4, -1); + umd.cookie=(const char *)tvb_get_ptr(tvb, offset+4, -1); /* have we seen this cookie before? */ old_umd=g_hash_table_lookup(nlm_msg_res_unmatched, (gconstpointer)&umd); @@ -296,6 +296,7 @@ nlm_register_unmatched_msg(packet_info *pinfo, tvbuff_t *tvb, int offset) { nlm_msg_res_unmatched_data *umd; nlm_msg_res_unmatched_data *old_umd; + char *cookie; /* allocate and build the unmatched structure for this request */ umd=g_malloc(sizeof(nlm_msg_res_unmatched_data)); @@ -303,8 +304,9 @@ nlm_register_unmatched_msg(packet_info *pinfo, tvbuff_t *tvb, int offset) umd->ns.secs=pinfo->fd->abs_secs; umd->ns.nsecs=pinfo->fd->abs_usecs*1000; umd->cookie_len=tvb_get_ntohl(tvb, offset); - umd->cookie=g_malloc(umd->cookie_len); - tvb_memcpy(tvb, (guint8 *)umd->cookie, offset+4, umd->cookie_len); + cookie=g_malloc(umd->cookie_len); + tvb_memcpy(tvb, (guint8 *)cookie, offset+4, umd->cookie_len); + umd->cookie=cookie; /* remove any old duplicates */ old_umd=g_hash_table_lookup(nlm_msg_res_unmatched, (gconstpointer)umd); diff --git a/packet-null.c b/packet-null.c index f659a0e590..bd4c346f49 100644 --- a/packet-null.c +++ b/packet-null.c @@ -1,7 +1,7 @@ /* packet-null.c * Routines for null packet disassembly * - * $Id: packet-null.c,v 1.56 2002/08/28 21:00:24 jmayer Exp $ + * $Id: packet-null.c,v 1.57 2002/12/02 23:43:28 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -173,7 +173,7 @@ capture_null( const guchar *pd, int len, packet_counts *ld ) ld->other++; return; } - memcpy((char *)&null_header, (char *)&pd[0], sizeof(null_header)); + memcpy((char *)&null_header, (const char *)&pd[0], sizeof(null_header)); if ((null_header & 0xFFFF0000) != 0) { /* Byte-swap it. */ diff --git a/packet-ospf.c b/packet-ospf.c index f992589ab9..2f87ff290e 100644 --- a/packet-ospf.c +++ b/packet-ospf.c @@ -2,7 +2,7 @@ * Routines for OSPF packet disassembly * (c) Copyright Hannes R. Boehm * - * $Id: packet-ospf.c,v 1.72 2002/11/27 19:10:51 guy Exp $ + * $Id: packet-ospf.c,v 1.73 2002/12/02 23:43:28 guy Exp $ * * At this time, this module is able to analyze OSPF * packets as specified in RFC2328. MOSPF (RFC1584) and other @@ -1766,7 +1766,7 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree, /* Forwarding Address (optional - only if F-flag is on) */ if ( (offset < end_offset) && (flags & OSPF_V3_AS_EXTERNAL_FLAG_F) ) { proto_tree_add_text(ospf_lsa_tree, tvb, offset, 16,"Forwarding Address: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset, 16))); offset+=16; } @@ -1800,7 +1800,7 @@ dissect_ospf_v3_lsa(tvbuff_t *tvb, int offset, proto_tree *tree, /* Link-local Interface Address */ proto_tree_add_text(ospf_lsa_tree, tvb, offset + 4, 16, "Link-local Interface Address: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, 16))); /* Number prefixes */ number_prefixes=tvb_get_ntohl(tvb, offset + 20); diff --git a/packet-pim.c b/packet-pim.c index 840fd27ad6..f5a2988e5b 100644 --- a/packet-pim.c +++ b/packet-pim.c @@ -2,7 +2,7 @@ * Routines for PIM disassembly * (c) Copyright Jun-ichiro itojun Hagino * - * $Id: packet-pim.c,v 1.42 2002/08/28 21:00:25 jmayer Exp $ + * $Id: packet-pim.c,v 1.43 2002/12/02 23:43:28 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -521,7 +521,7 @@ dissect_pim_addr(tvbuff_t *tvb, int offset, enum pimv2_addrtype at, case AFNUM_INET6: len = 16; (void)snprintf(buf, sizeof(buf), "%s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset + 2, len))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset + 2, len))); break; } if (advance) @@ -540,7 +540,7 @@ dissect_pim_addr(tvbuff_t *tvb, int offset, enum pimv2_addrtype at, case AFNUM_INET6: len = 16; (void)snprintf(buf, sizeof(buf), "%s/%u", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, len)), mask_len); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, len)), mask_len); break; } if (advance) @@ -560,7 +560,7 @@ dissect_pim_addr(tvbuff_t *tvb, int offset, enum pimv2_addrtype at, case AFNUM_INET6: len = 16; (void)snprintf(buf, sizeof(buf), "%s/%u", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, len)), mask_len); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset + 4, len)), mask_len); break; } if (flags) { diff --git a/packet-radius.c b/packet-radius.c index 46c1f0220d..6dd672ecc2 100644 --- a/packet-radius.c +++ b/packet-radius.c @@ -4,7 +4,7 @@ * * RFC 2865, RFC 2866, RFC 2867, RFC 2868, RFC 2869 * - * $Id: packet-radius.c,v 1.68 2002/08/28 21:00:28 jmayer Exp $ + * $Id: packet-radius.c,v 1.69 2002/12/02 23:43:28 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -2425,7 +2425,7 @@ static gchar *rdconvertinttostr(gchar *dest, int print_type, guint32 val) * * At last, forgive me if I've messed up some indentation... * */ -static gchar *rd_value_to_str_2(gchar *dest, e_avphdr *avph, tvbuff_t *tvb, +static gchar *rd_value_to_str_2(gchar *dest, const e_avphdr *avph, tvbuff_t *tvb, int offset, const value_value_string *vvs, proto_tree *tree) { int print_type; @@ -2452,7 +2452,7 @@ static gchar *rd_value_to_str_2(gchar *dest, e_avphdr *avph, tvbuff_t *tvb, int vsa_len; int vsa_index; rd_vsa_table *vsa_rvt; - e_avphdr *vsa_avph; + const e_avphdr *vsa_avph; /* prints the values of the attribute value pairs into a text buffer */ print_type = match_numval(avph->avp_type, vvs); @@ -2528,7 +2528,7 @@ static gchar *rd_value_to_str_2(gchar *dest, e_avphdr *avph, tvbuff_t *tvb, vsa_rvt = get_vsa_table(intval); do { - vsa_avph = (e_avphdr*)tvb_get_ptr(tvb, offset+vsa_len, + vsa_avph = (const e_avphdr*)tvb_get_ptr(tvb, offset+vsa_len, avph->avp_length-vsa_len); if (vsa_rvt) next_print_type = match_numval(vsa_avph->avp_type, diff --git a/packet-rpc.c b/packet-rpc.c index 7fb0747ff8..8aebe99618 100644 --- a/packet-rpc.c +++ b/packet-rpc.c @@ -2,7 +2,7 @@ * Routines for rpc dissection * Copyright 1999, Uwe Girlich * - * $Id: packet-rpc.c,v 1.110 2002/11/23 03:38:00 guy Exp $ + * $Id: packet-rpc.c,v 1.111 2002/12/02 23:43:28 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -244,8 +244,8 @@ static void dissect_rpc_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) static gint rpc_proc_equal(gconstpointer k1, gconstpointer k2) { - rpc_proc_info_key* key1 = (rpc_proc_info_key*) k1; - rpc_proc_info_key* key2 = (rpc_proc_info_key*) k2; + const rpc_proc_info_key* key1 = (const rpc_proc_info_key*) k1; + const rpc_proc_info_key* key2 = (const rpc_proc_info_key*) k2; return ((key1->prog == key2->prog && key1->vers == key2->vers && @@ -257,7 +257,7 @@ rpc_proc_equal(gconstpointer k1, gconstpointer k2) static guint rpc_proc_hash(gconstpointer k) { - rpc_proc_info_key* key = (rpc_proc_info_key*) k; + const rpc_proc_info_key* key = (const rpc_proc_info_key*) k; return (key->prog ^ (key->vers<<16) ^ (key->proc<<24)); } @@ -337,8 +337,8 @@ char *rpc_proc_name(guint32 prog, guint32 vers, guint32 proc) static gint rpc_prog_equal(gconstpointer k1, gconstpointer k2) { - rpc_prog_info_key* key1 = (rpc_prog_info_key*) k1; - rpc_prog_info_key* key2 = (rpc_prog_info_key*) k2; + const rpc_prog_info_key* key1 = (const rpc_prog_info_key*) k1; + const rpc_prog_info_key* key2 = (const rpc_prog_info_key*) k2; return ((key1->prog == key2->prog) ? TRUE : FALSE); @@ -349,7 +349,7 @@ rpc_prog_equal(gconstpointer k1, gconstpointer k2) static guint rpc_prog_hash(gconstpointer k) { - rpc_prog_info_key* key = (rpc_prog_info_key*) k; + const rpc_prog_info_key* key = (const rpc_prog_info_key*) k; return (key->prog); } @@ -414,8 +414,8 @@ static GHashTable *rpc_indir_calls; static gint rpc_call_equal(gconstpointer k1, gconstpointer k2) { - rpc_call_info_key* key1 = (rpc_call_info_key*) k1; - rpc_call_info_key* key2 = (rpc_call_info_key*) k2; + const rpc_call_info_key* key1 = (const rpc_call_info_key*) k1; + const rpc_call_info_key* key2 = (const rpc_call_info_key*) k2; return (key1->xid == key2->xid && key1->conversation == key2->conversation); @@ -426,7 +426,7 @@ rpc_call_equal(gconstpointer k1, gconstpointer k2) static guint rpc_call_hash(gconstpointer k) { - rpc_call_info_key* key = (rpc_call_info_key*) k; + const rpc_call_info_key* key = (const rpc_call_info_key*) k; return key->xid + (guint32)(key->conversation); } @@ -2302,7 +2302,7 @@ typedef struct _rpc_fragment_key { static guint rpc_fragment_hash(gconstpointer k) { - rpc_fragment_key *key = (rpc_fragment_key *)k; + const rpc_fragment_key *key = (const rpc_fragment_key *)k; return key->conv_id + key->seq; } @@ -2310,8 +2310,8 @@ rpc_fragment_hash(gconstpointer k) static gint rpc_fragment_equal(gconstpointer k1, gconstpointer k2) { - rpc_fragment_key *key1 = (rpc_fragment_key *)k1; - rpc_fragment_key *key2 = (rpc_fragment_key *)k2; + const rpc_fragment_key *key1 = (const rpc_fragment_key *)k1; + const rpc_fragment_key *key2 = (const rpc_fragment_key *)k2; return key1->conv_id == key2->conv_id && key1->seq == key2->seq; diff --git a/packet-rsvp.c b/packet-rsvp.c index 848b1fd499..a9b9e6b6cd 100644 --- a/packet-rsvp.c +++ b/packet-rsvp.c @@ -3,7 +3,7 @@ * * (c) Copyright Ashok Narayanan * - * $Id: packet-rsvp.c,v 1.77 2002/10/24 03:04:51 guy Exp $ + * $Id: packet-rsvp.c,v 1.78 2002/12/02 23:43:29 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1067,7 +1067,7 @@ dissect_rsvp_session (proto_tree *ti, tvbuff_t *tvb, "C-type: 2 - IPv6"); proto_tree_add_text(rsvp_object_tree, tvb, offset2, 16, "Destination address: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); proto_tree_add_text(rsvp_object_tree, tvb, offset2+16, 1, "Protocol: %u", tvb_get_guint8(tvb, offset2+16)); @@ -1245,7 +1245,7 @@ dissect_rsvp_hop (proto_tree *ti, tvbuff_t *tvb, "C-type: 2 - IPv6"); proto_tree_add_text(rsvp_object_tree, tvb, offset2, 16, "Neighbor address: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); proto_tree_add_text(rsvp_object_tree, tvb, offset2+16, 4, "Logical interface: 0x%08x", tvb_get_ntohl(tvb, offset2+16)); @@ -1369,7 +1369,7 @@ dissect_rsvp_error (proto_tree *ti, tvbuff_t *tvb, "C-type: 2 - IPv6"); proto_tree_add_text(rsvp_object_tree, tvb, offset2, 16, "Error node: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); proto_tree_add_text(rsvp_object_tree, tvb, offset2+16, 1, "Flags: 0x%02x", tvb_get_guint8(tvb, offset2+16)); @@ -1463,7 +1463,7 @@ dissect_rsvp_scope (proto_tree *ti, tvbuff_t *tvb, while (mylen > 0) { proto_tree_add_text(rsvp_object_tree, tvb, offset2, 16, "IPv6 Address: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); offset2 += 16; mylen -= 16; } @@ -1561,7 +1561,7 @@ dissect_rsvp_confirm (proto_tree *ti, tvbuff_t *tvb, "C-type: 2 - IPv6"); proto_tree_add_text(rsvp_object_tree, tvb, offset2, 16, "Receiver address: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); break; } @@ -1625,7 +1625,7 @@ dissect_rsvp_template_filter (proto_tree *ti, tvbuff_t *tvb, "C-type: 2 - IPv6"); proto_tree_add_text(rsvp_object_tree, tvb, offset2, 16, "Source address: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset2, 16))); proto_tree_add_text(rsvp_object_tree, tvb, offset2+18, 2, "Source port: %u", tvb_get_ntohs(tvb, offset2+18)); @@ -2815,7 +2815,7 @@ dissect_rsvp_ero_rro_subobjects (proto_tree *ti, proto_tree *rsvp_object_tree, tvb_get_guint8(tvb, offset+l+1)); proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+2, 16, "IPv6 hop: %s", - ip6_to_str((struct e_in6_addr *)tvb_get_ptr(tvb, offset+l+2, 16))); + ip6_to_str((const struct e_in6_addr *)tvb_get_ptr(tvb, offset+l+2, 16))); proto_tree_add_text(rsvp_ro_subtree, tvb, offset+l+18, 1, "Prefix length: %u", tvb_get_guint8(tvb, offset+l+18)); diff --git a/packet-sap.c b/packet-sap.c index 0b114d5f53..854415290b 100644 --- a/packet-sap.c +++ b/packet-sap.c @@ -4,7 +4,7 @@ * * Heikki Vatiainen * - * $Id: packet-sap.c,v 1.30 2002/08/28 21:00:30 jmayer Exp $ + * $Id: packet-sap.c,v 1.31 2002/12/02 23:43:29 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -172,7 +172,7 @@ dissect_sap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) addr = tvb_get_ptr(tvb, offset, addr_len); proto_tree_add_text(sap_tree, tvb, offset, addr_len, "Originating Source: %s", - (is_ipv6) ? ip6_to_str((struct e_in6_addr*)addr) : ip_to_str(addr)); + (is_ipv6) ? ip6_to_str((const struct e_in6_addr*)addr) : ip_to_str(addr)); offset += addr_len; /* Authentication data lives in its own subtree */ diff --git a/packet-scsi.c b/packet-scsi.c index f5e720f586..d6d7322ec0 100644 --- a/packet-scsi.c +++ b/packet-scsi.c @@ -2,7 +2,7 @@ * Routines for decoding SCSI CDBs and responses * Author: Dinesh G Dutt (ddutt@cisco.com) * - * $Id: packet-scsi.c,v 1.21 2002/10/08 19:35:08 guy Exp $ + * $Id: packet-scsi.c,v 1.22 2002/12/02 23:43:29 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1206,8 +1206,8 @@ static dissector_handle_t data_handle; static gint scsi_equal(gconstpointer v, gconstpointer w) { - scsi_task_id_t *v1 = (scsi_task_id_t *)v; - scsi_task_id_t *v2 = (scsi_task_id_t *)w; + const scsi_task_id_t *v1 = (const scsi_task_id_t *)v; + const scsi_task_id_t *v2 = (const scsi_task_id_t *)w; return (v1->conv_id == v2->conv_id && v1->task_id == v2->task_id); } @@ -1215,7 +1215,7 @@ scsi_equal(gconstpointer v, gconstpointer w) static guint scsi_hash (gconstpointer v) { - scsi_task_id_t *key = (scsi_task_id_t *)v; + const scsi_task_id_t *key = (const scsi_task_id_t *)v; guint val; val = key->conv_id + key->task_id; @@ -1226,8 +1226,8 @@ scsi_hash (gconstpointer v) static gint scsidev_equal (gconstpointer v, gconstpointer w) { - scsi_devtype_key_t *k1 = (scsi_devtype_key_t *)v; - scsi_devtype_key_t *k2 = (scsi_devtype_key_t *)w; + const scsi_devtype_key_t *k1 = (const scsi_devtype_key_t *)v; + const scsi_devtype_key_t *k2 = (const scsi_devtype_key_t *)w; if (ADDRESSES_EQUAL (&k1->devid, &k2->devid)) return 1; @@ -1238,7 +1238,7 @@ scsidev_equal (gconstpointer v, gconstpointer w) static guint scsidev_hash (gconstpointer v) { - scsi_devtype_key_t *key = (scsi_devtype_key_t *)v; + const scsi_devtype_key_t *key = (const scsi_devtype_key_t *)v; guint val; int i; diff --git a/packet-sctp.c b/packet-sctp.c index 28b70b825a..356a0e2ab4 100644 --- a/packet-sctp.c +++ b/packet-sctp.c @@ -5,12 +5,12 @@ * - http://www.ietf.org/internet-drafts/draft-ietf-tsvwg-addip-sctp-06.txt for the add-IP extension * - http://www.ietf.org/internet-drafts/draft-stewart-tsvwg-prsctp-01.txt for the 'Partial Reliability' extension * - http://www.ietf.org/internet-drafts/draft-ietf-tsvwg-sctpcsum-07.txt - * Copyright 2000, 2001, 2002, Michael Tuexen + * Copyright 2000, 2001, 2002, Michael Tuexen * Still to do (so stay tuned) * - support for reassembly * - code cleanup * - * $Id: packet-sctp.c,v 1.42 2002/10/17 18:44:10 tuexen Exp $ + * $Id: packet-sctp.c,v 1.43 2002/12/02 23:43:29 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -751,12 +751,12 @@ static void dissect_hostname_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item) { guint16 length, hostname_length; - char *hostname; + const char *hostname; length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET); hostname_length = length - PARAMETER_HEADER_LENGTH; - hostname = (char *)tvb_get_ptr(parameter_tvb, PARAMETER_VALUE_OFFSET, hostname_length); + hostname = (const char *)tvb_get_ptr(parameter_tvb, PARAMETER_VALUE_OFFSET, hostname_length); proto_tree_add_string(parameter_tree, hf_sctp_parameter_hostname_hostname, parameter_tvb, PARAMETER_VALUE_OFFSET, hostname_length, hostname); diff --git a/packet-sua.c b/packet-sua.c index 561b81ac3c..f815ab1698 100644 --- a/packet-sua.c +++ b/packet-sua.c @@ -4,9 +4,9 @@ * http://www.ietf.org/internet-drafts/draft-ietf-sigtran-sua-08.txt * and also supports SUA light, a trivial Siemens proprietary version. * - * Copyright 2000, Michael Tüxen + * Copyright 2000, Michael Tüxen * - * $Id: packet-sua.c,v 1.10 2002/08/28 21:00:35 jmayer Exp $ + * $Id: packet-sua.c,v 1.11 2002/12/02 23:43:29 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -521,7 +521,7 @@ static void dissect_sua_info_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item) { guint16 length, info_string_length, padding_length; - char *info_string; + const char *info_string; length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET); padding_length = nr_of_padding_bytes(length); @@ -535,7 +535,7 @@ dissect_sua_info_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, parameter_tvb, PARAMETER_VALUE_OFFSET + info_string_length, padding_length, tvb_get_ptr(parameter_tvb, PARAMETER_VALUE_OFFSET + info_string_length, padding_length)); - info_string = (char *)tvb_get_ptr(parameter_tvb, INFO_PARAMETER_INFO_STRING_OFFSET, info_string_length); + info_string = (const char *)tvb_get_ptr(parameter_tvb, INFO_PARAMETER_INFO_STRING_OFFSET, info_string_length); proto_item_set_text(parameter_item, "Info String (%.*s)", (int) info_string_length, info_string); } @@ -1721,12 +1721,12 @@ static void dissect_sua_hostname_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item) { guint16 length, hostname_length, padding_length; - char *hostname; + const char *hostname; length = tvb_get_ntohs(parameter_tvb, PARAMETER_LENGTH_OFFSET); padding_length = nr_of_padding_bytes(length); hostname_length = length - PARAMETER_HEADER_LENGTH; - hostname = (char *)tvb_get_ptr(parameter_tvb, PARAMETER_VALUE_OFFSET, hostname_length); + hostname = (const char *)tvb_get_ptr(parameter_tvb, PARAMETER_VALUE_OFFSET, hostname_length); proto_tree_add_string(parameter_tree, hf_sua_hostname, parameter_tvb, PARAMETER_VALUE_OFFSET, hostname_length, diff --git a/packet-tcp.c b/packet-tcp.c index 8fa04afca6..32cebb52b9 100644 --- a/packet-tcp.c +++ b/packet-tcp.c @@ -1,7 +1,7 @@ /* packet-tcp.c * Routines for TCP packet disassembly * - * $Id: packet-tcp.c,v 1.167 2002/11/27 04:55:23 guy Exp $ + * $Id: packet-tcp.c,v 1.168 2002/12/02 23:43:30 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -908,7 +908,7 @@ free_all_segments(gpointer key_arg, gpointer value _U_, gpointer user_data _U_) static guint tcp_segment_hash(gconstpointer k) { - tcp_segment_key *key = (tcp_segment_key *)k; + const tcp_segment_key *key = (const tcp_segment_key *)k; return key->seq+key->sport; } @@ -916,8 +916,8 @@ tcp_segment_hash(gconstpointer k) static gint tcp_segment_equal(gconstpointer k1, gconstpointer k2) { - tcp_segment_key *key1 = (tcp_segment_key *)k1; - tcp_segment_key *key2 = (tcp_segment_key *)k2; + const tcp_segment_key *key1 = (const tcp_segment_key *)k1; + const tcp_segment_key *key2 = (const tcp_segment_key *)k2; return ( ( (key1->seq==key2->seq) &&(ADDRESSES_EQUAL(key1->src, key2->src)) diff --git a/reassemble.c b/reassemble.c index 064c774a44..d2707d371b 100644 --- a/reassemble.c +++ b/reassemble.c @@ -1,7 +1,7 @@ /* reassemble.c * Routines for {fragment,segment} reassembly * - * $Id: reassemble.c,v 1.26 2002/10/24 06:17:36 guy Exp $ + * $Id: reassemble.c,v 1.27 2002/12/02 23:43:30 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -57,8 +57,8 @@ static int fragment_init_count = 200; static gint fragment_equal(gconstpointer k1, gconstpointer k2) { - fragment_key* key1 = (fragment_key*) k1; - fragment_key* key2 = (fragment_key*) k2; + const fragment_key* key1 = (const fragment_key*) k1; + const fragment_key* key2 = (const fragment_key*) k2; /*key.id is the first item to compare since item is most likely to differ between sessions, thus shortcircuiting @@ -74,7 +74,7 @@ fragment_equal(gconstpointer k1, gconstpointer k2) static guint fragment_hash(gconstpointer k) { - fragment_key* key = (fragment_key*) k; + const fragment_key* key = (const fragment_key*) k; guint hash_val; /* int i; @@ -115,8 +115,8 @@ fragment_hash(gconstpointer k) static gint reassembled_equal(gconstpointer k1, gconstpointer k2) { - frame_data* key1 = (frame_data*) k1; - frame_data* key2 = (frame_data*) k2; + const frame_data* key1 = (const frame_data*) k1; + const frame_data* key2 = (const frame_data*) k2; return (key1->num == key2->num); } @@ -124,7 +124,7 @@ reassembled_equal(gconstpointer k1, gconstpointer k2) static guint reassembled_hash(gconstpointer k) { - frame_data* key = (frame_data*) k; + const frame_data* key = (const frame_data*) k; return key->num; } diff --git a/tethereal.c b/tethereal.c index 66b44e97b8..f4a575d2f3 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.170 2002/11/10 20:53:03 gerald Exp $ + * $Id: tethereal.c,v 1.171 2002/12/02 23:43:30 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -1109,10 +1109,10 @@ capture(int out_file_type) init_capture_stop_conditions(); /* create stop conditions */ if (capture_opts.has_autostop_filesize) - cnd_stop_capturesize = cnd_new((char*)CND_CLASS_CAPTURESIZE, + cnd_stop_capturesize = cnd_new((const char*)CND_CLASS_CAPTURESIZE, (long)capture_opts.autostop_filesize * 1000); if (capture_opts.has_autostop_duration) - cnd_stop_timeout = cnd_new((char*)CND_CLASS_TIMEOUT, + cnd_stop_timeout = cnd_new((const char*)CND_CLASS_TIMEOUT, (gint32)capture_opts.autostop_duration); if (!setjmp(ld.stopenv)) {