summaryrefslogtreecommitdiff
path: root/bits.c
diff options
context:
space:
mode:
authorMichael Tatarinov <kukabu@gmail.com>2013-02-18 11:42:56 +0400
committerEric S. Raymond <esr@thyrsus.com>2013-02-18 02:45:09 -0500
commitb5c2841005816d1521064daa4ea03c1c8ce7c298 (patch)
tree243cea206bb86369afd61e0315899e7abb8b8174 /bits.c
parent5ec399ba397aced9d324c06a8156314dc05b2a6e (diff)
downloadgpsd-b5c2841005816d1521064daa4ea03c1c8ce7c298.tar.gz
The signed/unsigned char fix.
All regression tests pass on Raspbian “wheezy”. Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Diffstat (limited to 'bits.c')
-rw-r--r--bits.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/bits.c b/bits.c
index 31b332a7..f18797c7 100644
--- a/bits.c
+++ b/bits.c
@@ -17,7 +17,7 @@
#include "bits.h"
-uint64_t ubits(char buf[], unsigned int start, unsigned int width, bool le)
+uint64_t ubits(unsigned char buf[], unsigned int start, unsigned int width, bool le)
/* extract a (zero-origin) bitfield from the buffer as an unsigned big-endian uint64_t */
{
uint64_t fld = 0;
@@ -58,10 +58,10 @@ uint64_t ubits(char buf[], unsigned int start, unsigned int width, bool le)
return fld;
}
-int64_t sbits(char buf[], unsigned int start, unsigned int width, bool le)
+int64_t sbits(signed char buf[], unsigned int start, unsigned int width, bool le)
/* extract a bitfield from the buffer as a signed big-endian long */
{
- uint64_t fld = ubits(buf, start, width, le);
+ uint64_t fld = ubits((unsigned char *)buf, start, width, le);
/*@ +relaxtypes */
if (fld & (1LL << (width - 1))) {