From 77335c8d82d670eba0b470667faaf8c3df499477 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 13 Dec 2017 01:06:35 -0800 Subject: 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 --- src/syncevo/icaltz-util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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++; -- cgit v1.2.3