aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-icq.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-12-26 05:57:06 +0000
committerGuy Harris <guy@alum.mit.edu>2012-12-26 05:57:06 +0000
commit8ed7a73e22c049a2e013bb436e599bff41fc5b9b (patch)
treead4a4cc6fb4ff4d3e3ffe3a3f8e3d056e441ae46 /epan/dissectors/packet-icq.c
parent8ede6b7dc09aa636f87147ab432a137c209e8aca (diff)
Fix a bunch of warnings.
Cast away some implicit 64-bit-to-32-bit conversion errors due to use of sizeof. Cast away some implicit 64-bit-to-32-bit conversion errors due to use of strtol() and strtoul(). Change some data types to avoid those implicit conversion warnings. When assigning a constant to a float, make sure the constant isn't a double, by appending "f" to the constant. Constify a bunch of variables, parameters, and return values to eliminate warnings due to strings being given const qualifiers. Cast away those warnings in some cases where an API we don't control forces us to do so. Enable a bunch of additional warnings by default. Note why at least some of the other warnings aren't enabled. randpkt.c and text2pcap.c are used to build programs, so they don't need to be in EXTRA_DIST. If the user specifies --enable-warnings-as-errors, add -Werror *even if the user specified --enable-extra-gcc-flags; assume they know what they're doing and are willing to have the compile fail due to the extra GCC warnings being treated as errors. svn path=/trunk/; revision=46748
Diffstat (limited to 'epan/dissectors/packet-icq.c')
-rw-r--r--epan/dissectors/packet-icq.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/epan/dissectors/packet-icq.c b/epan/dissectors/packet-icq.c
index 4d39bc80e8..14a9362b3e 100644
--- a/epan/dissectors/packet-icq.c
+++ b/epan/dissectors/packet-icq.c
@@ -511,10 +511,10 @@ proto_add_icq_attr(proto_tree* tree, /* The tree to add to */
len = tvb_get_letohs(tvb, offset);
if (len > tvb_reported_length_remaining(tvb, offset))
return -1; /* length goes past end of packet */
- proto_tree_add_text(tree, tvb, offset, sizeof(guint16) + len,
+ proto_tree_add_text(tree, tvb, offset, (int)sizeof(guint16) + len,
"%s[%u]: %.*s", descr, len, len,
- tvb_get_ephemeral_string(tvb, offset + sizeof(guint16), len));
- return len + sizeof(guint16);
+ tvb_get_ephemeral_string(tvb, offset + (int)sizeof(guint16), len));
+ return len + (int)sizeof(guint16);
}
static void
@@ -643,7 +643,7 @@ icqv5_decode_msgType(proto_tree* tree, tvbuff_t *tvb, int offset, int size,
"Authorization: (%u) %s",auth_suc,
(auth_suc==0)?"Denied":"Allowed");
offset++;
- proto_tree_add_text(subtree, tvb, offset, sizeof(guint16), "x1: 0x%04x",
+ proto_tree_add_text(subtree, tvb, offset, (int)sizeof(guint16), "x1: 0x%04x",
tvb_get_letohs(tvb, offset));
break;
}
@@ -1208,10 +1208,10 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */
/* Read the length field */
pktLen = tvb_get_letohs(tvb, offset);
- proto_tree_add_text(sstree, tvb, offset, sizeof(guint16),
+ proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint16),
"Length: %u", pktLen);
- offset += sizeof(guint16);
+ offset += (int)sizeof(guint16);
}
/* FALLTHRU */
case META_USER_FOUND:
@@ -1233,9 +1233,9 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */
/*
* Read UIN
*/
- proto_tree_add_text(sstree, tvb, offset, sizeof(guint32),
+ proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint32),
"UIN: %u", tvb_get_letohl(tvb, offset));
- offset+=sizeof(guint32);
+ offset+=(int)sizeof(guint32);
for ( ; *d!=NULL; d++) {
len = proto_add_icq_attr(sstree, tvb, offset, *d);
@@ -1249,11 +1249,11 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */
"authorization: %s", (auth==0x01)?"Necessary":"Who needs it");
offset++;
/* Get x2 */
- proto_tree_add_text(sstree, tvb, offset, sizeof(guint16),
+ proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint16),
"x2: 0x%04x", tvb_get_letohs(tvb, offset));
- offset+=sizeof(guint16);
+ offset+=(int)sizeof(guint16);
/* Get x3 */
- proto_tree_add_text(sstree, tvb, offset, sizeof(guint32),
+ proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint32),
"x3: 0x%08x", tvb_get_letohl(tvb, offset));
break;
}
@@ -1263,9 +1263,9 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */
/* Get the about information */
len = tvb_get_letohs(tvb, offset);
- offset+=sizeof(guint16);
- proto_tree_add_text(sstree, tvb, offset - sizeof(guint16),
- sizeof(guint16)+len, "About(%d): %.*s", len,
+ offset+=(int)sizeof(guint16);
+ proto_tree_add_text(sstree, tvb, offset - (int)sizeof(guint16),
+ (int)sizeof(guint16)+len, "About(%d): %.*s", len,
len, tvb_get_ephemeral_string(tvb, offset, len));
break;
}
@@ -1299,9 +1299,9 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */
#if 0
/* Get the uin */
uin = tvb_get_letohl(tvb, offset);
- proto_tree_add_text(sstree, tvb, offset, sizeof(guint32),
+ proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint32),
"UIN: %u", uin);
- offset+=sizeof(guint32);
+ offset+=(int)sizeof(guint32);
#endif
/*
@@ -1309,10 +1309,10 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */
*/
while ((*d)!=NULL) {
len = tvb_get_letohs(tvb, offset);
- offset+=sizeof(guint16);
+ offset+=(int)sizeof(guint16);
if (len>0) {
- proto_tree_add_text(sstree, tvb, offset - sizeof(guint16),
- sizeof(guint16)+len, "%s(%d): %.*s",
+ proto_tree_add_text(sstree, tvb, offset - (int)sizeof(guint16),
+ (int)sizeof(guint16)+len, "%s(%d): %.*s",
*d, len, len - 1,
tvb_get_ephemeral_string(tvb, offset, len - 1));
offset+=len;
@@ -1321,29 +1321,29 @@ icqv5_srv_meta_user(proto_tree* tree, /* Tree to put the data in */
}
/* Get country code */
country = tvb_get_letohs(tvb, offset);
- proto_tree_add_text(sstree, tvb, offset, sizeof(guint16),
+ proto_tree_add_text(sstree, tvb, offset, (int)sizeof(guint16),
"Countrycode: %u", country);
- offset+=sizeof(guint16);
+ offset+=(int)sizeof(guint16);
/* Get the timezone setting */
user_timezone = tvb_get_guint8(tvb, offset);
- proto_tree_add_text(sstree, tvb, offset, sizeof(unsigned char),
+ proto_tree_add_text(sstree, tvb, offset, (int)sizeof(unsigned char),
"Timezone: %u", user_timezone);
offset++;
/* Get the authorize setting */
auth = tvb_get_guint8(tvb, offset);
- proto_tree_add_text(sstree, tvb, offset, sizeof(unsigned char),
+ proto_tree_add_text(sstree, tvb, offset, (int)sizeof(unsigned char),
"Authorization: (%u) %s", auth,
(auth==0)?"No":"Yes");
offset++;
/* Get the webaware setting */
auth = tvb_get_guint8(tvb, offset);
- proto_tree_add_text(sstree, tvb, offset, sizeof(unsigned char),
+ proto_tree_add_text(sstree, tvb, offset, (int)sizeof(unsigned char),
"Webaware: (%u) %s", auth,
(auth==0)?"No":"Yes");
offset++;
/* Get the authorize setting */
auth = tvb_get_guint8(tvb, offset);
- proto_tree_add_text(sstree, tvb, offset, sizeof(unsigned char),
+ proto_tree_add_text(sstree, tvb, offset, (int)sizeof(unsigned char),
"HideIP: (%u) %s", auth, (auth==0)?"No":"Yes");
break;
}
@@ -1376,7 +1376,7 @@ icqv5_srv_recv_message(proto_tree* tree, /* Tree to put the data in */
ti = proto_tree_add_text(tree, tvb, offset, 4, "Body");
subtree = proto_item_add_subtree(ti, ett_icq_body);
proto_tree_add_item(subtree, hf_icq_uin, tvb, offset + SRV_RECV_MSG_UIN,
- sizeof(guint32), ENC_LITTLE_ENDIAN);
+ (int)sizeof(guint32), ENC_LITTLE_ENDIAN);
year = tvb_get_letohs(tvb, offset + SRV_RECV_MSG_YEAR);
month = tvb_get_guint8(tvb, offset + SRV_RECV_MSG_MONTH);
day = tvb_get_guint8(tvb, offset + SRV_RECV_MSG_DAY);
@@ -1384,7 +1384,7 @@ icqv5_srv_recv_message(proto_tree* tree, /* Tree to put the data in */
minute = tvb_get_guint8(tvb, offset + SRV_RECV_MSG_MINUTE);
proto_tree_add_text(subtree, tvb, offset + SRV_RECV_MSG_YEAR,
- sizeof(guint16) + 4*sizeof(unsigned char),
+ (int)sizeof(guint16) + 4*(int)sizeof(unsigned char),
"Time: %u-%u-%u %02u:%02u",
day, month, year, hour, minute);
icqv5_decode_msgType(subtree, tvb, offset + SRV_RECV_MSG_MSG_TYPE,
@@ -1412,32 +1412,32 @@ icqv5_srv_rand_user(proto_tree* tree, /* Tree to put the data in */
/* guint32 UIN */
uin = tvb_get_letohl(tvb, offset + SRV_RAND_USER_UIN);
proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_UIN,
- sizeof(guint32), "UIN: %u", uin);
+ (int)sizeof(guint32), "UIN: %u", uin);
/* guint32 IP */
proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_IP,
- sizeof(guint32), "IP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_IP));
+ (int)sizeof(guint32), "IP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_IP));
/* guint16 portNum */
/* XXX - 16 bits, or 32 bits? */
port = tvb_get_letohs(tvb, offset + SRV_RAND_USER_PORT);
proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_UIN,
- sizeof(guint32), "Port: %u", port);
+ (int)sizeof(guint32), "Port: %u", port);
/* guint32 realIP */
proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_REAL_IP,
- sizeof(guint32), "RealIP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_REAL_IP));
+ (int)sizeof(guint32), "RealIP: %s", tvb_ip_to_str(tvb, offset + SRV_RAND_USER_REAL_IP));
/* guint8 Communication Class */
commClass = tvb_get_guint8(tvb, offset + SRV_RAND_USER_CLASS);
proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_CLASS,
- sizeof(guint8), "Class: %s",
+ (int)sizeof(guint8), "Class: %s",
(commClass!=4)?"User to User":"Through Server");
/* guint32 status */
/* XXX - 16 bits, or 32 bits? */
status = tvb_get_letohs(tvb, offset + SRV_RAND_USER_STATUS);
proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_STATUS,
- sizeof(guint32), "Status: %s", findStatus(status));
+ (int)sizeof(guint32), "Status: %s", findStatus(status));
/* guint16 tcpVersion */
tcpVer = tvb_get_letohs(tvb, offset + SRV_RAND_USER_TCP_VER);
proto_tree_add_text(subtree, tvb, offset + SRV_RAND_USER_TCP_VER,
- sizeof(guint16), "TCPVersion: %u", tcpVer);
+ (int)sizeof(guint16), "TCPVersion: %u", tcpVer);
}
}