From 746e796e83c949f61483812a6ce5a95ab2fe96b5 Mon Sep 17 00:00:00 2001 From: Bill Meier Date: Fri, 13 Dec 2013 03:24:08 +0000 Subject: (Try to) fix VS Clang Analysis warning: C6297: Arithmetic overflow: 32-bit value is shifted, then cast to 64-bit value. Results might not be an expected value svn path=/trunk/; revision=54019 --- epan/dissectors/packet-bootp.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-bootp.c b/epan/dissectors/packet-bootp.c index 02c2361585..15da0e53f2 100644 --- a/epan/dissectors/packet-bootp.c +++ b/epan/dissectors/packet-bootp.c @@ -3014,9 +3014,9 @@ rfc3825_fixpoint_to_decimal(struct rfc3825_location_fixpoint_t *fixpoint, struct return RFC3825_LATITUDE_UNCERTAINTY_OUTOFRANGE; } if (fixpoint->latitude_res > 8 ) { - decimal->latitude_res = (double) 1 / (1 << (fixpoint->latitude_res - 8)); + decimal->latitude_res = (double) 1 / (G_GUINT64_CONSTANT(1) << (fixpoint->latitude_res - 8)); } else { - decimal->latitude_res = 1 << (8 - fixpoint->latitude_res); + decimal->latitude_res = (double) (G_GUINT64_CONSTANT(1) << (8 - fixpoint->latitude_res)); } /* Longitude */ @@ -3030,9 +3030,9 @@ rfc3825_fixpoint_to_decimal(struct rfc3825_location_fixpoint_t *fixpoint, struct return RFC3825_LONGITUDE_UNCERTAINTY_OUTOFRANGE; } if (fixpoint->longitude_res > 8 ) { - decimal->longitude_res = (double) 1 / (1 << (fixpoint->longitude_res - 8)); + decimal->longitude_res = (double) 1 / (G_GUINT64_CONSTANT(1) << (fixpoint->longitude_res - 8)); } else { - decimal->longitude_res = 1 << (8 - fixpoint->longitude_res); + decimal->longitude_res = (double) (G_GUINT64_CONSTANT(1) << (8 - fixpoint->longitude_res)); } /* Altitude Type */ @@ -3052,9 +3052,9 @@ rfc3825_fixpoint_to_decimal(struct rfc3825_location_fixpoint_t *fixpoint, struct return RFC3825_ALTITUDE_UNCERTAINTY_OUTOFRANGE; } if (fixpoint->altitude_res > 21 ) { - decimal->altitude_res = (double) 1 / (1 << (fixpoint->altitude_res - 21)); + decimal->altitude_res = (double) 1 / (G_GUINT64_CONSTANT(1) << (fixpoint->altitude_res - 21)); } else { - decimal->altitude_res = 1 << (21 - fixpoint->altitude_res); + decimal->altitude_res = (double) (G_GUINT64_CONSTANT(1) << (21 - fixpoint->altitude_res)); } } else if (decimal->altitude_type == 2) { /* Floors */ /* Altitude */ -- cgit v1.2.3