summaryrefslogtreecommitdiff
path: root/hex.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2015-03-30 17:10:53 -0400
committerEric S. Raymond <esr@thyrsus.com>2015-03-30 17:10:53 -0400
commit28bf37132d86cc59320e21d843960d086cef664c (patch)
treebf085b5f89f1d1061b6a88ecc66c50721b13d86c /hex.c
parentecb7e1ff3ec73000918c56861c55258c2d4deada (diff)
downloadgpsd-28bf37132d86cc59320e21d843960d086cef664c.tar.gz
Retire splint from our set of static analyzers.
The proximate cause was that we've been seing emission of error messages that were randomly and disturbingly variable across different environments - notably Raspbian and Gentoo splint gave nontrivially different results than Ubuntu 14.10 splint. And this was *not* due to Ubuntu patches! A pristine splint built from the 3.1.2 tarball on Ubuntu didn't match the Raspbian and Gentoo results either. But this has been coming for a while. Easy access to more modern static analyzers such as coverity, scan-build and cppcheck has been decreasing the utility of splint, which is unmaintained and somewhat buggy and not easy to use. Only file not cleaned is ppsthread.c, because Gary has been working on it during this cleanup. All regression tests pass. PPS observed live on GR601-W.
Diffstat (limited to 'hex.c')
-rw-r--r--hex.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/hex.c b/hex.c
index 513cf558..606356af 100644
--- a/hex.c
+++ b/hex.c
@@ -8,9 +8,8 @@
#include "gpsd.h"
-/*@-mustdefine@*/
-const char /*@ observer @*/ *gpsd_packetdump(char *scbuf, size_t scbuflen,
- char *binbuf, size_t binbuflen)
+const char *gpsd_packetdump(char *scbuf, size_t scbuflen,
+ char *binbuf, size_t binbuflen)
{
char *cp;
bool printable = true;
@@ -24,10 +23,8 @@ const char /*@ observer @*/ *gpsd_packetdump(char *scbuf, size_t scbuflen,
else
return gpsd_hexdump(scbuf, scbuflen, binbuf, binbuflen);
}
-/*@+mustdefine@*/
-/*@-mustdefine@*/
-const char /*@ observer @*/ *gpsd_hexdump(char *scbuf, size_t scbuflen,
+const char *gpsd_hexdump(char *scbuf, size_t scbuflen,
char *binbuf, size_t binbuflen)
{
#ifndef SQUELCH_ENABLE
@@ -41,12 +38,10 @@ const char /*@ observer @*/ *gpsd_hexdump(char *scbuf, size_t scbuflen,
if (NULL == binbuf || 0 == binbuflen)
return "";
- /*@ -shiftimplementation @*/
for (i = 0; i < len && i * 2 < scbuflen - 2; i++) {
scbuf[j++] = hexchar[(ibuf[i] & 0xf0) >> 4];
scbuf[j++] = hexchar[ibuf[i] & 0x0f];
}
- /*@ +shiftimplementation @*/
scbuf[j] = '\0';
#else /* SQUELCH defined */
scbuf[0] = '\0';
@@ -56,9 +51,7 @@ const char /*@ observer @*/ *gpsd_hexdump(char *scbuf, size_t scbuflen,
#endif /* SQUELCH_ENABLE */
return scbuf;
}
-/*@+mustdefine@*/
-/*@ +charint -shiftimplementation @*/
static int hex2bin(const char *s)
{
int a, b;
@@ -87,12 +80,11 @@ static int hex2bin(const char *s)
return ((a << 4) + b);
}
-int gpsd_hexpack( /*@in@*/ const char *src, /*@out@ */ char *dst, size_t len)
+int gpsd_hexpack(const char *src, char *dst, size_t len)
/* hex2bin source string to destination - destination can be same as source */
{
int i, j;
- /*@ -mustdefine @*/
j = (int)(strlen(src) / 2);
if ((j < 1) || ((size_t) j > len))
return -2;
@@ -106,17 +98,14 @@ int gpsd_hexpack( /*@in@*/ const char *src, /*@out@ */ char *dst, size_t len)
}
(void)memset(dst + i, '\0', (size_t) (len - i));
return j;
- /*@ +mustdefine @*/
}
-/*@ -charint +shiftimplementation @*/
-ssize_t hex_escapes( /*@out@*/ char *cooked, const char *raw)
+ssize_t hex_escapes(char *cooked, const char *raw)
/* interpret C-style hex escapes */
{
char c, *cookend;
- /*@ +charint -mustdefine -compdef @*/
for (cookend = cooked; *raw != '\0'; raw++)
if (*raw != '\\')
*cookend++ = *raw;
@@ -270,5 +259,4 @@ ssize_t hex_escapes( /*@out@*/ char *cooked, const char *raw)
}
}
return (ssize_t) (cookend - cooked);
- /*@ +charint +mustdefine +compdef @*/
}