aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-sv.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-04-30 20:03:39 -0700
committerGuy Harris <guy@alum.mit.edu>2015-05-01 06:50:36 +0000
commitb84972635117aa5cac7f8e6296d07ceb51bfe5e2 (patch)
tree89f3c0baff68f63dcadb737de9e4da3c2b97bdfc /epan/dissectors/packet-sv.c
parent91515a008143901473e018033a76933abfec3c1f (diff)
Fix some cases where we're shifting a signed 1 left.
Shift 1U instead, to make sure it's unsigned; the result of, for example, the result of shifting a signed value left is undefined if the value times 2^{shift count} doesn't fit in the *signed* type of the shifted value. That means, in particular, that the result of shifting 1 left by {number of bits in an int - 1} is undefined. (In *practice*, it'll probably be -2^32, with the bit you want set, but that's not guaranteed, and GCC 5.1 seems not to like it.) Make some other left-hand operands of <<, and some variables holding results from shifts of that sort, unsigned, while we're at it. Change-Id: Ie72a9d0d518f59b35948267d10c80735d162e8bb Reviewed-on: https://code.wireshark.org/review/8264 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/dissectors/packet-sv.c')
-rw-r--r--epan/dissectors/packet-sv.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/epan/dissectors/packet-sv.c b/epan/dissectors/packet-sv.c
index 1752230a90..6652a75387 100644
--- a/epan/dissectors/packet-sv.c
+++ b/epan/dissectors/packet-sv.c
@@ -48,29 +48,29 @@
#define PFNAME "sv"
/* see IEC61850-8-1 8.2 */
-#define Q_VALIDITY_GOOD (0x0 << 0)
-#define Q_VALIDITY_INVALID (0x1 << 0)
-#define Q_VALIDITY_QUESTIONABLE (0x3 << 0)
-#define Q_VALIDITY_MASK (0x3 << 0)
-
-#define Q_OVERFLOW (1 << 2)
-#define Q_OUTOFRANGE (1 << 3)
-#define Q_BADREFERENCE (1 << 4)
-#define Q_OSCILLATORY (1 << 5)
-#define Q_FAILURE (1 << 6)
-#define Q_OLDDATA (1 << 7)
-#define Q_INCONSISTENT (1 << 8)
-#define Q_INACCURATE (1 << 9)
-
-#define Q_SOURCE_PROCESS (0 << 10)
-#define Q_SOURCE_SUBSTITUTED (1 << 10)
-#define Q_SOURCE_MASK (1 << 10)
-
-#define Q_TEST (1 << 11)
-#define Q_OPERATORBLOCKED (1 << 12)
+#define Q_VALIDITY_GOOD (0x0U << 0)
+#define Q_VALIDITY_INVALID (0x1U << 0)
+#define Q_VALIDITY_QUESTIONABLE (0x3U << 0)
+#define Q_VALIDITY_MASK (0x3U << 0)
+
+#define Q_OVERFLOW (1U << 2)
+#define Q_OUTOFRANGE (1U << 3)
+#define Q_BADREFERENCE (1U << 4)
+#define Q_OSCILLATORY (1U << 5)
+#define Q_FAILURE (1U << 6)
+#define Q_OLDDATA (1U << 7)
+#define Q_INCONSISTENT (1U << 8)
+#define Q_INACCURATE (1U << 9)
+
+#define Q_SOURCE_PROCESS (0U << 10)
+#define Q_SOURCE_SUBSTITUTED (1U << 10)
+#define Q_SOURCE_MASK (1U << 10)
+
+#define Q_TEST (1U << 11)
+#define Q_OPERATORBLOCKED (1U << 12)
/* see UCA Implementation Guideline for IEC 61850-9-2 */
-#define Q_DERIVED (1 << 13)
+#define Q_DERIVED (1U << 13)
void proto_register_sv(void);
void proto_reg_handoff_sv(void);