From d6b50a1d3f97554fcec380900be9a8dd7a63a05e Mon Sep 17 00:00:00 2001 From: Alin Jerpelea Date: Tue, 2 Mar 2021 14:33:27 +0100 Subject: [PATCH] libs: nxstyle fixes nxstyle fixes to pass the CI checks Signed-off-by: Alin Jerpelea --- libs/libc/aio/aio_error.c | 1 + libs/libc/aio/aio_return.c | 1 + libs/libc/dirent/lib_readdirr.c | 28 ++++++----- libs/libc/endian/lib_swap32.c | 8 +-- libs/libc/endian/lib_swap64.c | 16 +++--- libs/libc/fixedmath/lib_b16cos.c | 1 + libs/libc/fixedmath/lib_b16sin.c | 16 +++--- libs/libc/fixedmath/lib_fixedmath.c | 6 ++- libs/libc/grp/lib_grp_globals.c | 4 ++ libs/libc/libgen/lib_basename.c | 5 +- libs/libc/libgen/lib_dirname.c | 9 ++-- libs/libc/locale/lib_setlocale.c | 3 +- libs/libc/lzf/lzf.h | 34 +++++++------ libs/libc/lzf/lzf_c.c | 49 +++++++++--------- libs/libc/lzf/lzf_d.c | 34 +++++++------ libs/libc/machine/arm/arm/arch_elf.c | 48 ++++++++++++------ libs/libc/machine/arm/armv6-m/arch_elf.c | 50 +++++++++---------- libs/libc/machine/arm/armv7-m/arch_elf.c | 48 +++++++++--------- libs/libc/machine/arm/armv7-r/arch_elf.c | 37 +++++++++----- libs/libc/net/lib_htonl.c | 4 +- libs/libc/pthread/pthread_attr_getaffinity.c | 6 ++- libs/libc/pthread/pthread_attr_setaffinity.c | 3 +- .../pthread/pthread_barrierattr_destroy.c | 1 + .../pthread/pthread_barrierattr_getpshared.c | 4 +- libs/libc/pthread/pthread_barrierattr_init.c | 1 + .../pthread/pthread_barrierattr_setpshared.c | 27 +++++----- libs/libc/pthread/pthread_barrierinit.c | 3 +- libs/libc/pthread/pthread_mutex_lock.c | 12 ++--- .../pthread/pthread_mutexattr_getpshared.c | 3 +- .../pthread/pthread_mutexattr_setrobust.c | 3 +- libs/libc/pthread/pthread_once.c | 4 +- libs/libc/pthread/pthread_setcancelstate.c | 5 +- libs/libc/pthread/pthread_setcanceltype.c | 1 + libs/libc/pthread/pthread_spinlock.c | 7 +-- libs/libc/pwd/lib_pwd_globals.c | 4 ++ libs/libc/queue/sq_rem.c | 2 +- libs/libc/signal/sig_signal.c | 6 +-- libs/libc/spawn/lib_psa_init.c | 1 - libs/libc/spawn/lib_psa_setstacksize.c | 3 +- libs/libc/spawn/lib_psfa_addaction.c | 3 +- libs/libc/spawn/lib_psfa_addclose.c | 8 +-- libs/libc/spawn/lib_psfa_adddup2.c | 8 +-- libs/libc/spawn/lib_psfa_destroy.c | 7 ++- libs/libc/spawn/lib_psfa_dump.c | 3 +- libs/libc/spawn/lib_psfa_init.c | 3 +- libs/libc/stdio/legacy_libvsprintf.c | 12 ++--- libs/libc/stdio/lib_fgetpos.c | 8 +-- libs/libc/stdio/lib_fseek.c | 4 +- libs/libc/stdio/lib_ftell.c | 7 ++- libs/libc/stdio/lib_libfflush.c | 14 +++--- libs/libc/stdio/lib_libfgets.c | 6 +-- libs/libc/stdio/lib_memoutstream.c | 3 +- libs/libc/stdio/lib_rawsostream.c | 3 +- libs/libc/stdio/lib_rdflush.c | 17 ++++--- libs/libc/stdio/lib_snprintf.c | 4 +- libs/libc/stdio/lib_stdoutstream.c | 6 ++- libs/libc/stdlib/lib_abort.c | 5 +- libs/libc/stdlib/lib_abs.c | 1 + libs/libc/stdlib/lib_checkbase.c | 8 ++- libs/libc/stdlib/lib_labs.c | 1 + libs/libc/stdlib/lib_llabs.c | 1 + libs/libc/string/lib_ffsl.c | 4 +- libs/libc/string/lib_ffsll.c | 4 +- libs/libc/string/lib_isbasedigit.c | 1 + libs/libc/string/lib_memcmp.c | 1 + libs/libc/string/lib_memset.c | 3 +- libs/libc/string/lib_skipspace.c | 6 +-- libs/libc/string/lib_strcasecmp.c | 1 + libs/libc/string/lib_strcasestr.c | 8 +-- libs/libc/string/lib_strcat.c | 1 + libs/libc/string/lib_strdup.c | 2 +- libs/libc/string/lib_strncasecmp.c | 1 + libs/libc/string/lib_strncat.c | 1 + libs/libc/string/lib_strndup.c | 3 +- libs/libc/string/lib_strpbrk.c | 12 +++-- libs/libc/symtab/symtab_findbyname.c | 1 + libs/libc/symtab/symtab_findbyvalue.c | 15 +++--- libs/libc/symtab/symtab_findorderedbyname.c | 4 +- libs/libc/termios/lib_tcflow.c | 4 +- libs/libc/termios/lib_tcflush.c | 3 +- libs/libc/termios/lib_tcgetattr.c | 6 ++- libs/libc/termios/lib_tcsetattr.c | 4 +- libs/libc/time/lib_calendar2utc.c | 14 +++--- libs/libc/time/lib_gettimeofday.c | 6 +-- libs/libc/unistd/lib_chdir.c | 8 +-- libs/libc/unistd/lib_getuid.c | 3 +- libs/libc/unistd/lib_sleep.c | 12 ++--- libs/libc/unistd/lib_swab.c | 30 +++++------ libs/libc/unistd/lib_usleep.c | 20 ++++---- libs/libc/wqueue/work_cancel.c | 7 +-- libs/libc/wqueue/work_signal.c | 1 + libs/libc/wqueue/wqueue.h | 4 +- libs/libc/zoneinfo/tzromfs.c | 3 +- 93 files changed, 475 insertions(+), 348 deletions(-) diff --git a/libs/libc/aio/aio_error.c b/libs/libc/aio/aio_error.c index 364afa86a4..64404d346e 100644 --- a/libs/libc/aio/aio_error.c +++ b/libs/libc/aio/aio_error.c @@ -33,6 +33,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /**************************************************************************** diff --git a/libs/libc/aio/aio_return.c b/libs/libc/aio/aio_return.c index 8e99c1cd62..0045170d97 100644 --- a/libs/libc/aio/aio_return.c +++ b/libs/libc/aio/aio_return.c @@ -33,6 +33,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* Configuration ************************************************************/ /**************************************************************************** diff --git a/libs/libc/dirent/lib_readdirr.c b/libs/libc/dirent/lib_readdirr.c index 3ba36e2d86..1df0926937 100644 --- a/libs/libc/dirent/lib_readdirr.c +++ b/libs/libc/dirent/lib_readdirr.c @@ -78,19 +78,20 @@ int readdir_r(FAR DIR *dirp, FAR struct dirent *entry, tmp = readdir(dirp); if (!tmp) { - int error = get_errno(); - if (!error) - { - if (result) - { - *result = NULL; - } - return 0; - } - else - { - return error; - } + int error = get_errno(); + if (!error) + { + if (result) + { + *result = NULL; + } + + return 0; + } + else + { + return error; + } } if (entry) @@ -102,5 +103,6 @@ int readdir_r(FAR DIR *dirp, FAR struct dirent *entry, { *result = entry; } + return 0; } diff --git a/libs/libc/endian/lib_swap32.c b/libs/libc/endian/lib_swap32.c index 044e07dd38..c23bacba36 100644 --- a/libs/libc/endian/lib_swap32.c +++ b/libs/libc/endian/lib_swap32.c @@ -32,9 +32,9 @@ #ifndef __SWAP_UINT32_ISMACRO uint32_t __swap_uint32(uint32_t n) { - return (uint32_t)(((((uint32_t)(n)) & 0x000000ffUL) << 24) | - ((((uint32_t)(n)) & 0x0000ff00UL) << 8) | - ((((uint32_t)(n)) & 0x00ff0000UL) >> 8) | - ((((uint32_t)(n)) & 0xff000000UL) >> 24)); + return (uint32_t)(((((uint32_t)(n)) & 0x000000fful) << 24) | + ((((uint32_t)(n)) & 0x0000ff00ul) << 8) | + ((((uint32_t)(n)) & 0x00ff0000ul) >> 8) | + ((((uint32_t)(n)) & 0xff000000ul) >> 24)); } #endif diff --git a/libs/libc/endian/lib_swap64.c b/libs/libc/endian/lib_swap64.c index 2973c76565..e89fb86ec1 100644 --- a/libs/libc/endian/lib_swap64.c +++ b/libs/libc/endian/lib_swap64.c @@ -34,13 +34,13 @@ #ifdef CONFIG_HAVE_LONG_LONG uint64_t __swap_uint64(uint64_t n) { - return (uint64_t)(((((uint64_t)(n)) & 0x00000000000000ffULL) << 56) | - ((((uint64_t)(n)) & 0x000000000000ff00ULL) << 40) | - ((((uint64_t)(n)) & 0x0000000000ff0000ULL) << 24) | - ((((uint64_t)(n)) & 0x00000000ff000000ULL) << 8) | - ((((uint64_t)(n)) & 0x000000ff00000000ULL) >> 8) | - ((((uint64_t)(n)) & 0x0000ff0000000000ULL) >> 24) | - ((((uint64_t)(n)) & 0x00ff000000000000ULL) >> 40) | - ((((uint64_t)(n)) & 0xff00000000000000ULL) >> 56)); + return (uint64_t)(((((uint64_t)(n)) & 0x00000000000000ffull) << 56) | + ((((uint64_t)(n)) & 0x000000000000ff00ull) << 40) | + ((((uint64_t)(n)) & 0x0000000000ff0000ull) << 24) | + ((((uint64_t)(n)) & 0x00000000ff000000ull) << 8) | + ((((uint64_t)(n)) & 0x000000ff00000000ull) >> 8) | + ((((uint64_t)(n)) & 0x0000ff0000000000ull) >> 24) | + ((((uint64_t)(n)) & 0x00ff000000000000ull) >> 40) | + ((((uint64_t)(n)) & 0xff00000000000000ull) >> 56)); } #endif diff --git a/libs/libc/fixedmath/lib_b16cos.c b/libs/libc/fixedmath/lib_b16cos.c index 006f9374ee..9d9f03071e 100644 --- a/libs/libc/fixedmath/lib_b16cos.c +++ b/libs/libc/fixedmath/lib_b16cos.c @@ -45,5 +45,6 @@ b16_t b16cos(b16_t rad) { rad -= b16TWOPI; } + return b16sin(rad); } diff --git a/libs/libc/fixedmath/lib_b16sin.c b/libs/libc/fixedmath/lib_b16sin.c index b7550db6f7..7cc20ed082 100644 --- a/libs/libc/fixedmath/lib_b16sin.c +++ b/libs/libc/fixedmath/lib_b16sin.c @@ -38,7 +38,8 @@ /**************************************************************************** * Name: b16sin - * Ref: http://lab.polygonal.de/2007/07/18/fast-and-accurate-sinecosine-approximation/ + * Ref: + * lab.polygonal.de/2007/07/18/fast-and-accurate-sinecosine-approximation/ ****************************************************************************/ b16_t b16sin(b16_t rad) @@ -54,29 +55,28 @@ b16_t b16sin(b16_t rad) rad += b16TWOPI; } else if (rad > b16PI) - { + { rad -= b16TWOPI; - } + } /* tmp1 = 1.27323954 * rad * tmp2 = .405284735 * rad * rad */ - tmp1 = b16mulb16(b16_1P27323954, rad); tmp2 = b16mulb16(b16_P405284735, b16sqr(rad)); if (rad < 0) { - /* tmp3 = 1.27323954 * rad + .405284735 * rad * rad */ + /* tmp3 = 1.27323954 * rad + .405284735 * rad * rad */ - tmp3 = tmp1 + tmp2; + tmp3 = tmp1 + tmp2; } else { - /* tmp3 = 1.27323954 * rad - 0.405284735 * rad * rad */ + /* tmp3 = 1.27323954 * rad - 0.405284735 * rad * rad */ - tmp3 = tmp1 - tmp2; + tmp3 = tmp1 - tmp2; } /* tmp1 = tmp3*tmp3 */ diff --git a/libs/libc/fixedmath/lib_fixedmath.c b/libs/libc/fixedmath/lib_fixedmath.c index ebee0bc408..85981aefb8 100644 --- a/libs/libc/fixedmath/lib_fixedmath.c +++ b/libs/libc/fixedmath/lib_fixedmath.c @@ -171,6 +171,7 @@ b16_t b16sqr(b16_t a) { sq = b16MAX; } + return sq; } @@ -236,7 +237,7 @@ ub16_t ub16divub16(ub16_t num, ub16_t denom) term1 = ((uint32_t)num & 0xffff0000) / denom; if (term1 >= 0x00010000) { - return ub16MAX; /* Will overflow */ + return ub16MAX; /* Will overflow */ } /* Finish the division */ @@ -249,8 +250,9 @@ ub16_t ub16divub16(ub16_t num, ub16_t denom) if (product < term1) { - return ub16MAX; /* Overflowed */ + return ub16MAX; /* Overflowed */ } + return product; } diff --git a/libs/libc/grp/lib_grp_globals.c b/libs/libc/grp/lib_grp_globals.c index 6ac9a315b4..3f6829e2f7 100644 --- a/libs/libc/grp/lib_grp_globals.c +++ b/libs/libc/grp/lib_grp_globals.c @@ -37,4 +37,8 @@ struct group g_group; char g_group_buffer[GRPBUF_RESERVE_SIZE]; +/**************************************************************************** + * Public Functions + ****************************************************************************/ + #endif /* CONFIG_LIBC_GROUP_FILE */ diff --git a/libs/libc/libgen/lib_basename.c b/libs/libc/libgen/lib_basename.c index 942b462f40..797631bb6d 100644 --- a/libs/libc/libgen/lib_basename.c +++ b/libs/libc/libgen/lib_basename.c @@ -80,12 +80,13 @@ FAR char *basename(FAR char *path) /* Check for trailing slash characters */ len = strlen(path); - while (path[len-1] == '/') + while (path[len - 1] == '/') { /* Remove trailing '/' UNLESS this would make a zero length string */ + if (len > 1) { - path[len-1] = '\0'; + path[len - 1] = '\0'; len--; } else diff --git a/libs/libc/libgen/lib_dirname.c b/libs/libc/libgen/lib_dirname.c index 7079ca361d..adee1adaae 100644 --- a/libs/libc/libgen/lib_dirname.c +++ b/libs/libc/libgen/lib_dirname.c @@ -80,12 +80,13 @@ FAR char *dirname(FAR char *path) /* Check for trailing slash characters */ len = strlen(path); - while (path[len-1] == '/') + while (path[len - 1] == '/') { /* Remove trailing '/' UNLESS this would make a zero length string */ + if (len > 1) { - path[len-1] = '\0'; + path[len - 1] = '\0'; len--; } else @@ -102,8 +103,8 @@ FAR char *dirname(FAR char *path) p = strrchr(path, '/'); if (p) { - /* Handle the case where the only '/' in the string is the at the beginning - * of the path. + /* Handle the case where the only '/' in the string is the at the + * beginning of the path. */ if (p == path) diff --git a/libs/libc/locale/lib_setlocale.c b/libs/libc/locale/lib_setlocale.c index 018171a674..ee2b5c471e 100644 --- a/libs/libc/locale/lib_setlocale.c +++ b/libs/libc/locale/lib_setlocale.c @@ -49,6 +49,7 @@ FAR char *setlocale(int category, FAR const char *locale) { return ((locale == NULL || strcmp(locale, "POSIX") == 0 || - strcmp(locale, "C") == 0 || strcmp(locale, "") == 0) ? "C" : NULL); + strcmp(locale, "C") == 0 || strcmp(locale, "") == + 0) ? "C" : NULL); } #endif diff --git a/libs/libc/lzf/lzf.h b/libs/libc/lzf/lzf.h index 1c92e6b2ce..af66134e08 100644 --- a/libs/libc/lzf/lzf.h +++ b/libs/libc/lzf/lzf.h @@ -1,28 +1,30 @@ /**************************************************************************** * libs/libc/lzf/lzf.h * - * Copyright (c) 2000-2007 Marc Alexander Lehmann + * Copyright (c) 2000-2007 + * Author: Marc Alexander Lehmann * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- - * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- - * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- - * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ @@ -80,7 +82,7 @@ using namespace std; * and might also be slower. Default is to autodetect. */ -/*#define LZF_USER_OFFSETS autodetect */ +/* #define LZF_USER_OFFSETS autodetect */ #ifndef LZF_USE_OFFSETS # define LZF_USE_OFFSETS (UINTPTR_MAX > 0xffffffffU) diff --git a/libs/libc/lzf/lzf_c.c b/libs/libc/lzf/lzf_c.c index 308068e6ee..b844022e03 100644 --- a/libs/libc/lzf/lzf_c.c +++ b/libs/libc/lzf/lzf_c.c @@ -3,26 +3,27 @@ * * Copyright (c) 2000-2010 Marc Alexander Lehmann * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- - * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- - * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- - * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPE- CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ @@ -208,10 +209,10 @@ size_t lzf_compress(FAR const void *const in_data, } } - op[- lit - 1] = lit - 1; /* Stop run */ - op -= !lit; /* Undo run if length is zero */ + op[(- lit) - 1] = lit - 1; /* Stop run */ + op -= !lit; /* Undo run if length is zero */ - for (;;) + for (; ; ) { if (expect_true(maxlen > 16)) { @@ -330,7 +331,7 @@ size_t lzf_compress(FAR const void *const in_data, } else { - *op++ = (off >> 8) + ( 7 << 5); + *op++ = (off >> 8) + (7 << 5); *op++ = len - 7; } @@ -388,8 +389,8 @@ size_t lzf_compress(FAR const void *const in_data, if (expect_false(lit == MAX_LIT)) { - op[- lit - 1] = lit - 1; /* Stop run */ - lit = 0; /* Start run */ + op[(- lit) - 1] = lit - 1; /* Stop run */ + lit = 0; /* Start run */ op++; } } @@ -409,14 +410,14 @@ size_t lzf_compress(FAR const void *const in_data, if (expect_false(lit == MAX_LIT)) { - op[- lit - 1] = lit - 1; /* Stop run */ - lit = 0; /* Start run */ + op[(- lit) - 1] = lit - 1; /* Stop run */ + lit = 0; /* Start run */ op++; } } - op[- lit - 1] = lit - 1; /* End run */ - op -= !lit; /* Undo run if length is zero */ + op[(- lit) - 1] = lit - 1; /* End run */ + op -= !lit; /* Undo run if length is zero */ cs = op - (uint8_t *)out_data; diff --git a/libs/libc/lzf/lzf_d.c b/libs/libc/lzf/lzf_d.c index ec66b6210d..46d7a14044 100644 --- a/libs/libc/lzf/lzf_d.c +++ b/libs/libc/lzf/lzf_d.c @@ -1,28 +1,30 @@ /**************************************************************************** * libs/libc/lzf/lzf_c.c * - * Copyright (c) 2000-2010 Marc Alexander Lehmann + * Copyright (c) 2000-2010 + * Author: Marc Alexander Lehmann * - * Redistribution and use in source and binary forms, with or without modifica- - * tion, are permitted provided that the following conditions are met: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER- - * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO - * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE- - * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH- - * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MER CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTH- ERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ @@ -204,6 +206,7 @@ unsigned int lzf_decompress (FAR const void *const in_data, set_errno(EINVAL); return 0; } + #endif if (len == 7) { @@ -288,6 +291,7 @@ unsigned int lzf_decompress (FAR const void *const in_data, *op++ = *ref++; case 0: + /* Two octets more */ *op++ = *ref++; diff --git a/libs/libc/machine/arm/arm/arch_elf.c b/libs/libc/machine/arm/arm/arch_elf.c index ba06f37cc2..db1b5d22a5 100644 --- a/libs/libc/machine/arm/arm/arch_elf.c +++ b/libs/libc/machine/arm/arm/arch_elf.c @@ -77,7 +77,8 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr) if (ehdr->e_ident[EI_CLASS] != ELFCLASS32) { - berr("ERROR: Need 32-bit objects: e_ident[EI_CLASS]=%02x\n", ehdr->e_ident[EI_CLASS]); + berr("ERROR: Need 32-bit objects: e_ident[EI_CLASS]=%02x\n", + ehdr->e_ident[EI_CLASS]); return false; } @@ -89,7 +90,8 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr) if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) #endif { - berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n", ehdr->e_ident[EI_DATA]); + berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n", + ehdr->e_ident[EI_DATA]); return false; } @@ -97,11 +99,13 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr) if ((ehdr->e_entry & 3) != 0) { - berr("ERROR: Entry point is not properly aligned: %08x\n", ehdr->e_entry); + berr("ERROR: Entry point is not properly aligned: %08x\n", + ehdr->e_entry); return false; } /* TODO: Check ABI here. */ + return true; } @@ -155,9 +159,12 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, case R_ARM_CALL: case R_ARM_JUMP24: { - binfo("Performing PC24 [%d] link at addr %08lx [%08lx] to sym '%p' st_value=%08lx\n", - ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t *)addr), - sym, (long)sym->st_value); + binfo("Performing PC24 [%d] link", ELF32_R_TYPE(rel->r_info), + binfo(" at addr %08lx [%08lx] to sym '%p' st_value=%08lx\n", + (long)addr, + (long)(*(uint32_t *)addr), + sym, + (long)sym->st_value); offset = (*(uint32_t *)addr & 0x00ffffff) << 2; if (offset & 0x02000000) @@ -166,7 +173,9 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, } offset += sym->st_value - addr; - if (offset & 3 || offset < (int32_t) 0xfe000000 || offset >= (int32_t) 0x02000000) + if (offset & 3 || offset < + (int32_t) 0xfe000000 || offset >= + (int32_t) 0x02000000) { berr("ERROR: PC24 [%d] relocation out of range, offset=%08lx\n", ELF32_R_TYPE(rel->r_info), offset); @@ -184,8 +193,13 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, case R_ARM_ABS32: case R_ARM_TARGET1: /* New ABI: TARGET1 always treated as ABS32 */ { - binfo("Performing ABS32 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", - (long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value); + binfo("Performing ABS32 link"); + binfo(" at addr=%08lx [%08lx] + to sym=%p st_value=%08lx\n", + (long)addr, + (long)(*(uint32_t *)addr), + sym, + (long)sym->st_value); *(uint32_t *)addr += sym->st_value; } @@ -208,8 +222,12 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, case R_ARM_PREL31: { - binfo("Performing PREL31 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", - (long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value); + binfo("Performing PREL31 link at"); + binfo(" addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", + (long)addr, + (long)(*(uint32_t *)addr), + sym, + (long)sym->st_value); offset = *(uint32_t *)addr + sym->st_value - addr; *(uint32_t *)addr = offset & 0x7fffffff; @@ -219,9 +237,11 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, case R_ARM_MOVW_ABS_NC: case R_ARM_MOVT_ABS: { - binfo("Performing MOVx_ABS [%d] link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", - ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t *)addr), - sym, (long)sym->st_value); + binfo("Performing MOVx_ABS [%d] link", ELF32_R_TYPE(rel->r_info)); + binfo(" at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", + (long)addr, (long)(*(uint32_t *)addr), + sym, + (long)sym->st_value); offset = *(uint32_t *)addr; offset = ((offset & 0xf0000) >> 4) | (offset & 0xfff); diff --git a/libs/libc/machine/arm/armv6-m/arch_elf.c b/libs/libc/machine/arm/armv6-m/arch_elf.c index c94088c49e..fd4e0d4734 100644 --- a/libs/libc/machine/arm/armv6-m/arch_elf.c +++ b/libs/libc/machine/arm/armv6-m/arch_elf.c @@ -208,22 +208,22 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, * upper_insn: * * 1 1 1 1 1 1 - * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +----------+---+-------------------------------+--------------+ - * |1 1 1 |OP1| OP2 | | 32-Bit Instructions - * +----------+---+--+-----+----------------------+--------------+ - * |1 1 1 | 1 0| S | imm10 | BL Instruction - * +----------+------+-----+-------------------------------------+ + * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions + * +----------+---+--------------------------+----------+ + * |1 1 1 |OP1| OP2 | | 32-Bit + * +----------+---+--+-----+-----------------+----------+ + * |1 1 1 | 1 0| S | imm10 | BL + * +----------+------+-----+----------------------------+ * * lower_insn: * * 1 1 1 1 1 1 - * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +---+---------------------------------------------------------+ - * |OP | | 32-Bit Instructions - * +---+--+---+---+---+------------------------------------------+ - * |1 1 |J1 | 1 |J2 | imm11 | BL Instruction - * +------+---+---+---+------------------------------------------+ + * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions + * +---+------------------------------------------------+ + * |OP | | 32-Bit + * +---+--+---+---+---+---------------------------------+ + * |1 1 |J1 | 1 |J2 | imm11 | BL + * +------+---+---+---+---------------------------------+ * * The branch target is encoded in these bits: * @@ -381,22 +381,22 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, * upper_insn: * * 1 1 1 1 1 1 - * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +----------+---+-------------------------------+--------------+ - * |1 1 1 |OP1| OP2 | | 32-Bit Instructions - * +----------+---+--+-----+----------------------+--------------+ - * |1 1 1 | 1 0| i | 1 0 1 1 0 0 | imm4 | MOVT Instruction - * +----------+------+-----+----------------------+--------------+ + * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions + * +----------+---+--------------------------+----------+ + * |1 1 1 |OP1| OP2 | | 32-Bit + * +----------+---+--+-----+-----------------+----------+ + * |1 1 1 | 1 0| i |1 0 1 1 0 0 | imm4 | MOVT + * +----------+------+-----+-----------------+----------+ * * lower_insn: * - * 1 1 1 1 1 1 - * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +---+---------------------------------------------------------+ - * |OP | | 32-Bit Instructions - * +---+----------+--------------+-------------------------------+ - * |0 | imm3 | Rd | imm8 | MOVT Instruction - * +---+----------+--------------+-------------------------------+ + * 1 1 1 1 1 1 + * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions + * +---+-----------------------------------------------+ + * |OP | | 32-Bit + * +---+----------+-----------+------------------------+ + * |0 | imm3 | Rd | imm8 | MOVT + * +---+----------+-----------+------------------------+ * * The 16-bit immediate value is encoded in these bits: * diff --git a/libs/libc/machine/arm/armv7-m/arch_elf.c b/libs/libc/machine/arm/armv7-m/arch_elf.c index b0e1354ead..843497ef56 100644 --- a/libs/libc/machine/arm/armv7-m/arch_elf.c +++ b/libs/libc/machine/arm/armv7-m/arch_elf.c @@ -211,22 +211,22 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, * upper_insn: * * 1 1 1 1 1 1 - * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +----------+---+-------------------------------+--------------+ - * |1 1 1 |OP1| OP2 | | 32-Bit Instructions - * +----------+---+--+-----+----------------------+--------------+ - * |1 1 1 | 1 0| S | imm10 | BL Instruction - * +----------+------+-----+-------------------------------------+ + * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions + * +----------+---+--------------------------+----------+ + * |1 1 1 |OP1| OP2 | | 32-Bit + * +----------+---+--+-----+-----------------+----------+ + * |1 1 1 | 1 0| S | imm10 | BL + * +----------+------+-----+----------------------------+ * * lower_insn: * * 1 1 1 1 1 1 - * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +---+---------------------------------------------------------+ - * |OP | | 32-Bit Instructions - * +---+--+---+---+---+------------------------------------------+ - * |1 1 |J1 | 1 |J2 | imm11 | BL Instruction - * +------+---+---+---+------------------------------------------+ + * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions + * +---+------------------------------------------------+ + * |OP | | 32-Bit + * +---+--+---+---+---+---------------------------------+ + * |1 1 |J1 | 1 |J2 | imm11 | BL + * +------+---+---+---+--------------------------------+ * * The branch target is encoded in these bits: * @@ -386,22 +386,22 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, * upper_insn: * * 1 1 1 1 1 1 - * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +----------+---+-------------------------------+--------------+ - * |1 1 1 |OP1| OP2 | | 32-Bit Instructions - * +----------+---+--+-----+----------------------+--------------+ - * |1 1 1 | 1 0| i | 1 0 1 1 0 0 | imm4 | MOVT Instruction - * +----------+------+-----+----------------------+--------------+ + * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instruction + * +----------+---+--------------------------+----------+ + * |1 1 1 |OP1| OP2 | | 32-Bit + * +----------+---+--+-----+-----------------+----------+ + * |1 1 1 | 1 0| i |1 0 1 1 0 0 | imm4 | MOVT + * +----------+------+-----+-----------------+----------+ * * lower_insn: * * 1 1 1 1 1 1 - * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 - * +---+---------------------------------------------------------+ - * |OP | | 32-Bit Instructions - * +---+----------+--------------+-------------------------------+ - * |0 | imm3 | Rd | imm8 | MOVT Instruction - * +---+----------+--------------+-------------------------------+ + * 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 Instructions + * +---+-------------------------------------------------+ + * |OP | | 32-Bit + * +---+----------+--------+-----------------------------+ + * |0 | imm3 | Rd | imm8 | MOVT + * +---+----------+--------+-----------------------------+ * * The 16-bit immediate value is encoded in these bits: * diff --git a/libs/libc/machine/arm/armv7-r/arch_elf.c b/libs/libc/machine/arm/armv7-r/arch_elf.c index 6c1acc453e..edc2b0d176 100644 --- a/libs/libc/machine/arm/armv7-r/arch_elf.c +++ b/libs/libc/machine/arm/armv7-r/arch_elf.c @@ -77,7 +77,8 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr) if (ehdr->e_ident[EI_CLASS] != ELFCLASS32) { - berr("ERROR: Need 32-bit objects: e_ident[EI_CLASS]=%02x\n", ehdr->e_ident[EI_CLASS]); + berr("ERROR: Need 32-bit objects: e_ident[EI_CLASS]=%02x\n", + ehdr->e_ident[EI_CLASS]); return false; } @@ -89,7 +90,8 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr) if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB) #endif { - berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n", ehdr->e_ident[EI_DATA]); + berr("ERROR: Wrong endian-ness: e_ident[EI_DATA]=%02x\n", + ehdr->e_ident[EI_DATA]); return false; } @@ -97,11 +99,13 @@ bool up_checkarch(FAR const Elf32_Ehdr *ehdr) if ((ehdr->e_entry & 3) != 0) { - berr("ERROR: Entry point is not properly aligned: %08x\n", ehdr->e_entry); + berr("ERROR: Entry point is not properly aligned: %08x\n", + ehdr->e_entry); return false; } /* TODO: Check ABI here. */ + return true; } @@ -157,8 +161,9 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, case R_ARM_CALL: case R_ARM_JUMP24: { - binfo("Performing PC24 [%d] link at addr %08lx [%08lx] to sym '%p' st_value=%08lx\n", - ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t *)addr), + binfo("Performing PC24 [%d] link at", ELF32_R_TYPE(rel->r_info)); + binfo(" addr %08lx [%08lx] to sym '%p' st_value=%08lx\n", + (long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value); offset = (*(uint32_t *)addr & 0x00ffffff) << 2; @@ -168,9 +173,10 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, } offset += sym->st_value - addr; - if (offset & 3 || offset < (int32_t) 0xfe000000 || offset >= (int32_t) 0x02000000) + if (offset & 3 || offset < (int32_t) 0xfe000000 || + offset >= (int32_t) 0x02000000) { - berr("ERROR: ERROR: PC24 [%d] relocation out of range, offset=%08lx\n", + berr("ERROR: PC24 [%d] relocation out of range, offset=%08lx\n", ELF32_R_TYPE(rel->r_info), offset); return -EINVAL; @@ -186,8 +192,10 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, case R_ARM_ABS32: case R_ARM_TARGET1: /* New ABI: TARGET1 always treated as ABS32 */ { - binfo("Performing ABS32 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", - (long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value); + binfo("Performing ABS32 link at"); + binfo(" addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", + (long)addr, (long)(*(uint32_t *)addr), sym, + (long)sym->st_value); *(uint32_t *)addr += sym->st_value; } @@ -210,8 +218,10 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, case R_ARM_PREL31: { - binfo("Performing PREL31 link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", - (long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value); + binfo("Performing PREL31 link at"); + binfo(" addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", + (long)addr, (long)(*(uint32_t *)addr), sym, + (long)sym->st_value); offset = *(uint32_t *)addr + sym->st_value - addr; *(uint32_t *)addr = offset & 0x7fffffff; @@ -221,8 +231,9 @@ int up_relocate(FAR const Elf32_Rel *rel, FAR const Elf32_Sym *sym, case R_ARM_MOVW_ABS_NC: case R_ARM_MOVT_ABS: { - binfo("Performing MOVx_ABS [%d] link at addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", - ELF32_R_TYPE(rel->r_info), (long)addr, (long)(*(uint32_t *)addr), + binfo("Performing MOVx_ABS [%d] link at", ELF32_R_TYPE(rel->r_info)); + binfo(" addr=%08lx [%08lx] to sym=%p st_value=%08lx\n", + (long)addr, (long)(*(uint32_t *)addr), sym, (long)sym->st_value); offset = *(uint32_t *)addr; diff --git a/libs/libc/net/lib_htonl.c b/libs/libc/net/lib_htonl.c index 5e5b34944b..f45af5d121 100644 --- a/libs/libc/net/lib_htonl.c +++ b/libs/libc/net/lib_htonl.c @@ -36,10 +36,10 @@ uint32_t htonl(uint32_t hl) #ifdef CONFIG_ENDIAN_BIG return hl; #else - return (( (hl) >> 24) | + return (((hl) >> 24) | (((hl) >> 8) & 0x0000ff00) | (((hl) << 8) & 0x00ff0000) | - ( (hl) << 24)); + ((hl) << 24)); #endif } diff --git a/libs/libc/pthread/pthread_attr_getaffinity.c b/libs/libc/pthread/pthread_attr_getaffinity.c index 47492ed107..f0a1e5567c 100644 --- a/libs/libc/pthread/pthread_attr_getaffinity.c +++ b/libs/libc/pthread/pthread_attr_getaffinity.c @@ -51,9 +51,11 @@ int pthread_attr_getaffinity_np(FAR const pthread_attr_t *attr, size_t cpusetsize, cpu_set_t *cpuset) { - linfo("attr=0x%p cpusetsize=%d cpuset=0x%p\n", attr, (int)cpusetsize, cpuset); + linfo("attr=0x%p cpusetsize=%d cpuset=0x%p\n", + attr, (int)cpusetsize, cpuset); - DEBUGASSERT(attr != NULL && cpusetsize == sizeof(cpu_set_t) && cpuset != NULL); + DEBUGASSERT(attr != NULL && cpusetsize == sizeof(cpu_set_t) && + cpuset != NULL); *cpuset = attr->affinity; return OK; diff --git a/libs/libc/pthread/pthread_attr_setaffinity.c b/libs/libc/pthread/pthread_attr_setaffinity.c index b6cc36e98c..019eba3363 100644 --- a/libs/libc/pthread/pthread_attr_setaffinity.c +++ b/libs/libc/pthread/pthread_attr_setaffinity.c @@ -53,7 +53,8 @@ int pthread_attr_setaffinity_np(FAR pthread_attr_t *attr, size_t cpusetsize, FAR const cpu_set_t *cpuset) { - linfo("attr=0x%p cpusetsize=%d cpuset=0x%p\n", attr, (int)cpusetsize, cpuset); + linfo("attr=0x%p cpusetsize=%d cpuset=0x%p\n", + attr, (int)cpusetsize, cpuset); DEBUGASSERT(attr != NULL && cpusetsize == sizeof(cpu_set_t) && cpuset != NULL && *cpuset != 0); diff --git a/libs/libc/pthread/pthread_barrierattr_destroy.c b/libs/libc/pthread/pthread_barrierattr_destroy.c index 0c5eb29dbb..9b25f5fe25 100644 --- a/libs/libc/pthread/pthread_barrierattr_destroy.c +++ b/libs/libc/pthread/pthread_barrierattr_destroy.c @@ -63,5 +63,6 @@ int pthread_barrierattr_destroy(FAR pthread_barrierattr_t *attr) { attr->pshared = PTHREAD_PROCESS_PRIVATE; } + return ret; } diff --git a/libs/libc/pthread/pthread_barrierattr_getpshared.c b/libs/libc/pthread/pthread_barrierattr_getpshared.c index fa3ef8fea7..ee2bcaba0b 100644 --- a/libs/libc/pthread/pthread_barrierattr_getpshared.c +++ b/libs/libc/pthread/pthread_barrierattr_getpshared.c @@ -50,7 +50,8 @@ * ********************************************************************************/ -int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr, FAR int *pshared) +int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr, + FAR int *pshared) { int ret = OK; @@ -62,5 +63,6 @@ int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr, FAR in { *pshared = attr->pshared; } + return ret; } diff --git a/libs/libc/pthread/pthread_barrierattr_init.c b/libs/libc/pthread/pthread_barrierattr_init.c index e2b857dc19..03def08488 100644 --- a/libs/libc/pthread/pthread_barrierattr_init.c +++ b/libs/libc/pthread/pthread_barrierattr_init.c @@ -62,5 +62,6 @@ int pthread_barrierattr_init(FAR pthread_barrierattr_t *attr) { attr->pshared = PTHREAD_PROCESS_PRIVATE; } + return ret; } diff --git a/libs/libc/pthread/pthread_barrierattr_setpshared.c b/libs/libc/pthread/pthread_barrierattr_setpshared.c index 13a92fade2..2d0abf7979 100644 --- a/libs/libc/pthread/pthread_barrierattr_setpshared.c +++ b/libs/libc/pthread/pthread_barrierattr_setpshared.c @@ -56,25 +56,26 @@ * Name: pthread_barrierattr_setpshared * * Description: - * The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit a - * barrier to be operated upon by any thread that has access to the memory where - * the barrier is allocated. If the process-shared attribute is - * PTHREAD_PROCESS_PRIVATE, the barrier can only be operated upon by threads - * created within the same process as the thread that initialized the barrier. - * If threads of different processes attempt to operate on such a barrier, the - * behavior is undefined. The default value of the attribute is + * The process-shared attribute is set to PTHREAD_PROCESS_SHARED to permit + * a barrier to be operated upon by any thread that has access to the + * memory where the barrier is allocated. If the process-shared attribute + * is PTHREAD_PROCESS_PRIVATE, the barrier can only be operated upon by + * threads created within the same process as the thread that initialized + * the barrier. + * If threads of different processes attempt to operate on such a barrier, + * the behavior is undefined. The default value of the attribute is * PTHREAD_PROCESS_PRIVATE. * - * Both constants PTHREAD_PROCESS_SHARED and PTHREAD_PROCESS_PRIVATE are defined - * in pthread.h. + * Both constants PTHREAD_PROCESS_SHARED and PTHREAD_PROCESS_PRIVATE are + * defined in pthread.h. * * Input Parameters: * attr - barrier attributes to be modified. * pshared - the new value of the pshared attribute. * * Returned Value: - * 0 (OK) on success or EINVAL if either attr is invalid or pshared is not one - * of PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE. + * 0 (OK) on success or EINVAL if either attr is invalid or pshared is not + * one of PTHREAD_PROCESS_SHARED or PTHREAD_PROCESS_PRIVATE. * * Assumptions: * @@ -84,7 +85,8 @@ int pthread_barrierattr_setpshared(FAR pthread_barrierattr_t *attr, int pshared) { int ret = OK; - if (!attr || (pshared != PTHREAD_PROCESS_SHARED && pshared != PTHREAD_PROCESS_PRIVATE)) + if (!attr || (pshared != PTHREAD_PROCESS_SHARED && + pshared != PTHREAD_PROCESS_PRIVATE)) { ret = EINVAL; } @@ -92,5 +94,6 @@ int pthread_barrierattr_setpshared(FAR pthread_barrierattr_t *attr, int pshared) { attr->pshared = pshared; } + return ret; } diff --git a/libs/libc/pthread/pthread_barrierinit.c b/libs/libc/pthread/pthread_barrierinit.c index 91fdc95b35..2dd57374b6 100644 --- a/libs/libc/pthread/pthread_barrierinit.c +++ b/libs/libc/pthread/pthread_barrierinit.c @@ -70,7 +70,8 @@ ****************************************************************************/ int pthread_barrier_init(FAR pthread_barrier_t *barrier, - FAR const pthread_barrierattr_t *attr, unsigned int count) + FAR const pthread_barrierattr_t *attr, + unsigned int count) { int ret = OK; diff --git a/libs/libc/pthread/pthread_mutex_lock.c b/libs/libc/pthread/pthread_mutex_lock.c index e165971fad..88afc3473c 100644 --- a/libs/libc/pthread/pthread_mutex_lock.c +++ b/libs/libc/pthread/pthread_mutex_lock.c @@ -36,9 +36,9 @@ * Description: * The mutex object referenced by mutex is locked by calling * pthread_mutex_lock(). If the mutex is already locked, the calling thread - * blocks until the mutex becomes available. This operation returns with the - * mutex object referenced by mutex in the locked state with the calling - * thread as its owner. + * blocks until the mutex becomes available. This operation returns with + * the mutex object referenced by mutex in the locked state with the + * calling thread as its owner. * * If the mutex type is PTHREAD_MUTEX_NORMAL, deadlock detection is not * provided. Attempting to relock the mutex causes deadlock. If a thread @@ -56,9 +56,9 @@ * for the first time, the lock count is set to one. Every time a thread * relocks this mutex, the lock count is incremented by one. Each time the * thread unlocks the mutex, the lock count is decremented by one. When the - * lock count reaches zero, the mutex becomes available for other threads to - * acquire. If a thread attempts to unlock a mutex that it has not locked or - * a mutex which is unlocked, an error will be returned. + * lock count reaches zero, the mutex becomes available for other threads + * to acquire. If a thread attempts to unlock a mutex that it has not + * locked or a mutex which is unlocked, an error will be returned. * * If a signal is delivered to a thread waiting for a mutex, upon return * from the signal handler the thread resumes waiting for the mutex as if diff --git a/libs/libc/pthread/pthread_mutexattr_getpshared.c b/libs/libc/pthread/pthread_mutexattr_getpshared.c index 91eabddab3..d8a4309b30 100644 --- a/libs/libc/pthread/pthread_mutexattr_getpshared.c +++ b/libs/libc/pthread/pthread_mutexattr_getpshared.c @@ -49,7 +49,8 @@ * ****************************************************************************/ -int pthread_mutexattr_getpshared(FAR const pthread_mutexattr_t *attr, FAR int *pshared) +int pthread_mutexattr_getpshared(FAR const pthread_mutexattr_t *attr, + FAR int *pshared) { int ret = OK; diff --git a/libs/libc/pthread/pthread_mutexattr_setrobust.c b/libs/libc/pthread/pthread_mutexattr_setrobust.c index 61994985ab..5367a15b3a 100644 --- a/libs/libc/pthread/pthread_mutexattr_setrobust.c +++ b/libs/libc/pthread/pthread_mutexattr_setrobust.c @@ -61,7 +61,8 @@ int pthread_mutexattr_setrobust(pthread_mutexattr_t *attr, int robust) #elif defined(CONFIG_PTHREAD_MUTEX_BOTH) - if (attr != NULL && (robust == PTHREAD_MUTEX_STALLED || robust == _PTHREAD_MFLAGS_ROBUST)) + if (attr != NULL && (robust == PTHREAD_MUTEX_STALLED || + robust == _PTHREAD_MFLAGS_ROBUST)) { attr->robust = robust; return OK; diff --git a/libs/libc/pthread/pthread_once.c b/libs/libc/pthread/pthread_once.c index f56742f106..c662f15de8 100644 --- a/libs/libc/pthread/pthread_once.c +++ b/libs/libc/pthread/pthread_once.c @@ -81,7 +81,9 @@ int pthread_once(FAR pthread_once_t *once_control, return OK; } - /* The init_routine has already been called. Restore pre-emption and return */ + /* The init_routine has already been called. + * Restore pre-emption and return + */ sched_unlock(); return OK; diff --git a/libs/libc/pthread/pthread_setcancelstate.c b/libs/libc/pthread/pthread_setcancelstate.c index baf51c383b..adea78cbae 100644 --- a/libs/libc/pthread/pthread_setcancelstate.c +++ b/libs/libc/pthread/pthread_setcancelstate.c @@ -31,7 +31,10 @@ /**************************************************************************** * Public Functions ****************************************************************************/ -/* These are defined in different header files but must have the same values. */ + +/* These are defined in different header files but must have the same + * values. + */ #if PTHREAD_CANCEL_ENABLE != TASK_CANCEL_ENABLE # error We must have PTHREAD_CANCEL_ENABLE == TASK_CANCEL_ENABLE diff --git a/libs/libc/pthread/pthread_setcanceltype.c b/libs/libc/pthread/pthread_setcanceltype.c index a348a3952d..3587e4eee1 100644 --- a/libs/libc/pthread/pthread_setcanceltype.c +++ b/libs/libc/pthread/pthread_setcanceltype.c @@ -29,6 +29,7 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ + /* The following are defined in different header files but must have the * same values. */ diff --git a/libs/libc/pthread/pthread_spinlock.c b/libs/libc/pthread/pthread_spinlock.c index 53df9790d3..83d97c700e 100644 --- a/libs/libc/pthread/pthread_spinlock.c +++ b/libs/libc/pthread/pthread_spinlock.c @@ -181,9 +181,10 @@ int pthread_spin_lock(pthread_spinlock_t *lock) } /* Loop until we successfully take the spinlock (i.e., until the previous - * state of the spinlock was SP_UNLOCKED). NOTE that the test/set operaion - * is performed via boardctl() to avoid a variety of issues. An option - * might be to move the implementation of up_testset() to libs/libc/machine. + * state of the spinlock was SP_UNLOCKED). + * NOTE that the test/set operaion is performed via boardctl() to avoid a + * variety of issues. An option might be to move the implementation of + * up_testset() to libs/libc/machine. */ do diff --git a/libs/libc/pwd/lib_pwd_globals.c b/libs/libc/pwd/lib_pwd_globals.c index 38662185a6..dc64df1bec 100644 --- a/libs/libc/pwd/lib_pwd_globals.c +++ b/libs/libc/pwd/lib_pwd_globals.c @@ -37,4 +37,8 @@ struct passwd g_passwd; char g_passwd_buffer[CONFIG_LIBC_PASSWD_LINESIZE]; +/**************************************************************************** + * Public Functions + ****************************************************************************/ + #endif /* CONFIG_LIBC_GROUP_FILE */ diff --git a/libs/libc/queue/sq_rem.c b/libs/libc/queue/sq_rem.c index fa13dfa2cd..2b5ddd0e29 100644 --- a/libs/libc/queue/sq_rem.c +++ b/libs/libc/queue/sq_rem.c @@ -25,7 +25,7 @@ #include /**************************************************************************** - * public Functions + * Public Functions ****************************************************************************/ /**************************************************************************** diff --git a/libs/libc/signal/sig_signal.c b/libs/libc/signal/sig_signal.c index 095d9da870..506c070234 100644 --- a/libs/libc/signal/sig_signal.c +++ b/libs/libc/signal/sig_signal.c @@ -100,9 +100,9 @@ _sa_handler_t signal(int signo, _sa_handler_t func) */ if (ret == OK) - { - return oact.sa_handler; - } + { + return oact.sa_handler; + } return (_sa_handler_t)SIG_ERR; } diff --git a/libs/libc/spawn/lib_psa_init.c b/libs/libc/spawn/lib_psa_init.c index dcee8fe639..dfd6a0ea32 100644 --- a/libs/libc/spawn/lib_psa_init.c +++ b/libs/libc/spawn/lib_psa_init.c @@ -98,7 +98,6 @@ int posix_spawnattr_init(posix_spawnattr_t *attr) attr->budget.tv_nsec = param.sched_ss_init_budget.tv_nsec; #endif - #ifndef CONFIG_ARCH_ADDRENV /* Default stack size */ diff --git a/libs/libc/spawn/lib_psa_setstacksize.c b/libs/libc/spawn/lib_psa_setstacksize.c index 23174638cd..dc54f0f1d1 100644 --- a/libs/libc/spawn/lib_psa_setstacksize.c +++ b/libs/libc/spawn/lib_psa_setstacksize.c @@ -52,7 +52,8 @@ * ****************************************************************************/ -int task_spawnattr_setstacksize(FAR posix_spawnattr_t *attr, size_t stacksize) +int task_spawnattr_setstacksize(FAR posix_spawnattr_t *attr, + size_t stacksize) { DEBUGASSERT(attr); attr->stacksize = stacksize; diff --git a/libs/libc/spawn/lib_psfa_addaction.c b/libs/libc/spawn/lib_psfa_addaction.c index af38c302d2..7b4f6cad25 100644 --- a/libs/libc/spawn/lib_psfa_addaction.c +++ b/libs/libc/spawn/lib_psfa_addaction.c @@ -55,7 +55,8 @@ void add_file_action(FAR posix_spawn_file_actions_t *file_actions, /* Find the end of the list */ - for (prev = NULL, next = (FAR struct spawn_general_file_action_s *)*file_actions; + for (prev = NULL, + next = (FAR struct spawn_general_file_action_s *)*file_actions; next; prev = next, next = next->flink); diff --git a/libs/libc/spawn/lib_psfa_addclose.c b/libs/libc/spawn/lib_psfa_addclose.c index 46f87f6e2f..092bbcf030 100644 --- a/libs/libc/spawn/lib_psfa_addclose.c +++ b/libs/libc/spawn/lib_psfa_addclose.c @@ -58,8 +58,9 @@ * ****************************************************************************/ -int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *file_actions, - int fd) +int posix_spawn_file_actions_addclose( + FAR posix_spawn_file_actions_t *file_actions, + int fd) { FAR struct spawn_close_file_action_s *entry; @@ -82,6 +83,7 @@ int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *file_actio /* And add it to the file action list */ - add_file_action(file_actions, (FAR struct spawn_general_file_action_s *)entry); + add_file_action(file_actions, + (FAR struct spawn_general_file_action_s *)entry); return OK; } diff --git a/libs/libc/spawn/lib_psfa_adddup2.c b/libs/libc/spawn/lib_psfa_adddup2.c index a25eb5271a..b113d8f599 100644 --- a/libs/libc/spawn/lib_psfa_adddup2.c +++ b/libs/libc/spawn/lib_psfa_adddup2.c @@ -59,8 +59,9 @@ * ****************************************************************************/ -int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *file_actions, - int fd1, int fd2) +int posix_spawn_file_actions_adddup2( + FAR posix_spawn_file_actions_t *file_actions, + int fd1, int fd2) { FAR struct spawn_dup2_file_action_s *entry; @@ -86,6 +87,7 @@ int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *file_action /* And add it to the file action list */ - add_file_action(file_actions, (FAR struct spawn_general_file_action_s *)entry); + add_file_action(file_actions, + (FAR struct spawn_general_file_action_s *)entry); return OK; } diff --git a/libs/libc/spawn/lib_psfa_destroy.c b/libs/libc/spawn/lib_psfa_destroy.c index c53dc24982..78915a4715 100644 --- a/libs/libc/spawn/lib_psfa_destroy.c +++ b/libs/libc/spawn/lib_psfa_destroy.c @@ -57,7 +57,8 @@ * ****************************************************************************/ -int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *file_actions) +int posix_spawn_file_actions_destroy( + FAR posix_spawn_file_actions_t *file_actions) { FAR struct spawn_general_file_action_s *curr; FAR struct spawn_general_file_action_s *next; @@ -70,7 +71,9 @@ int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *file_action curr; curr = next) { - /* Get the pointer to the next element before destroying the current one */ + /* Get the pointer to the next element before destroying the current + * one + */ next = curr->flink; lib_free(curr); diff --git a/libs/libc/spawn/lib_psfa_dump.c b/libs/libc/spawn/lib_psfa_dump.c index 64f1ea88d0..444a33b851 100644 --- a/libs/libc/spawn/lib_psfa_dump.c +++ b/libs/libc/spawn/lib_psfa_dump.c @@ -59,7 +59,8 @@ * ****************************************************************************/ -void posix_spawn_file_actions_dump(FAR posix_spawn_file_actions_t *file_actions) +void posix_spawn_file_actions_dump( + FAR posix_spawn_file_actions_t *file_actions) { FAR struct spawn_general_file_action_s *entry; diff --git a/libs/libc/spawn/lib_psfa_init.c b/libs/libc/spawn/lib_psfa_init.c index c84de717c7..5c0ff143ba 100644 --- a/libs/libc/spawn/lib_psfa_init.c +++ b/libs/libc/spawn/lib_psfa_init.c @@ -48,7 +48,8 @@ * ****************************************************************************/ -int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *file_actions) +int posix_spawn_file_actions_init( + FAR posix_spawn_file_actions_t *file_actions) { *file_actions = NULL; return OK; diff --git a/libs/libc/stdio/legacy_libvsprintf.c b/libs/libc/stdio/legacy_libvsprintf.c index 16cb2b60e3..124317de66 100644 --- a/libs/libc/stdio/legacy_libvsprintf.c +++ b/libs/libc/stdio/legacy_libvsprintf.c @@ -34,6 +34,12 @@ #include "libc.h" +/* Include floating point functions */ + +#ifdef CONFIG_LIBC_FLOATINGPOINT +# include "stdio/lib_libdtoa.c" +#endif + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -193,12 +199,6 @@ static const char g_nullstring[] = "(null)"; * Private Functions ****************************************************************************/ -/* Include floating point functions */ - -#ifdef CONFIG_LIBC_FLOATINGPOINT -# include "stdio/lib_libdtoa.c" -#endif - /**************************************************************************** * Name: ptohex ****************************************************************************/ diff --git a/libs/libc/stdio/lib_fgetpos.c b/libs/libc/stdio/lib_fgetpos.c index e8c1874400..465f89ce5a 100644 --- a/libs/libc/stdio/lib_fgetpos.c +++ b/libs/libc/stdio/lib_fgetpos.c @@ -39,10 +39,10 @@ * * Description: * fgetpos() function is an alternate interfaces equivalent to ftell(). - * It gets the current value of the file offset and store it in the location - * referenced by pos. On some non-UNIX systems an fpos_t object may be a - * complex object and fsetpos may be the only way to portably reposition a - * stream. + * It gets the current value of the file offset and store it in the + * location referenced by pos. On some non-UNIX systems an fpos_t object + * may be a complex object and fsetpos may be the only way to portably + * reposition a stream. * * Returned Value: * Zero on succes; -1 on failure with errno set appropriately. diff --git a/libs/libc/stdio/lib_fseek.c b/libs/libc/stdio/lib_fseek.c index 507ec38b17..3ed6f8c8ee 100644 --- a/libs/libc/stdio/lib_fseek.c +++ b/libs/libc/stdio/lib_fseek.c @@ -46,8 +46,8 @@ * set to SEEK_SET, SEEK_CUR, or SEEK_END, the offset is relative to the * start of the file, the current position indicator, or end-of-file, * respectively. A successful call to the fseek() function clears the - * end-of-file indicator for the stream and undoes any effects of the ungetc(3) - * function on the same stream. + * end-of-file indicator for the stream and undoes any effects of the + * ungetc(3) function on the same stream. * * Returned Value: * Zero on succes; -1 on failure with errno set appropriately. diff --git a/libs/libc/stdio/lib_ftell.c b/libs/libc/stdio/lib_ftell.c index eaae5f66b5..ff93622fb4 100644 --- a/libs/libc/stdio/lib_ftell.c +++ b/libs/libc/stdio/lib_ftell.c @@ -55,10 +55,13 @@ static off_t lib_getrdoffset(FAR FILE *stream) off_t rdoffset = 0; lib_take_semaphore(stream); - if (stream->fs_bufstart != NULL && stream->fs_bufread != stream->fs_bufstart) + if (stream->fs_bufstart != + NULL && stream->fs_bufread != + stream->fs_bufstart) { #if CONFIG_NUNGET_CHARS > 0 - rdoffset = stream->fs_bufread - stream->fs_bufpos + stream->fs_nungotten; + rdoffset = stream->fs_bufread - stream->fs_bufpos + + stream->fs_nungotten; #else rdoffset = stream->fs_bufread - stream->fs_bufpos; #endif diff --git a/libs/libc/stdio/lib_libfflush.c b/libs/libc/stdio/lib_libfflush.c index ca1587d800..f44dc22a28 100644 --- a/libs/libc/stdio/lib_libfflush.c +++ b/libs/libc/stdio/lib_libfflush.c @@ -42,8 +42,8 @@ * Name: lib_fflush * * Description: - * The function lib_fflush() forces a write of all user-space buffered data for - * the given output or update stream via the stream's underlying write + * The function lib_fflush() forces a write of all user-space buffered data + * for the given output or update stream via the stream's underlying write * function. The open status of the stream is unaffected. * * Input Parameters: @@ -83,7 +83,7 @@ ssize_t lib_fflush(FAR FILE *stream, bool bforce) ret = 0; goto errout_with_sem; - } + } /* Make sure that the buffer holds valid data */ @@ -146,10 +146,10 @@ ssize_t lib_fflush(FAR FILE *stream, bool bforce) */ while (nbuffer) - { - *stream->fs_bufpos++ = *src++; - --nbuffer; - } + { + *stream->fs_bufpos++ = *src++; + --nbuffer; + } } /* Restore normal access to the stream and return the number of bytes diff --git a/libs/libc/stdio/lib_libfgets.c b/libs/libc/stdio/lib_libfgets.c index 35ed8d34bf..29a36f023e 100644 --- a/libs/libc/stdio/lib_libfgets.c +++ b/libs/libc/stdio/lib_libfgets.c @@ -74,9 +74,9 @@ * Name: consume_eol * * Description: - * If 'consume' is true, then consume_eol() will read and discard bytes from - * 'stream' until an EOF or a newline encountered or until a read error - * occurs. + * If 'consume' is true, then consume_eol() will read and discard bytes + * from 'stream' until an EOF or a newline encountered or until a read + * error occurs. * ****************************************************************************/ diff --git a/libs/libc/stdio/lib_memoutstream.c b/libs/libc/stdio/lib_memoutstream.c index e226cb0df2..2fba9b00f2 100644 --- a/libs/libc/stdio/lib_memoutstream.c +++ b/libs/libc/stdio/lib_memoutstream.c @@ -36,7 +36,8 @@ static void memoutstream_putc(FAR struct lib_outstream_s *this, int ch) { - FAR struct lib_memoutstream_s *mthis = (FAR struct lib_memoutstream_s *)this; + FAR struct lib_memoutstream_s *mthis = + (FAR struct lib_memoutstream_s *)this; DEBUGASSERT(this); diff --git a/libs/libc/stdio/lib_rawsostream.c b/libs/libc/stdio/lib_rawsostream.c index aade640e22..e584900017 100644 --- a/libs/libc/stdio/lib_rawsostream.c +++ b/libs/libc/stdio/lib_rawsostream.c @@ -42,7 +42,8 @@ static void rawoutstream_putc(FAR struct lib_outstream_s *this, int ch) { - FAR struct lib_rawoutstream_s *rthis = (FAR struct lib_rawoutstream_s *)this; + FAR struct lib_rawoutstream_s *rthis = + (FAR struct lib_rawoutstream_s *)this; char buffer = ch; int nwritten; int errcode; diff --git a/libs/libc/stdio/lib_rdflush.c b/libs/libc/stdio/lib_rdflush.c index f996d629c2..be7d097dbe 100644 --- a/libs/libc/stdio/lib_rdflush.c +++ b/libs/libc/stdio/lib_rdflush.c @@ -68,30 +68,33 @@ int lib_rdflush(FAR FILE *stream) lib_take_semaphore(stream); /* If the buffer is currently being used for read access, then discard all - * of the read-ahead data. We do not support concurrent buffered read/write + * of the read-ahead data. We do not support concurrent buffered read/write * access. */ if (stream->fs_bufread != stream->fs_bufstart) { - /* Now adjust the stream pointer to account for the read-ahead data that - * was not actually read by the user. + /* Now adjust the stream pointer to account for the read-ahead data + * that was not actually read by the user. */ #if CONFIG_NUNGET_CHARS > 0 - off_t rdoffset = stream->fs_bufread - stream->fs_bufpos + stream->fs_nungotten; + off_t rdoffset = stream->fs_bufread - stream->fs_bufpos + + stream->fs_nungotten; #else off_t rdoffset = stream->fs_bufread - stream->fs_bufpos; #endif - /* Mark the buffer as empty (do this before calling fseek() because fseek() - * also calls this function). + /* Mark the buffer as empty (do this before calling fseek() because + * fseek() also calls this function). */ stream->fs_bufpos = stream->fs_bufread = stream->fs_bufstart; #if CONFIG_NUNGET_CHARS > 0 stream->fs_nungotten = 0; #endif - /* Then seek to the position corresponding to the last data read by the user */ + /* Then seek to the position corresponding to the last data read by the + * user + */ if (fseek(stream, -rdoffset, SEEK_CUR) < 0) { diff --git a/libs/libc/stdio/lib_snprintf.c b/libs/libc/stdio/lib_snprintf.c index 1d5049c5e2..4ab70bbe4c 100644 --- a/libs/libc/stdio/lib_snprintf.c +++ b/libs/libc/stdio/lib_snprintf.c @@ -51,8 +51,8 @@ int snprintf(FAR char *buf, size_t size, FAR const IPTR char *format, ...) /* "If the value of [size] is zero on a call to snprintf(), nothing shall * be written, the number of bytes that would have been written had [size] - * been sufficiently large excluding the terminating null shall be returned, - * and [buf] may be a null pointer." -- opengroup.org + * been sufficiently large excluding the terminating null shall be + * returned, and [buf] may be a null pointer." -- opengroup.org */ if (size > 0) diff --git a/libs/libc/stdio/lib_stdoutstream.c b/libs/libc/stdio/lib_stdoutstream.c index 9e4ba2dd84..beb4157b37 100644 --- a/libs/libc/stdio/lib_stdoutstream.c +++ b/libs/libc/stdio/lib_stdoutstream.c @@ -38,7 +38,8 @@ static void stdoutstream_putc(FAR struct lib_outstream_s *this, int ch) { - FAR struct lib_stdoutstream_s *sthis = (FAR struct lib_stdoutstream_s *)this; + FAR struct lib_stdoutstream_s *sthis = + (FAR struct lib_stdoutstream_s *)this; int result; DEBUGASSERT(this && sthis->stream); @@ -70,7 +71,8 @@ static void stdoutstream_putc(FAR struct lib_outstream_s *this, int ch) #ifndef CONFIG_STDIO_DISABLE_BUFFERING static int stdoutstream_flush(FAR struct lib_outstream_s *this) { - FAR struct lib_stdoutstream_s *sthis = (FAR struct lib_stdoutstream_s *)this; + FAR struct lib_stdoutstream_s *sthis = + (FAR struct lib_stdoutstream_s *)this; DEBUGASSERT(sthis != NULL && sthis->stream != NULL); return lib_fflush(sthis->stream, true); diff --git a/libs/libc/stdlib/lib_abort.c b/libs/libc/stdlib/lib_abort.c index ed130f6bb7..903e3f6223 100644 --- a/libs/libc/stdlib/lib_abort.c +++ b/libs/libc/stdlib/lib_abort.c @@ -65,8 +65,9 @@ void abort(void) * * Note that pthread_exit() is called instead of exit(). That is because * we do no know if abort was called from a pthread or a normal thread - * (we could find out, of course). If abort() is called from a non-pthread, - * then pthread_exit() should fail and fall back to call exit() anyway. + * (we could find out, of course). If abort() is called from a + * non-pthread, then pthread_exit() should fail and fall back to call + * exit() anyway. * * If exit() is called (either below or via pthread_exit()), then exit() * will flush and close all open files and terminate the thread. If this diff --git a/libs/libc/stdlib/lib_abs.c b/libs/libc/stdlib/lib_abs.c index ce695631c7..7926406bcd 100644 --- a/libs/libc/stdlib/lib_abs.c +++ b/libs/libc/stdlib/lib_abs.c @@ -35,5 +35,6 @@ int abs(int j) { j = -j; } + return j; } diff --git a/libs/libc/stdlib/lib_checkbase.c b/libs/libc/stdlib/lib_checkbase.c index d399b9b9ba..0cd0546f3a 100644 --- a/libs/libc/stdlib/lib_checkbase.c +++ b/libs/libc/stdlib/lib_checkbase.c @@ -63,7 +63,9 @@ int lib_checkbase(int base, FAR const char **pptr) base = 10; - /* Check for leading '0' - that would signify octal or hex (or binary) */ + /* Check for leading '0' - that would signify octal + * or hex (or binary) + */ if (*ptr == '0') { @@ -83,7 +85,9 @@ int lib_checkbase(int base, FAR const char **pptr) } } - /* If it a hexadecimal representation, than discard any leading "0X" or "0x" */ + /* If it a hexadecimal representation, + * than discard any leading "0X" or "0x" + */ else if (base == 16) { diff --git a/libs/libc/stdlib/lib_labs.c b/libs/libc/stdlib/lib_labs.c index b90e7a3f56..0f8f9ff01e 100644 --- a/libs/libc/stdlib/lib_labs.c +++ b/libs/libc/stdlib/lib_labs.c @@ -35,5 +35,6 @@ long int labs(long int j) { j = -j; } + return j; } diff --git a/libs/libc/stdlib/lib_llabs.c b/libs/libc/stdlib/lib_llabs.c index 8c42038610..5eb29cdf43 100644 --- a/libs/libc/stdlib/lib_llabs.c +++ b/libs/libc/stdlib/lib_llabs.c @@ -37,6 +37,7 @@ long long int llabs(long long int j) { j = -j; } + return j; } #endif diff --git a/libs/libc/string/lib_ffsl.c b/libs/libc/string/lib_ffsl.c index 9831cb3ce3..a5b5f877e6 100644 --- a/libs/libc/string/lib_ffsl.c +++ b/libs/libc/string/lib_ffsl.c @@ -39,8 +39,8 @@ * Name: ffsl * * Description: - * The ffsl() function will find the first bit set (beginning with the least - * significant bit) in j, and return the index of that bit. Bits are + * The ffsl() function will find the first bit set (beginning with the + * least significant bit) in j, and return the index of that bit. Bits are * numbered starting at one (the least significant bit). * * Returned Value: diff --git a/libs/libc/string/lib_ffsll.c b/libs/libc/string/lib_ffsll.c index 4eff4eac0f..d2d71b485c 100644 --- a/libs/libc/string/lib_ffsll.c +++ b/libs/libc/string/lib_ffsll.c @@ -41,8 +41,8 @@ * Name: ffsll * * Description: - * The ffsll() function will find the first bit set (beginning with the least - * significant bit) in i, and return the index of that bit. Bits are + * The ffsll() function will find the first bit set (beginning with the + * least significant bit) in i, and return the index of that bit. Bits are * numbered starting at one (the least significant bit). * * Returned Value: diff --git a/libs/libc/string/lib_isbasedigit.c b/libs/libc/string/lib_isbasedigit.c index 18274fe714..cb201af6f1 100644 --- a/libs/libc/string/lib_isbasedigit.c +++ b/libs/libc/string/lib_isbasedigit.c @@ -84,5 +84,6 @@ bool lib_isbasedigit(int ch, int base, int *value) { *value = tmp; } + return ret; } diff --git a/libs/libc/string/lib_memcmp.c b/libs/libc/string/lib_memcmp.c index 40d154ac84..21918597b8 100644 --- a/libs/libc/string/lib_memcmp.c +++ b/libs/libc/string/lib_memcmp.c @@ -50,6 +50,7 @@ int memcmp(FAR const void *s1, FAR const void *s2, size_t n) p1++; p2++; } + return 0; } #endif diff --git a/libs/libc/string/lib_memset.c b/libs/libc/string/lib_memset.c index d9b9158ab2..961843ac09 100644 --- a/libs/libc/string/lib_memset.c +++ b/libs/libc/string/lib_memset.c @@ -18,7 +18,6 @@ * ****************************************************************************/ - /**************************************************************************** * Included Files ****************************************************************************/ @@ -164,7 +163,7 @@ FAR void *memset(FAR void *s, int c, size_t n) #else /* This version is optimized for size */ - FAR unsigned char *p = (FAR unsigned char*)s; + FAR unsigned char *p = (FAR unsigned char *)s; while (n-- > 0) *p++ = c; #endif return s; diff --git a/libs/libc/string/lib_skipspace.c b/libs/libc/string/lib_skipspace.c index 4b4e7a2932..74872c1479 100644 --- a/libs/libc/string/lib_skipspace.c +++ b/libs/libc/string/lib_skipspace.c @@ -46,7 +46,7 @@ void lib_skipspace(const char **pptr) { - const char *ptr = *pptr; - while (isspace(*ptr)) ptr++; - *pptr = ptr; + const char *ptr = *pptr; + while (isspace(*ptr)) ptr++; + *pptr = ptr; } diff --git a/libs/libc/string/lib_strcasecmp.c b/libs/libc/string/lib_strcasecmp.c index 93878e1c95..1cf59fe0dc 100644 --- a/libs/libc/string/lib_strcasecmp.c +++ b/libs/libc/string/lib_strcasecmp.c @@ -45,6 +45,7 @@ int strcasecmp(FAR const char *cs, FAR const char *ct) cs++; ct++; } + return result; } #endif diff --git a/libs/libc/string/lib_strcasestr.c b/libs/libc/string/lib_strcasestr.c index 6db60323f8..e63e644a73 100644 --- a/libs/libc/string/lib_strcasestr.c +++ b/libs/libc/string/lib_strcasestr.c @@ -97,7 +97,9 @@ FAR char *strcasestr(FAR const char *str, FAR const char *substr) return NULL; } - /* Check if this is the beginning of a matching substring (ignoring case) */ + /* Check if this is the beginning of a matching substring + * (ignoring case) + */ if (strncasecmp(candidate, substr, len) == 0) { @@ -113,8 +115,8 @@ FAR char *strcasestr(FAR const char *str, FAR const char *substr) candidate++; } - /* Won't get here, but some compilers might complain. Others might complain - * about this code being unreachable too. + /* Won't get here, but some compilers might complain. Others might + * complain about this code being unreachable too. */ return NULL; diff --git a/libs/libc/string/lib_strcat.c b/libs/libc/string/lib_strcat.c index 59f47070d8..06f6feff97 100644 --- a/libs/libc/string/lib_strcat.c +++ b/libs/libc/string/lib_strcat.c @@ -40,6 +40,7 @@ char *strcat(char *dest, const char *src) { *dest++ = *src++; } + *dest = '\0'; return ret; diff --git a/libs/libc/string/lib_strdup.c b/libs/libc/string/lib_strdup.c index 45c40ad0cb..82c42dbdfc 100644 --- a/libs/libc/string/lib_strdup.c +++ b/libs/libc/string/lib_strdup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libs/libc/string//lib_strdup.c + * libs/libc/string/lib_strdup.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with diff --git a/libs/libc/string/lib_strncasecmp.c b/libs/libc/string/lib_strncasecmp.c index e0ed86876b..9a2cb52db1 100644 --- a/libs/libc/string/lib_strncasecmp.c +++ b/libs/libc/string/lib_strncasecmp.c @@ -46,6 +46,7 @@ int strncasecmp(const char *cs, const char *ct, size_t nb) cs++; ct++; } + return result; } #endif diff --git a/libs/libc/string/lib_strncat.c b/libs/libc/string/lib_strncat.c index e9b38e4cac..c9cf3efa0d 100644 --- a/libs/libc/string/lib_strncat.c +++ b/libs/libc/string/lib_strncat.c @@ -40,6 +40,7 @@ char *strncat(char *dest, const char *src, size_t n) { *dest++ = *src++; } + *dest = '\0'; return ret; diff --git a/libs/libc/string/lib_strndup.c b/libs/libc/string/lib_strndup.c index 95c2c63b6a..07b124ed17 100644 --- a/libs/libc/string/lib_strndup.c +++ b/libs/libc/string/lib_strndup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libs/libc/string//lib_strndup.c + * libs/libc/string/lib_strndup.c * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with @@ -31,6 +31,7 @@ /**************************************************************************** * Public Functions ****************************************************************************/ + /**************************************************************************** * Name: strndup * diff --git a/libs/libc/string/lib_strpbrk.c b/libs/libc/string/lib_strpbrk.c index b774a9f2e9..1f3ca0eb64 100644 --- a/libs/libc/string/lib_strpbrk.c +++ b/libs/libc/string/lib_strpbrk.c @@ -45,7 +45,9 @@ FAR char *strpbrk(FAR const char *str, FAR const char *charset) while (*str) { - /* Check if the character from the string matches any character in the charset */ + /* Check if the character from the string matches any character in the + * charset + */ if (strchr(charset, *str) != NULL) { @@ -54,15 +56,15 @@ FAR char *strpbrk(FAR const char *str, FAR const char *charset) return (FAR char *)str; } - /* This character from the strings matches none of those in the charset. - * Try the next character from the string. + /* This character from the strings matches none of those in the + * charset. Try the next character from the string. */ str++; } - /* We have looked at every character in the string, and none of them match any of - * the characters in charset. + /* We have looked at every character in the string, and none of them match + * any of the characters in charset. */ return NULL; diff --git a/libs/libc/symtab/symtab_findbyname.c b/libs/libc/symtab/symtab_findbyname.c index ff7499bffd..ce80cc0f5a 100644 --- a/libs/libc/symtab/symtab_findbyname.c +++ b/libs/libc/symtab/symtab_findbyname.c @@ -61,5 +61,6 @@ symtab_findbyname(FAR const struct symtab_s *symtab, return symtab; } } + return NULL; } diff --git a/libs/libc/symtab/symtab_findbyvalue.c b/libs/libc/symtab/symtab_findbyvalue.c index 184f5cae40..1c68405d05 100644 --- a/libs/libc/symtab/symtab_findbyvalue.c +++ b/libs/libc/symtab/symtab_findbyvalue.c @@ -40,9 +40,9 @@ * * Description: * Find the symbol in the symbol table whose value closest (but not greater - * than), the provided value. This version assumes that table is not ordered - * with respect to symbol name and, hence, access time will be linear with - * respect to nsyms. + * than), the provided value. This version assumes that table is not + * ordered with respect to symbol name and, hence, access time will be + * linear with respect to nsyms. * * Returned Value: * A reference to the symbol table entry if an entry with the matching @@ -59,7 +59,9 @@ symtab_findbyvalue(FAR const struct symtab_s *symtab, DEBUGASSERT(symtab != NULL); for (; nsyms > 0; symtab++, nsyms--) { - /* Look for symbols of lesser or equal value (probably address) to value */ + /* Look for symbols of lesser or equal value (probably address) to + * value + */ if (symtab->sym_value <= value) { @@ -73,8 +75,9 @@ symtab_findbyvalue(FAR const struct symtab_s *symtab, retval = symtab; - /* If it is exactly equal to the search 'value', then we might as - * well terminate early because we can't do any better than that. + /* If it is exactly equal to the search 'value', then we might + * as well terminate early because we can't do any better than + * that. */ if (retval->sym_value == value) diff --git a/libs/libc/symtab/symtab_findorderedbyname.c b/libs/libc/symtab/symtab_findorderedbyname.c index 4475d9e474..fa690033e5 100644 --- a/libs/libc/symtab/symtab_findorderedbyname.c +++ b/libs/libc/symtab/symtab_findorderedbyname.c @@ -102,8 +102,8 @@ symtab_findorderedbyname(FAR const struct symtab_s *symtab, * the final symtab[] name. * * Example: Only the last pass through loop, suppose low = 1, high = 2, - * mid = 1, and symtab[high].sym_name == name. Then we would get here with - * low = 2, high = 2, but symtab[2].sym_name was never tested. + * mid = 1, and symtab[high].sym_name == name. Then we would get here + * with low = 2, high = 2, but symtab[2].sym_name was never tested. */ return strcmp(name, symtab[low].sym_name) == 0 ? &symtab[low] : NULL; diff --git a/libs/libc/termios/lib_tcflow.c b/libs/libc/termios/lib_tcflow.c index 9ce82a8605..0b5456f6ce 100644 --- a/libs/libc/termios/lib_tcflow.c +++ b/libs/libc/termios/lib_tcflow.c @@ -55,8 +55,8 @@ * intended to cause the terminal device to start * transmitting data to the system. * - * The default on the opening of a terminal file is that neither its input nor - * its output are suspended. + * The default on the opening of a terminal file is that neither its input + * nor its output are suspended. * * Returned Value: * Upon successful completion, 0 is returned. Otherwise, -1 is returned and diff --git a/libs/libc/termios/lib_tcflush.c b/libs/libc/termios/lib_tcflush.c index 47a739533a..88b35a2bc2 100644 --- a/libs/libc/termios/lib_tcflush.c +++ b/libs/libc/termios/lib_tcflush.c @@ -42,7 +42,8 @@ * Function for flushing a terminal/serial device * * Input Parameters: - * fd - The 'fd' argument is an open file descriptor associated with a terminal. + * fd - The 'fd' argument is an open file descriptor associated with a + * terminal. * cmd - The TCFLSH ioctl argument. * * Returned Value: diff --git a/libs/libc/termios/lib_tcgetattr.c b/libs/libc/termios/lib_tcgetattr.c index a6af3f86be..61dae53a0b 100644 --- a/libs/libc/termios/lib_tcgetattr.c +++ b/libs/libc/termios/lib_tcgetattr.c @@ -44,12 +44,14 @@ * referenced by 'termiosp'. * * Input Parameters: - * fd - The 'fd' argument is an open file descriptor associated with a terminal. + * fd - The 'fd' argument is an open file descriptor associated with a + * terminal. * termiosp - The termiosp argument is a pointer to a termios structure. * * Returned Value: * Upon successful completion, 0 is returned. Otherwise, -1 is returned and - * errno is set to indicate the error. The following errors may be reported: + * errno is set to indicate the error. + * The following errors may be reported: * * - EBADF: The 'fd' argument is not a valid file descriptor. * - ENOTTY: The file associated with 'fd' is not a terminal. diff --git a/libs/libc/termios/lib_tcsetattr.c b/libs/libc/termios/lib_tcsetattr.c index 05347555b1..e93bf584ea 100644 --- a/libs/libc/termios/lib_tcsetattr.c +++ b/libs/libc/termios/lib_tcsetattr.c @@ -46,8 +46,8 @@ * If 'options' is TCSANOW, the change will occur immediately. * * If 'options' is TCSADRAIN, the change will occur after all output - * written to 'fd' is transmitted. This function should be used when changing - * parameters that affect output. + * written to 'fd' is transmitted. This function should be used when + * changing parameters that affect output. * * If 'options' is TCSAFLUSH, the change will occur after all * output written to 'fd' is transmitted, and all input so far received but diff --git a/libs/libc/time/lib_calendar2utc.c b/libs/libc/time/lib_calendar2utc.c index a774bfa5ca..1be1fdb89d 100644 --- a/libs/libc/time/lib_calendar2utc.c +++ b/libs/libc/time/lib_calendar2utc.c @@ -54,17 +54,17 @@ static time_t clock_gregorian2utc(int year, int month, int day) temp = (month <= 2 ? -1:0); - return (1461*(year + 4800 + temp))/4 - + (367*(month - 2 - 12*temp))/12 - - (3*((year + 4900 + temp)/100))/4 + day - 32075; + return (1461 * (year + 4800 + temp)) / 4 + + (367 * (month - 2 - 12 * temp)) / 12 + - (3 * ((year + 4900 + temp) / 100)) / 4 + day - 32075; } #ifdef CONFIG_JULIAN_TIME static time_t clock_julian2utc(int year, int month, int day) { - return 367*year - - (7*(year + 5001 + (month-9)/7))/4 - + (275*month)/9 + return 367 * year + - (7 * (year + 5001 + (month - 9) / 7)) / 4 + + (275 * month) / 9 + day + 1729777; } #endif /* CONFIG_JULIAN_TIME */ @@ -95,7 +95,7 @@ time_t clock_calendar2utc(int year, int month, int day) /* Correct year & month ranges. Shift month into range 1-12 */ - dyear = (month-1) / 12; + dyear = (month - 1) / 12; month -= 12 * dyear; year += dyear; diff --git a/libs/libc/time/lib_gettimeofday.c b/libs/libc/time/lib_gettimeofday.c index ef20917503..3851704a0a 100644 --- a/libs/libc/time/lib_gettimeofday.c +++ b/libs/libc/time/lib_gettimeofday.c @@ -73,10 +73,10 @@ int gettimeofday(FAR struct timeval *tv, FAR struct timezone *tz) ret = clock_gettime(CLOCK_REALTIME, &ts); if (ret == OK) { - /* Convert the struct timespec to a struct timeval */ + /* Convert the struct timespec to a struct timeval */ - tv->tv_sec = ts.tv_sec; - tv->tv_usec = ts.tv_nsec / NSEC_PER_USEC; + tv->tv_sec = ts.tv_sec; + tv->tv_usec = ts.tv_nsec / NSEC_PER_USEC; } return ret; diff --git a/libs/libc/unistd/lib_chdir.c b/libs/libc/unistd/lib_chdir.c index 94ff660bc9..655b8f1847 100644 --- a/libs/libc/unistd/lib_chdir.c +++ b/libs/libc/unistd/lib_chdir.c @@ -85,8 +85,8 @@ static inline void _trimdir(char *path) * 'path' argument OR more that SYMLOOP_MAX symbolic links in the * resolution of the 'path' argument. * ENAMETOOLONG - * The length of the path argument exceeds PATH_MAX or a pathname component - * is longer than NAME_MAX. + * The length of the path argument exceeds PATH_MAX or a pathname + * component is longer than NAME_MAX. * ENOENT * A component of 'path' does not name an existing directory or path is * an empty string. @@ -128,7 +128,9 @@ int chdir(FAR const char *path) goto errout; } - /* Yes, it is a directory. Remove any trailing '/' characters from the path */ + /* Yes, it is a directory. + * Remove any trailing '/' characters from the path + */ _trimdir(path); diff --git a/libs/libc/unistd/lib_getuid.c b/libs/libc/unistd/lib_getuid.c index 85cf9411c6..85ad77ecf2 100644 --- a/libs/libc/unistd/lib_getuid.c +++ b/libs/libc/unistd/lib_getuid.c @@ -35,7 +35,8 @@ * Name: getuid * * Description: - * The getuid() function will return the real user ID of the calling process. + * The getuid() function will return the real user ID of the calling + * process. * * Input Parameters: * None diff --git a/libs/libc/unistd/lib_sleep.c b/libs/libc/unistd/lib_sleep.c index 795c13bcf8..3248f7fe26 100644 --- a/libs/libc/unistd/lib_sleep.c +++ b/libs/libc/unistd/lib_sleep.c @@ -70,10 +70,10 @@ * unspecified whether the SIGALRM signal is blocked, unless the process' * signal mask is restored as part of the environment. * - * Implementations may place limitations on the granularity of timer values. - * For each interval timer, if the requested timer value requires a finer - * granularity than the implementation supports, the actual timer value will - * be rounded up to the next supported value. + * Implementations may place limitations on the granularity of timer + * values. For each interval timer, if the requested timer value requires a + * finer granularity than the implementation supports, the actual timer + * value will be rounded up to the next supported value. * * Interactions between sleep() and any of setitimer(), ualarm() or sleep() * are unspecified. @@ -109,8 +109,8 @@ unsigned int sleep(unsigned int seconds) ret = clock_nanosleep(CLOCK_REALTIME, 0, &rqtp, &rmtp); - /* clock_nanosleep() should only fail if it was interrupted by a signal, - * but we treat all errors the same, + /* clock_nanosleep() should only fail if it was interrupted by a + * signal, but we treat all errors the same, */ if (ret < 0) diff --git a/libs/libc/unistd/lib_swab.c b/libs/libc/unistd/lib_swab.c index 6b92a1403b..fea94d434c 100644 --- a/libs/libc/unistd/lib_swab.c +++ b/libs/libc/unistd/lib_swab.c @@ -61,24 +61,24 @@ void swab(FAR const void *src, FAR void *dest, ssize_t nbytes) */ if (nbytes > 1) - { - /* The end of dest buffer + 1 byte (skipping any odd numbered byte at - * the end of the buffer. - */ + { + /* The end of dest buffer + 1 byte (skipping any odd numbered byte at + * the end of the buffer. + */ - end8 = dest8 + (nbytes & ~1); + end8 = dest8 + (nbytes & ~1); - /* Loop until the destination is equal to the end + 1 address */ + /* Loop until the destination is equal to the end + 1 address */ - while (dest8 != end8) - { - register uint8_t tmp; + while (dest8 != end8) + { + register uint8_t tmp; - /* Transfer the bytes, swapping the order */ + /* Transfer the bytes, swapping the order */ - tmp = *src8++; - *dest8++ = *src8++; - *dest8++ = tmp; - } - } + tmp = *src8++; + *dest8++ = *src8++; + *dest8++ = tmp; + } + } } diff --git a/libs/libc/unistd/lib_usleep.c b/libs/libc/unistd/lib_usleep.c index e0b4e25ef6..3c6ef80bd8 100644 --- a/libs/libc/unistd/lib_usleep.c +++ b/libs/libc/unistd/lib_usleep.c @@ -58,10 +58,10 @@ * it is unspecified whether that signal has any effect other than causing * usleep() to return. * - * If a signal-catching function interrupts usleep() and examines or changes - * either the time a SIGALRM is scheduled to be generated, the action - * associated with the SIGALRM signal, or whether the SIGALRM signal is - * blocked from delivery, the results are unspecified. + * If a signal-catching function interrupts usleep() and examines or + * changes either the time a SIGALRM is scheduled to be generated, the + * action associated with the SIGALRM signal, or whether the SIGALRM signal + * is blocked from delivery, the results are unspecified. * * If a signal-catching function interrupts usleep() and calls siglongjmp() * or longjmp() to restore an environment saved prior to the usleep() call, @@ -70,15 +70,15 @@ * unspecified whether the SIGALRM signal is blocked, unless the process' * signal mask is restored as part of the environment. * - * Implementations may place limitations on the granularity of timer values. - * For each interval timer, if the requested timer value requires a finer - * granularity than the implementation supports, the actual timer value will - * be rounded up to the next supported value. + * Implementations may place limitations on the granularity of timer + * values. For each interval timer, if the requested timer value requires a + * finer granularity than the implementation supports, the actual timer + * value will be rounded up to the next supported value. * * Interactions between usleep() and any of the following are unspecified: * - * nanosleep(), setitimer(), timer_create(), timer_delete(), timer_getoverrun(), - * timer_gettime(), timer_settime(), ualarm(), sleep() + * nanosleep(), setitimer(), timer_create(), timer_delete(), + * timer_getoverrun(), timer_gettime(), timer_settime(), ualarm(), sleep() * * Input Parameters: * usec - the number of microseconds to wait. diff --git a/libs/libc/wqueue/work_cancel.c b/libs/libc/wqueue/work_cancel.c index 1dcdcb4f99..9665730c55 100644 --- a/libs/libc/wqueue/work_cancel.c +++ b/libs/libc/wqueue/work_cancel.c @@ -44,8 +44,8 @@ * * Description: * Cancel previously queued work. This removes work from the work queue. - * After work has been cancelled, it may be re-queue by calling work_queue() - * again. + * After work has been cancelled, it may be re-queue by calling + * work_queue() again. * * Input Parameters: * qid - The work queue ID @@ -60,7 +60,8 @@ * ****************************************************************************/ -static int work_qcancel(FAR struct usr_wqueue_s *wqueue, FAR struct work_s *work) +static int work_qcancel(FAR struct usr_wqueue_s *wqueue, + FAR struct work_s *work) { int ret = -ENOENT; diff --git a/libs/libc/wqueue/work_signal.c b/libs/libc/wqueue/work_signal.c index 4c3bb8b471..eae548b851 100644 --- a/libs/libc/wqueue/work_signal.c +++ b/libs/libc/wqueue/work_signal.c @@ -56,6 +56,7 @@ /**************************************************************************** * Public Functions ****************************************************************************/ + /**************************************************************************** * Name: work_signal * diff --git a/libs/libc/wqueue/wqueue.h b/libs/libc/wqueue/wqueue.h index b9ba0c4bfa..311e7b28b7 100644 --- a/libs/libc/wqueue/wqueue.h +++ b/libs/libc/wqueue/wqueue.h @@ -58,7 +58,9 @@ struct usr_wqueue_s extern struct usr_wqueue_s g_usrwork; -/* This semaphore/mutex supports exclusive access to the user-mode work queue */ +/* This semaphore/mutex supports exclusive access to the user-mode work + * queue + */ #ifdef CONFIG_BUILD_PROTECTED extern sem_t g_usrsem; diff --git a/libs/libc/zoneinfo/tzromfs.c b/libs/libc/zoneinfo/tzromfs.c index 945fa014f2..0cccc2b1e4 100644 --- a/libs/libc/zoneinfo/tzromfs.c +++ b/libs/libc/zoneinfo/tzromfs.c @@ -24,6 +24,7 @@ #include #include +#include "romfs_zoneinfo.h" /**************************************************************************** * Private Functions @@ -32,5 +33,3 @@ /**************************************************************************** * Public Data ****************************************************************************/ - -#include "romfs_zoneinfo.h"