forked from osmocom/wireshark
Fix -Wabsolute-value in ICMP dissector (found by Clang 3.5)
packet-icmp.c:1245:7: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value] packet-icmp.c:1245:7: note: remove the call to 'abs' since unsigned values cannot be negative packet-icmp.c:1245:30: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value] packet-icmp.c:1245:30: note: remove the call to 'abs' since unsigned values cannot be negative packet-icmp.c:1254:6: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value] packet-icmp.c:1254:6: note: remove the call to 'abs' since unsigned values cannot be negative packet-icmp.c:1254:29: error: taking the absolute value of unsigned type 'unsigned int' has no effect [-Werror,-Wabsolute-value] packet-icmp.c:1254:29: note: remove the call to 'abs' since unsigned values cannot be negative packet-icmp.c:1623:7: error: taking the absolute value of unsigned type 'guint32' (aka 'unsigned int') has no effect [-Werror,-Wabsolute-value] packet-icmp.c:1623:7: note: remove the call to 'abs' since unsigned values cannot be negative packet-icmp.c:1629:7: error: taking the absolute value of unsigned type 'guint32' (aka 'unsigned int') has no effect [-Werror,-Wabsolute-value] packet-icmp.c:1629:7: note: remove the call to 'abs' since unsigned values cannot be negative Change-Id: I6b344d01b8239fb93aedf95d954ef1243ba45a6b Reviewed-on: https://code.wireshark.org/review/673 Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
309406299d
commit
0d2dd00564
|
@ -1242,7 +1242,7 @@ get_best_guess_mstimeofday(tvbuff_t * tvb, gint offset, guint32 comp_ts)
|
|||
if (le_ts < comp_ts && le_ts <= (MSPERDAY / 4)
|
||||
&& comp_ts >= (MSPERDAY - (MSPERDAY / 4)))
|
||||
le_ts += MSPERDAY; /* Assume a rollover to a new day */
|
||||
if (abs(be_ts - comp_ts) < abs(le_ts - comp_ts))
|
||||
if ((be_ts - comp_ts) < (le_ts - comp_ts))
|
||||
return saved_be_ts;
|
||||
return saved_le_ts;
|
||||
}
|
||||
|
@ -1251,7 +1251,7 @@ get_best_guess_mstimeofday(tvbuff_t * tvb, gint offset, guint32 comp_ts)
|
|||
* is clearly invalid, but now what TODO? For now, take the one closest to
|
||||
* the comparative timestamp, which is another way of saying, "let's
|
||||
* return a deterministic wild guess. */
|
||||
if (abs(be_ts - comp_ts) < abs(le_ts - comp_ts)) {
|
||||
if ((be_ts - comp_ts) < (le_ts - comp_ts)) {
|
||||
return be_ts;
|
||||
}
|
||||
return le_ts;
|
||||
|
@ -1620,13 +1620,13 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data)
|
|||
*/
|
||||
ts.secs = tvb_get_ntohl(tvb, 8);
|
||||
ts.nsecs = tvb_get_ntohl(tvb, 8 + 4); /* Leave at microsec resolution for now */
|
||||
if (abs((guint32) (ts.secs - pinfo->fd->abs_ts.secs)) >=
|
||||
if ((guint32) (ts.secs - pinfo->fd->abs_ts.secs) >=
|
||||
3600 * 24 || ts.nsecs >= 1000000) {
|
||||
/* Timestamp does not look right in BE, try LE representation */
|
||||
ts.secs = tvb_get_letohl(tvb, 8);
|
||||
ts.nsecs = tvb_get_letohl(tvb, 8 + 4); /* Leave at microsec resolution for now */
|
||||
}
|
||||
if (abs((guint32) (ts.secs - pinfo->fd->abs_ts.secs)) <
|
||||
if ((guint32) (ts.secs - pinfo->fd->abs_ts.secs) <
|
||||
3600 * 24 && ts.nsecs < 1000000) {
|
||||
ts.nsecs *= 1000; /* Convert to nanosec resolution */
|
||||
proto_tree_add_time(icmp_tree, hf_icmp_data_time,
|
||||
|
|
Loading…
Reference in New Issue