summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Ohly <patrick.ohly@intel.com>2017-12-13 01:06:35 -0800
committerPatrick Ohly <patrick.ohly@intel.com>2018-01-03 10:39:50 +0100
commit77335c8d82d670eba0b470667faaf8c3df499477 (patch)
tree2b8be3f4574f0f5d120cf246f47c520e4089190f
parent3a79a8d3980407f1e0f83797c92ef19899980115 (diff)
icaltz-util.c: avoid undefined signed int shifting
The result of shifting a signed int is undefined. Better operate on unsigned int of the same size. Found by clang or cppcheck. Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
-rw-r--r--src/syncevo/icaltz-util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/syncevo/icaltz-util.c b/src/syncevo/icaltz-util.c
index abb9a758..3e4925c5 100644
--- a/src/syncevo/icaltz-util.c
+++ b/src/syncevo/icaltz-util.c
@@ -184,7 +184,7 @@ decode (const void *ptr)
else
{
const unsigned char *p = ptr;
- int result = *p & (1 << (CHAR_BIT - 1)) ? ~0 : 0;
+ unsigned result = *p & (1 << (CHAR_BIT - 1)) ? ~0 : 0;
result = (result << 8) | *p++;
result = (result << 8) | *p++;