summaryrefslogtreecommitdiff
path: root/nuttx/libc
diff options
context:
space:
mode:
authorGregory Nutt <gnutt@nuttx.org>2014-11-25 13:46:14 -0600
committerGregory Nutt <gnutt@nuttx.org>2014-11-25 13:46:14 -0600
commitf28eff61aeb62c867249c8cb21162dbd3c60cc37 (patch)
treec1c8b6d68fb43d3ae59c3eb589e6a4c44acdcd57 /nuttx/libc
parent3b3fcf2bfa6015d890d42b5a528f7fe7476632f7 (diff)
downloadnuttx-f28eff61aeb62c867249c8cb21162dbd3c60cc37.tar.gz
nuttx-f28eff61aeb62c867249c8cb21162dbd3c60cc37.tar.bz2
nuttx-f28eff61aeb62c867249c8cb21162dbd3c60cc37.zip
More fixes to problems noted by cppcheck. Some are kind of risky; some are real bugs.
Diffstat (limited to 'nuttx/libc')
-rw-r--r--nuttx/libc/net/lib_inetpton.c4
-rw-r--r--nuttx/libc/stdio/lib_lowinstream.c2
-rw-r--r--nuttx/libc/stdlib/lib_mkstemp.c4
-rw-r--r--nuttx/libc/stdlib/lib_qsort.c2
4 files changed, 6 insertions, 6 deletions
diff --git a/nuttx/libc/net/lib_inetpton.c b/nuttx/libc/net/lib_inetpton.c
index 2805a7047..8b058e044 100644
--- a/nuttx/libc/net/lib_inetpton.c
+++ b/nuttx/libc/net/lib_inetpton.c
@@ -147,7 +147,7 @@ int inet_pton(int af, FAR const char *src, FAR void *dst)
break;
}
- if (numoffset <= 0)
+ if (numoffset < 1)
{
/* Empty numeric string */
@@ -245,7 +245,7 @@ int inet_pton(int af, FAR const char *src, FAR void *dst)
break;
}
- if (ch != '\0' && numoffset <= 0)
+ if (ch != '\0' && numoffset < 1)
{
/* Empty numeric string */
diff --git a/nuttx/libc/stdio/lib_lowinstream.c b/nuttx/libc/stdio/lib_lowinstream.c
index 7284601e8..8c11fee90 100644
--- a/nuttx/libc/stdio/lib_lowinstream.c
+++ b/nuttx/libc/stdio/lib_lowinstream.c
@@ -65,7 +65,7 @@ static int lowinstream_getc(FAR struct lib_instream_s *this)
/* Get the next character from the incoming stream */
- ret = up_getc(ch)
+ ret = up_getc(ch);
if (ret != EOF)
{
this->nget++;
diff --git a/nuttx/libc/stdlib/lib_mkstemp.c b/nuttx/libc/stdlib/lib_mkstemp.c
index 729dfa535..94b6dcc0a 100644
--- a/nuttx/libc/stdlib/lib_mkstemp.c
+++ b/nuttx/libc/stdlib/lib_mkstemp.c
@@ -149,9 +149,7 @@ static void incr_base62(void)
static void get_base62(FAR uint8_t *ptr)
{
- int ret;
-
- while ((ret = sem_wait(&g_b62sem)) < 0)
+ while (sem_wait(&g_b62sem) < 0)
{
DEBUGASSERT(errno == EINTR);
}
diff --git a/nuttx/libc/stdlib/lib_qsort.c b/nuttx/libc/stdlib/lib_qsort.c
index 0579b1510..0ce30e999 100644
--- a/nuttx/libc/stdlib/lib_qsort.c
+++ b/nuttx/libc/stdlib/lib_qsort.c
@@ -213,6 +213,7 @@ loop:
swap(pl, pl - size);
}
}
+
return;
}
@@ -230,6 +231,7 @@ loop:
if ((r = pd - pc) > size)
{
/* Iterate rather than recurse to save stack space */
+
base = pn - r;
nmemb = r / size;
goto loop;