aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-cbor.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-08-23 11:38:13 -0700
committerGuy Harris <guy@alum.mit.edu>2015-08-23 18:38:46 +0000
commit4f68c52eda1c4b21027bcfbe13685740be2debac (patch)
tree9221e1434e0ea370ca9d6a66d401348236b6a2ff /epan/dissectors/packet-cbor.c
parent6b9a628e544cc00a79219cd23dd8c83b93038d86 (diff)
See if this makes MSVC happy.
It's complaining about an "overflow in constant arithmetic". Neither INFINITY nor NAN are specified by C90; C99 specifies that they are both floats. Until recently, Microsoft had no interest in C99; if the version we're using supports C99's INFINITY and NAN, it should be OK to assign them to a variable (no "arithmetic" involved), so I'm guessing that the "arithmetic" in question is the use of conditional operators ? and :, so I'm writing it as an if statement instead. Change-Id: I532b9b5943be32e0897e4f03ac4e625ac41ee63b Reviewed-on: https://code.wireshark.org/review/10215 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-cbor.c')
-rw-r--r--epan/dissectors/packet-cbor.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/epan/dissectors/packet-cbor.c b/epan/dissectors/packet-cbor.c
index 91e8023493..89de18a726 100644
--- a/epan/dissectors/packet-cbor.c
+++ b/epan/dissectors/packet-cbor.c
@@ -571,8 +571,12 @@ static float decode_half(const int half) {
val = ldexpf((float)mantissa, -24);
else if (exponent != 31)
val = ldexpf((float)(mantissa + 1024), exponent - 25);
- else
- val = mantissa == 0 ? INFINITY : NAN;
+ else {
+ if (mantissa == 0)
+ val = INFINITY;
+ else
+ val = NAN;
+ }
return half & 0x8000 ? -val : val;
}