This is an automated email from the ASF dual-hosted git repository. xiaoxiang pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit ed8e5e971bf83d80f4ac1517e58a9bdd0331c704 Author: Alin Jerpelea <alin.jerpe...@sony.com> AuthorDate: Fri Apr 2 07:44:54 2021 +0200 libs: fix nxstyle errors fix erros reported by nxstyle Signed-off-by: Alin Jerpelea <alin.jerpe...@sony.com> --- libs/libc/math/__cos.c | 3 +- libs/libc/math/lib_asin.c | 3 +- libs/libc/math/lib_asinf.c | 3 +- libs/libc/math/lib_asinl.c | 4 +- libs/libc/math/lib_erf.c | 3 +- libs/libc/math/lib_erff.c | 3 +- libs/libc/math/lib_erfl.c | 6 +- libs/libc/math/lib_floorl.c | 1 - libs/libc/math/lib_log.c | 1 - libs/libc/math/lib_rint.c | 4 + libs/libc/math/lib_rintf.c | 4 + libs/libc/math/lib_rintl.c | 4 + libs/libc/math/lib_sqrt.c | 3 +- libs/libc/math/lib_sqrtl.c | 9 +- libs/libc/math/lib_truncl.c | 9 +- libs/libc/misc/lib_crc16.c | 20 +- libs/libc/misc/lib_crc32.c | 1 + libs/libc/misc/lib_crc8.c | 2 +- libs/libc/misc/lib_envpath.c | 17 +- libs/libc/misc/lib_kbddecode.c | 10 +- libs/libc/misc/lib_kbdencode.c | 6 +- libs/libc/misc/lib_ncompress.c | 361 ++++++++++++++++++---------------- libs/libc/misc/lib_slcddecode.c | 11 +- libs/libc/net/lib_addrconfig.c | 4 + libs/libc/net/lib_inetpton.c | 25 ++- libs/libc/stdio/lib_lowoutstream.c | 3 +- libs/libc/stdio/lib_ultoa_invert.c | 1 + libs/libc/stdio/lib_vdprintf.c | 6 +- libs/libc/stdio/lib_vfscanf.c | 4 +- libs/libc/stdio/lib_vsnprintf.c | 4 +- libs/libc/stdlib/lib_itoa.c | 5 +- libs/libc/stdlib/lib_qsort.c | 2 +- libs/libc/stdlib/lib_strtod.c | 12 +- libs/libc/stdlib/lib_strtof.c | 12 +- libs/libc/stdlib/lib_strtold.c | 12 +- libs/libc/string/lib_explicit_bzero.c | 2 +- libs/libc/string/lib_memccpy.c | 1 - libs/libc/string/lib_strtokr.c | 2 +- libs/libc/string/lib_vikmemcpy.c | 1 + libs/libc/wchar/lib_wcscmp.c | 9 +- libs/libc/wchar/lib_wcscoll.c | 4 +- libs/libc/wchar/lib_wcslcpy.c | 10 +- libs/libc/wchar/lib_wcslen.c | 2 +- libs/libc/wchar/lib_wcstoll.c | 3 +- libs/libc/wchar/lib_wcstoul.c | 3 +- libs/libc/wchar/lib_wcstoull.c | 5 +- libs/libc/wchar/lib_wcsxfrm.c | 8 +- libs/libc/wchar/lib_wmemchr.c | 1 + libs/libc/wchar/lib_wmemmove.c | 6 +- libs/libc/wctype/lib_iswctype.c | 24 +-- libs/libc/wctype/lib_towlower.c | 24 +-- libs/libc/wctype/lib_towupper.c | 24 +-- libs/libc/wctype/lib_wctype.c | 24 +-- 53 files changed, 417 insertions(+), 314 deletions(-) diff --git a/libs/libc/math/__cos.c b/libs/libc/math/__cos.c index e91a6cc..1dd82b9 100644 --- a/libs/libc/math/__cos.c +++ b/libs/libc/math/__cos.c @@ -115,7 +115,8 @@ double __cos(double x, double y) z = x * x; w = z * z; r = - z * (g_c1 + z * (g_c2 + z * g_c3)) + w * w * (g_c4 + z * (g_c5 + z * g_c6)); + z * (g_c1 + z * (g_c2 + z * g_c3)) + + w * w * (g_c4 + z * (g_c5 + z * g_c6)); hz = 0.5 * z; w = 1.0 - hz; diff --git a/libs/libc/math/lib_asin.c b/libs/libc/math/lib_asin.c index 353105e..d534f99 100644 --- a/libs/libc/math/lib_asin.c +++ b/libs/libc/math/lib_asin.c @@ -56,7 +56,8 @@ static double asin_aux(double x) { long double y; - double y_cos, y_sin; + double y_cos; + double y_sin; y = 0.0; y_sin = 0.0; diff --git a/libs/libc/math/lib_asinf.c b/libs/libc/math/lib_asinf.c index b63fae9..c97a8d8 100644 --- a/libs/libc/math/lib_asinf.c +++ b/libs/libc/math/lib_asinf.c @@ -44,7 +44,8 @@ static float asinf_aux(float x) { double y; - float y_sin, y_cos; + float y_sin; + float y_cos; y = 0.0; y_sin = 0.0F; diff --git a/libs/libc/math/lib_asinl.c b/libs/libc/math/lib_asinl.c index ed56114..2e523d6 100644 --- a/libs/libc/math/lib_asinl.c +++ b/libs/libc/math/lib_asinl.c @@ -43,7 +43,9 @@ static long double asinl_aux(long double x) { - long double y, y_cos, y_sin; + long double y; + long double y_cos; + long double y_sin; y = 0.0; y_sin = 0.0; diff --git a/libs/libc/math/lib_erf.c b/libs/libc/math/lib_erf.c index 5c530dc..10b3c6f 100644 --- a/libs/libc/math/lib_erf.c +++ b/libs/libc/math/lib_erf.c @@ -77,7 +77,8 @@ double erf(double x) z = fabs(x); t = 1.0 / (1.0 + P * z); - t = 1.0 - (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * exp(-z * z); + t = 1.0 - + (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * exp(-z * z); return copysign(t, x); } diff --git a/libs/libc/math/lib_erff.c b/libs/libc/math/lib_erff.c index 3fef882..3dad93d 100644 --- a/libs/libc/math/lib_erff.c +++ b/libs/libc/math/lib_erff.c @@ -75,6 +75,7 @@ float erff(float x) z = fabsf(x); t = 1.0F / (1.0F + P * z); - t = 1.0F - (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * expf(-z * z); + t = 1.0F - + (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * expf(-z * z); return copysignf(t, x); } diff --git a/libs/libc/math/lib_erfl.c b/libs/libc/math/lib_erfl.c index 645e2cb..02c5115 100644 --- a/libs/libc/math/lib_erfl.c +++ b/libs/libc/math/lib_erfl.c @@ -61,11 +61,13 @@ long double erfl(long double x) * erf comes from formula 7.1.26 */ - long double t, z; + long double t; + long double z; z = fabsl(x); t = 1.0 / (1.0 + P * z); - t = 1.0 - (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * expl(-z * z); + t = 1.0 - + (((((A5 * t + A4) * t) + A3) * t + A2) * t + A1) * t * expl(-z * z); return copysignl(t, x); } #endif diff --git a/libs/libc/math/lib_floorl.c b/libs/libc/math/lib_floorl.c index 265822f..1e1d147 100644 --- a/libs/libc/math/lib_floorl.c +++ b/libs/libc/math/lib_floorl.c @@ -62,6 +62,5 @@ long double floorl(long double x) } return modx; - } #endif diff --git a/libs/libc/math/lib_log.c b/libs/libc/math/lib_log.c index c39e9e8..ba7aae3 100644 --- a/libs/libc/math/lib_log.c +++ b/libs/libc/math/lib_log.c @@ -72,7 +72,6 @@ double log(double x) iter = 0; relax_factor = 1; - while (y > y_old + epsilon || y < y_old - epsilon) { y_old = y; diff --git a/libs/libc/math/lib_rint.c b/libs/libc/math/lib_rint.c index c6eff84..2d8a64d 100644 --- a/libs/libc/math/lib_rint.c +++ b/libs/libc/math/lib_rint.c @@ -71,6 +71,10 @@ * Private Data ****************************************************************************/ +/**************************************************************************** + * Public Functions + ****************************************************************************/ + double rint(double x) { long linteger; diff --git a/libs/libc/math/lib_rintf.c b/libs/libc/math/lib_rintf.c index c832d28..9a38497 100644 --- a/libs/libc/math/lib_rintf.c +++ b/libs/libc/math/lib_rintf.c @@ -71,6 +71,10 @@ * Private Data ****************************************************************************/ +/**************************************************************************** + * Public Functions + ****************************************************************************/ + float rintf(float x) { long linteger; diff --git a/libs/libc/math/lib_rintl.c b/libs/libc/math/lib_rintl.c index 421a6c6..d044618 100644 --- a/libs/libc/math/lib_rintl.c +++ b/libs/libc/math/lib_rintl.c @@ -71,6 +71,10 @@ * Private Data ****************************************************************************/ +/**************************************************************************** + * Public Functions + ****************************************************************************/ + long double rintl(long double x) { int64_t llinteger; diff --git a/libs/libc/math/lib_sqrt.c b/libs/libc/math/lib_sqrt.c index 36f5b45..2ef0a1f 100644 --- a/libs/libc/math/lib_sqrt.c +++ b/libs/libc/math/lib_sqrt.c @@ -44,7 +44,8 @@ #ifdef CONFIG_HAVE_DOUBLE double sqrt(double x) { - long double y, y1; + long double y; + long double y1; if (x < 0.0) { diff --git a/libs/libc/math/lib_sqrtl.c b/libs/libc/math/lib_sqrtl.c index a25a1e1..029fb10 100644 --- a/libs/libc/math/lib_sqrtl.c +++ b/libs/libc/math/lib_sqrtl.c @@ -44,7 +44,8 @@ #ifdef CONFIG_HAVE_LONG_DOUBLE long double sqrtl(long double x) { - long double y, y1; + long double y; + long double y1; /* Filter out invalid/trivial inputs */ @@ -56,17 +57,17 @@ long double sqrtl(long double x) if (isnan(x)) { - return NAN; + return NAN; } if (isinf(x)) { - return INFINITY; + return INFINITY; } if (x == 0.0) { - return 0.0; + return 0.0; } /* Guess square root (using bit manipulation) */ diff --git a/libs/libc/math/lib_truncl.c b/libs/libc/math/lib_truncl.c index 81bfe78..7a32983 100644 --- a/libs/libc/math/lib_truncl.c +++ b/libs/libc/math/lib_truncl.c @@ -59,9 +59,10 @@ union ldshape long double truncl(long double x) { union ldshape u = - { - x - }; + { + x + }; + int e = u.i.se & 0x7fff; int s = u.i.se >> 15; long double y; @@ -78,7 +79,7 @@ long double truncl(long double x) __x = (x + 0x1p120f); UNUSED(__x); - return x*0; + return x * 0; } /* y = int(|x|) - |x|, where int(|x|) is an integer neighbor of |x| */ diff --git a/libs/libc/misc/lib_crc16.c b/libs/libc/misc/lib_crc16.c index 692e4f7..c9f96e8 100644 --- a/libs/libc/misc/lib_crc16.c +++ b/libs/libc/misc/lib_crc16.c @@ -6,19 +6,14 @@ * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt <gn...@nuttx.org> * - * References: - * - * crc16_tab calculated by Mark G. Mendel, Network Systems Corporation. - * crc16part() logic derived from article Copyright (C) 1986 Stephen Satchell. - * * "Programmers may incorporate any or all code into their programs, * giving proper credit within the source. Publication of the * source routines is permitted so long as proper credit is given * to Stephen Satchell, Satchell Evaluations and Chuck Forsberg, * Omen Technology." * - * Re-released under the Modified BSD license which, I believe, is consistent with the - * original authors' intent: + * Re-released under the Modified BSD license which, I believe, is + * consistent with the original authors' intent: * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -49,6 +44,13 @@ * ************************************************************************************************/ +/* References: + * + * crc16_tab calculated by Mark G. Mendel, Network Systems Corporation. + * crc16part() logic derived from article Copyright (C) 1986 Stephen + * Satchell. + */ + /************************************************************************************************ * Included Files ************************************************************************************************/ @@ -102,6 +104,7 @@ static uint16_t crc16_tab[256] = /************************************************************************************************ * Public Functions ************************************************************************************************/ + /************************************************************************************************ * Name: crc16part * @@ -116,7 +119,8 @@ uint16_t crc16part(FAR const uint8_t *src, size_t len, uint16_t crc16val) for (i = 0; i < len; i++) { - crc16val = crc16_tab[((crc16val >> 8) & 0xff) ^ src[i]] ^ (crc16val << 8); + crc16val = crc16_tab[((crc16val >> 8) & 0xff) ^ + src[i]] ^ (crc16val << 8); } return crc16val; diff --git a/libs/libc/misc/lib_crc32.c b/libs/libc/misc/lib_crc32.c index 0015ec5..908022a 100644 --- a/libs/libc/misc/lib_crc32.c +++ b/libs/libc/misc/lib_crc32.c @@ -90,6 +90,7 @@ static const uint32_t crc32_tab[] = /************************************************************************************************ * Public Functions ************************************************************************************************/ + /************************************************************************************************ * Name: crc32part * diff --git a/libs/libc/misc/lib_crc8.c b/libs/libc/misc/lib_crc8.c index 8eeb0e1..dc90ba6 100644 --- a/libs/libc/misc/lib_crc8.c +++ b/libs/libc/misc/lib_crc8.c @@ -52,7 +52,7 @@ /**************************************************************************** * CRC8 table generated with: * - * #define POLY 0xB2 // ((uint8_t) 0x14D) ^ 0xFF + * #define POLY 0xB2 ((uint8_t) 0x14D) ^ 0xFF * * printf(" "); * for (y = 0; y < 256; y++) diff --git a/libs/libc/misc/lib_envpath.c b/libs/libc/misc/lib_envpath.c index efe4f36..c357807 100644 --- a/libs/libc/misc/lib_envpath.c +++ b/libs/libc/misc/lib_envpath.c @@ -188,18 +188,19 @@ FAR char *envpath_next(ENVPATH_HANDLE handle, FAR const char *relpath) path = envpath->next; if (*path == '\0') - { - /* If it points to a NULL it means that either (1) the PATH varialbe - * is empty, or (2) we have already examined all of the paths in the - * path variable. + { + /* If it points to a NULL it means that either (1) the PATH + * varialbe is empty, or (2) we have already examined all of the + * paths in the path variable. */ return (FAR char *)NULL; - } + } - /* Okay... 'path' points to the beginning of the string. The string may - * be terminated either with (1) ':' which separates the path from the - * next path in the list, or (2) NUL which marks the end of the list. + /* Okay... 'path' points to the beginning of the string. The string + * may be terminated either with (1) ':' which separates the path from + * the next path in the list, or (2) NUL which marks the end of the + * list. */ endptr = strchr(path, ':'); diff --git a/libs/libc/misc/lib_kbddecode.c b/libs/libc/misc/lib_kbddecode.c index 1e055a7..c80abe9 100644 --- a/libs/libc/misc/lib_kbddecode.c +++ b/libs/libc/misc/lib_kbddecode.c @@ -94,9 +94,9 @@ static int kbd_reget(FAR struct kbd_getstate_s *state, FAR uint8_t *pch) /* Return the next character */ *pch = state->buf[state->ndx]; - state->ndx++; - state->nch--; - return KBD_PRESS; + state->ndx++; + state->nch--; + return KBD_PRESS; } /**************************************************************************** @@ -169,7 +169,9 @@ int kbd_decode(FAR struct lib_instream_s *stream, if (ch != ASCII_ESC) { - /* Not the beginning of an escape sequence. Return the character. */ + /* Not the beginning of an escape sequence. + * Return the character. + */ return kbd_reget(state, pch); } diff --git a/libs/libc/misc/lib_kbdencode.c b/libs/libc/misc/lib_kbdencode.c index 999cb18..237898b 100644 --- a/libs/libc/misc/lib_kbdencode.c +++ b/libs/libc/misc/lib_kbdencode.c @@ -122,7 +122,8 @@ void kbd_release(uint8_t ch, FAR struct lib_outstream_s *stream) void kbd_specpress(enum kbd_keycode_e keycode, FAR struct lib_outstream_s *stream) { - DEBUGASSERT(stream && keycode >= KEYCODE_FWDDEL && keycode <= LAST_KEYCODE); + DEBUGASSERT(stream && keycode >= + KEYCODE_FWDDEL && keycode <= LAST_KEYCODE); kbd_encode((uint8_t)keycode, stream, ('a' + KBD_SPECPRESS)); } @@ -146,6 +147,7 @@ void kbd_specpress(enum kbd_keycode_e keycode, void kbd_specrel(enum kbd_keycode_e keycode, FAR struct lib_outstream_s *stream) { - DEBUGASSERT(stream && keycode >= KEYCODE_FWDDEL && keycode <= LAST_KEYCODE); + DEBUGASSERT(stream && keycode >= + KEYCODE_FWDDEL && keycode <= LAST_KEYCODE); kbd_encode((uint8_t)keycode, stream, ('a' + KBD_SPECREL)); } diff --git a/libs/libc/misc/lib_ncompress.c b/libs/libc/misc/lib_ncompress.c index a106b36..d7e3ae9 100644 --- a/libs/libc/misc/lib_ncompress.c +++ b/libs/libc/misc/lib_ncompress.c @@ -1,4 +1,3 @@ - /**************************************************************************** * libs/libc/misc/lib_ncompress.c * File compression ala IEEE Computer, Mar 1992. @@ -50,6 +49,10 @@ * ****************************************************************************/ +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include <sys/types.h> #include <sys/stat.h> #include <stdint.h> @@ -63,6 +66,10 @@ #include <signal.h> #include <errno.h> +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + #define RECURSIVE 1 #ifdef __STDC__ @@ -97,34 +104,37 @@ /* Defines for third byte of header */ #define MAGIC_1 (char_type)'\037' /* First byte of compressed file */ #define MAGIC_2 (char_type)'\235' /* Second byte of compressed file */ -#define BIT_MASK 0x1f /* Mask for 'number of compression bits' */ - /* Masks 0x20 and 0x40 are free. */ - /* I think 0x20 should mean that there is */ - /* a fourth header byte (for expansion). */ -#define BLOCK_MODE 0x80 /* Block compression if table is full and */ - /* compression rate is dropping flush tables */ - - /* the next two codes should not be changed lightly, as they must not */ - /* lie within the contiguous general code space. */ + +#define BIT_MASK 0x1f /* Mask for 'number of compression bits' */ + /* Masks 0x20 and 0x40 are free. */ + /* I think 0x20 should mean that there is */ + /* a fourth header byte (for expansion). */ + +#define BLOCK_MODE 0x80 /* Block compression if table is full and */ + /* compression rate is dropping flush tables */ + +/* the next two codes should not be changed lightly, as they must not + * lie within the contiguous general code space. + */ #define FIRST 257 /* first free entry */ #define CLEAR 256 /* table clear output code */ #define INIT_BITS 9 /* initial number of bits/code */ #ifndef SACREDMEM - /* - * SACREDMEM is the amount of physical memory saved for others; compress - * will hog the rest. - */ + +/* SACREDMEM is the amount of physical memory saved for others; compress + * will hog the rest. + */ # define SACREDMEM 0 #endif #ifndef USERMEM - /* - * Set USERMEM to the maximum amount of physical user memory available - * in bytes. USERMEM is used to determine the maximum BITS that can be used - * for compression. - */ + +/* Set USERMEM to the maximum amount of physical user memory available + * in bytes. USERMEM is used to determine the maximum BITS that can be used + * for compression. + */ # define USERMEM 450000 /* default user memory */ #endif @@ -136,9 +146,7 @@ # define NOALLIGN 0 #endif -/* - * machine variants which require cc -Dmachine: pdp11, z8000, DOS - */ +/* machine variants which require cc -Dmachine: pdp11, z8000, DOS */ #ifdef interdata /* Perkin-Elmer */ # define SIGNED_COMPARE_SLOW /* signed compare is slower than unsigned */ @@ -315,16 +323,17 @@ int quiet = 1; /* don't tell me about compression */ int do_decomp = 0; /* Decompress mode */ int force = 0; /* Force overwrite of files and links */ int nomagic = 0; /* Use a 3-byte magic number header, */ + /* unless old file */ -int block_mode = BLOCK_MODE; /* Block compress mode -C compatible with 2.0 */ -int maxbits = BITS; /* user settable max # bits/code */ -int zcat_flg = 0; /* Write output on stdout, suppress messages */ -int recursive = 0; /* compress directories */ -int exit_code = -1; /* Exitcode of compress (-1 no file compressed) - */ -char_type inbuf[IBUFSIZ + 64]; /* Input buffer */ -char_type outbuf[OBUFSIZ + 2048]; /* Output buffer */ +int block_mode = BLOCK_MODE; /* Block compress mode -C compatible with 2.0 */ +int maxbits = BITS; /* user settable max # bits/code */ +int zcat_flg = 0; /* Write output on stdout, suppress messages */ +int recursive = 0; /* compress directories */ +int exit_code = -1; /* Exitcode of compress (-1 no file compressed) */ + +char_type inbuf[IBUFSIZ + 64]; /* Input buffer */ +char_type outbuf[OBUFSIZ + 2048]; /* Output buffer */ struct stat infstat; /* Input file status */ char *ifname; /* Input filename */ @@ -335,8 +344,7 @@ int fgnd_flag = 0; /* Running in background (SIGINT=SIGIGN) */ long bytes_in; /* Total number of byte from input */ long bytes_out; /* Total number of byte to output */ -/* - * To save much memory, we overlay the table used by compress() with those +/* To save much memory, we overlay the table used by compress() with those * used by decompress(). The tab_prefix table is the same size and type * as the codetab. The tab_suffix table needs 2**BITS characters. We * get this from the beginning of htab. The output stack uses the rest @@ -354,7 +362,9 @@ count_int htab6[8192]; count_int htab7[8192]; count_int htab8[HSIZE - 65536]; count_int *htab[9] = - { htab0, htab1, htab2, htab3, htab4, htab5, htab6, htab7, htab8 }; +{ + htab0, htab1, htab2, htab3, htab4, htab5, htab6, htab7, htab8 +}; unsigned short code0tab[16384]; unsigned short code1tab[16384]; @@ -362,7 +372,9 @@ unsigned short code2tab[16384]; unsigned short code3tab[16384]; unsigned short code4tab[16384]; unsigned short *codetab[5] = - { code0tab, code1tab, code2tab, code3tab, code4tab }; +{ + code0tab, code1tab, code2tab, code3tab, code4tab +}; # define htabof(i) (htab[(i) >> 13][(i) & 0x1fff]) # define codetabof(i) (codetab[(i) >> 14][(i) & 0x3fff]) @@ -433,8 +445,11 @@ int primetab[256] = /* Special secudary hash table. */ }; # endif -/* - * compress fdin to fdout +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/* compress fdin to fdout * * Algorithm: use open addressing double hashing (no chaining) on the * prefix code / next character combination. We do a variant of Knuth's @@ -448,6 +463,7 @@ int primetab[256] = /* Special secudary hash table. */ * file size for noticeable speed improvement on small files. Please direct * questions about this implementation to ames!jaw. */ + void compress(int fdin, int fdout) { long hp; @@ -531,7 +547,9 @@ void compress(int fdin, int fdout) checkpoint = bytes_in + CHECK_GAP; if (bytes_in > 0x007fffff) - { /* shift will overflow */ + { + /* shift will overflow */ + rat = (bytes_out + (outbits >> 3)) >> 8; if (rat == 0) /* Don't divide by zero */ @@ -540,10 +558,11 @@ void compress(int fdin, int fdout) rat = bytes_in / rat; } else - rat = (bytes_in << 8) / (bytes_out + (outbits >> 3)); /* 8 - * fractional - * bits - */ + + /* 8 fractional bits */ + + rat = (bytes_in << 8) / (bytes_out + (outbits >> 3)); + if (rat >= ratio) ratio = (int)rat; else @@ -574,106 +593,108 @@ void compress(int fdin, int fdout) memset(outbuf + (outbits >> 3) + 1, '\0', OBUFSIZ); } - { - int i; + { + int i; - i = rsize - rlop; + i = rsize - rlop; - if ((code_int) i > extcode - free_ent) - i = (int)(extcode - free_ent); - if (i > ((sizeof(outbuf) - 32) * 8 - outbits) / n_bits) - i = ((sizeof(outbuf) - 32) * 8 - outbits) / n_bits; + if ((code_int) i > extcode - free_ent) + i = (int)(extcode - free_ent); + if (i > ((sizeof(outbuf) - 32) * 8 - outbits) / n_bits) + i = ((sizeof(outbuf) - 32) * 8 - outbits) / n_bits; - if (!stcode && (long)i > checkpoint - bytes_in) - i = (int)(checkpoint - bytes_in); + if (!stcode && (long)i > checkpoint - bytes_in) + i = (int)(checkpoint - bytes_in); - rlop += i; - bytes_in += i; - } + rlop += i; + bytes_in += i; + } goto next; hfound:fcode.e.ent = codetabof(hp); next:if (rpos >= rlop) - goto endlop; + goto endlop; next2:fcode.e.c = inbuf[rpos++]; # ifndef FAST - { - code_int i; - fc = fcode.code; + { + code_int i; + fc = fcode.code; - hp = (((long)(fcode.e.c)) << (BITS - 8)) ^ (long)(fcode.e.ent); + hp = (((long)(fcode.e.c)) << (BITS - 8)) ^ (long)(fcode.e.ent); - if ((i = htabof(hp)) == fc) - goto hfound; + if ((i = htabof(hp)) == fc) + goto hfound; - if (i != -1) - { - long disp; + if (i != -1) + { + long disp; - disp = (HSIZE - hp) - 1; /* secondary hash (after G. - * Knott) */ + disp = (HSIZE - hp) - 1; /* secondary hash (after G. + * Knott) */ - do - { - if ((hp -= disp) < 0) - hp += HSIZE; + do + { + if ((hp -= disp) < 0) + hp += HSIZE; - if ((i = htabof(hp)) == fc) - goto hfound; - } - while (i != -1); - } - } + if ((i = htabof(hp)) == fc) + goto hfound; + } + while (i != -1); + } + } # else - { - long i; - long p; - fc = fcode.code; - - hp = ((((long)(fcode.e.c)) << (HBITS - 8)) ^ (long)(fcode.e.ent)); - - if ((i = htabof(hp)) == fc) - goto hfound; - if (i == -1) - goto out; - - p = primetab[fcode.e.c]; - lookup:hp = (hp + p) & HMASK; - if ((i = htabof(hp)) == fc) - goto hfound; - if (i == -1) - goto out; - hp = (hp + p) & HMASK; - if ((i = htabof(hp)) == fc) - goto hfound; - if (i == -1) - goto out; - hp = (hp + p) & HMASK; - if ((i = htabof(hp)) == fc) - goto hfound; - if (i == -1) - goto out; - goto lookup; - } - out:; + { + long i; + long p; + fc = fcode.code; + + hp = ((((long)(fcode.e.c)) << (HBITS - 8)) ^ + (long)(fcode.e.ent)); + + if ((i = htabof(hp)) == fc) + goto hfound; + if (i == -1) + goto out; + + p = primetab[fcode.e.c]; + lookup:hp = (hp + p) & HMASK; + if ((i = htabof(hp)) == fc) + goto hfound; + if (i == -1) + goto out; + hp = (hp + p) & HMASK; + if ((i = htabof(hp)) == fc) + goto hfound; + if (i == -1) + goto out; + hp = (hp + p) & HMASK; + if ((i = htabof(hp)) == fc) + goto hfound; + if (i == -1) + goto out; + goto lookup; + } + + out:; # endif output(outbuf, outbits, fcode.e.ent, n_bits); - { - long fc = fcode.code; - fcode.e.ent = fcode.e.c; + { + long fc = fcode.code; + fcode.e.ent = fcode.e.c; - if (stcode) - { - codetabof(hp) = (unsigned short)free_ent++; - htabof(hp) = fc; - } - } + if (stcode) + { + codetabof(hp) = (unsigned short)free_ent++; + htabof(hp) = fc; + } + } goto next; endlop:if (fcode.e.ent >= FIRST && rpos < rsize) - goto next2; + goto next2; if (rpos > rlop) { @@ -681,6 +702,7 @@ void compress(int fdin, int fdout) rlop = rpos; } } + while (rlop < rsize); } @@ -698,8 +720,7 @@ void compress(int fdin, int fdout) return; } -/* - * Decompress stdin to stdout. This routine adapts to the codes in the +/* Decompress stdin to stdout. This routine adapts to the codes in the * file building the "string" table on-the-fly; requiring no table to * be stored in the compressed file. The tables used herein are shared * with those of the compress() routine. See the definitions above. @@ -779,21 +800,21 @@ void decompress(int fdin, int fdout) do { - resetbuf:; - { - int i; - int e; - int o; + resetbuf:; + { + int i; + int e; + int o; - o = posbits >> 3; - e = o <= insize ? insize - o : 0; + o = posbits >> 3; + e = o <= insize ? insize - o : 0; - for (i = 0; i < e; ++i) - inbuf[i] = inbuf[i + o]; + for (i = 0; i < e; ++i) + inbuf[i] = inbuf[i + o]; - insize = e; - posbits = 0; - } + insize = e; + posbits = 0; + } if (insize < sizeof(inbuf) - IBUFSIZ) { @@ -834,7 +855,9 @@ void decompress(int fdin, int fdout) fprintf(stderr, "uncompress: corrupt input\n"); abort_compress(); } - outbuf[outpos++] = (char_type) (finchar = (int)(oldcode = code)); + + outbuf[outpos++] = + (char_type)(finchar = (int)(oldcode = code)); continue; } @@ -863,8 +886,9 @@ void decompress(int fdin, int fdout) p = &inbuf[posbits >> 3]; fprintf(stderr, - "insize:%d posbits:%d inbuf:%02X %02X %02X %02X %02X (%d)\n", - insize, posbits, p[-1], p[0], p[1], p[2], p[3], + "insize:%d posbits:%d " + "inbuf:%02X %02X %02X %02X %02X (%d)\n", + insize, posbits, p[1], p[0], p[1], p[2], p[3], (posbits & 07)); fprintf(stderr, "uncompress: corrupt input\n"); abort_compress(); @@ -874,8 +898,10 @@ void decompress(int fdin, int fdout) code = oldcode; } + /* Generate output characters in reverse order */ + while ((cmp_code_int) code >= (cmp_code_int) 256) - { /* Generate output characters in reverse order */ + { *--stackp = tab_suffixof(code); code = tab_prefixof(code); } @@ -884,39 +910,40 @@ void decompress(int fdin, int fdout) /* And put them out in forward order */ - { - int i; - - if (outpos + (i = (de_stack - stackp)) >= OBUFSIZ) - { - do - { - if (i > OBUFSIZ - outpos) - i = OBUFSIZ - outpos; - - if (i > 0) - { - memcpy(outbuf + outpos, stackp, i); - outpos += i; - } - - if (outpos >= OBUFSIZ) - { - if (write(fdout, outbuf, outpos) != outpos) - write_error(); - - outpos = 0; - } - stackp += i; - } - while ((i = (de_stack - stackp)) > 0); - } - else - { - memcpy(outbuf + outpos, stackp, i); - outpos += i; - } - } + { + int i; + + if (outpos + (i = (de_stack - stackp)) >= OBUFSIZ) + { + do + { + if (i > OBUFSIZ - outpos) + i = OBUFSIZ - outpos; + + if (i > 0) + { + memcpy(outbuf + outpos, stackp, i); + outpos += i; + } + + if (outpos >= OBUFSIZ) + { + if (write(fdout, outbuf, outpos) != outpos) + write_error(); + + outpos = 0; + } + + stackp += i; + } + while ((i = (de_stack - stackp)) > 0); + } + else + { + memcpy(outbuf + outpos, stackp, i); + outpos += i; + } + } if ((code = free_ent) < maxmaxcode) /* Generate the new entry. */ { diff --git a/libs/libc/misc/lib_slcddecode.c b/libs/libc/misc/lib_slcddecode.c index 342f86ff..796693e 100644 --- a/libs/libc/misc/lib_slcddecode.c +++ b/libs/libc/misc/lib_slcddecode.c @@ -53,7 +53,7 @@ * Pre-processor Definitions ****************************************************************************/ -/* Indices, counts, helper macros ******************************************/ +/* Indices, counts, helper macros *******************************************/ #define NDX_ESC 0 #define NDX_BRACKET 1 @@ -134,11 +134,11 @@ static enum slcdret_e slcd_reget(FAR struct slcdstate_s *state, *pch = state->buf[state->ndx]; *parg = 0; - /* Bump up the indices and return false (meaning a normal character) */ + /* Bump up the indices and return false (meaning a normal character) */ - state->ndx++; - state->nch--; - return SLCDRET_CHAR; + state->ndx++; + state->nch--; + return SLCDRET_CHAR; } /**************************************************************************** @@ -173,7 +173,6 @@ static enum slcdret_e slcd_reget(FAR struct slcdstate_s *state, enum slcdret_e slcd_decode(FAR struct lib_instream_s *stream, FAR struct slcdstate_s *state, FAR uint8_t *pch, FAR uint8_t *parg) - { enum slcdcode_e code; uint8_t count; diff --git a/libs/libc/net/lib_addrconfig.c b/libs/libc/net/lib_addrconfig.c index e98c06d..c6f5832 100644 --- a/libs/libc/net/lib_addrconfig.c +++ b/libs/libc/net/lib_addrconfig.c @@ -48,3 +48,7 @@ ****************************************************************************/ const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ diff --git a/libs/libc/net/lib_inetpton.c b/libs/libc/net/lib_inetpton.c index 3fc0cd4..f2733d6 100644 --- a/libs/libc/net/lib_inetpton.c +++ b/libs/libc/net/lib_inetpton.c @@ -83,9 +83,9 @@ * * Input Parameters: * src - The src argument points to the string being passed in. - * dest - The dest argument points to a numstr into which the function stores - * the numeric address; this must be large enough to hold the numeric - * address (32 bits for AF_INET, 128 bits for AF_INET6). + * dest - The dest argument points to a numstr into which the function + * stores the numeric address; this must be large enough to hold the + * numeric address (32 bits for AF_INET, 128 bits for AF_INET6). * * Returned Value: * inet_ipv4_pton() will returns 1 if the conversion succeeds. It will @@ -193,9 +193,9 @@ static int inet_ipv4_pton(FAR const char *src, FAR void *dest) * * Input Parameters: * src - The src argument points to the string being passed in. - * dest - The dest argument points to a numstr into which the function stores - * the numeric address; this must be large enough to hold the numeric - * address (32 bits for AF_INET, 128 bits for AF_INET6). + * dest - The dest argument points to a numstr into which the function + * stores the numeric address; this must be large enough to hold the + * numeric address (32 bits for AF_INET, 128 bits for AF_INET6). * * Returned Value: * inet_ipv6_pton() will returns 1 if the conversion succeeds. It will @@ -324,7 +324,6 @@ static int inet_ipv6_pton(FAR const char *src, FAR void *dest) } } - /* Return zero if there is any problem parsing the input */ return 0; @@ -373,15 +372,15 @@ static int inet_ipv6_pton(FAR const char *src, FAR void *dest) * AF_INET or AF_INET6. * src - The src argument points to the string being passed in. * dest - The dest argument points to memory into which the function stores - * the numeric address; this must be large enough to hold the numeric - * address (32 bits for AF_INET, 128 bits for AF_INET6). + * the numeric address; this must be large enough to hold the + * numeric address (32 bits for AF_INET, 128 bits for AF_INET6). * * Returned Value: * The inet_pton() function returns 1 if the conversion succeeds, with the - * address pointed to by dest in network byte order. It will return 0 if the - * input is not a valid IPv4 dotted-decimal string or a valid IPv6 address - * string, or -1 with errno set to EAFNOSUPPORT if the af argument is - * unknown. + * address pointed to by dest in network byte order. It will return 0 if + * the input is not a valid IPv4 dotted-decimal string or a valid IPv6 + * address string, or -1 with errno set to EAFNOSUPPORT if the af argument + * is unknown. * ****************************************************************************/ diff --git a/libs/libc/stdio/lib_lowoutstream.c b/libs/libc/stdio/lib_lowoutstream.c index 0c84b2c..89197e4 100644 --- a/libs/libc/stdio/lib_lowoutstream.c +++ b/libs/libc/stdio/lib_lowoutstream.c @@ -1,7 +1,8 @@ /**************************************************************************** * libs/libc/stdio/lib_lowoutstream.c * - * Copyright (C) 2007-2009, 2011-2012, 2017 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2012, 2017 Gregory Nutt. + * All rights reserved. * Author: Gregory Nutt <gn...@nuttx.org> * * Redistribution and use in source and binary forms, with or without diff --git a/libs/libc/stdio/lib_ultoa_invert.c b/libs/libc/stdio/lib_ultoa_invert.c index 91df893..ae35b96 100644 --- a/libs/libc/stdio/lib_ultoa_invert.c +++ b/libs/libc/stdio/lib_ultoa_invert.c @@ -56,6 +56,7 @@ FAR char *__ultoa_invert(unsigned long val, FAR char *str, int base) upper = 1; base &= ~XTOA_UPPER; } + do { int v; diff --git a/libs/libc/stdio/lib_vdprintf.c b/libs/libc/stdio/lib_vdprintf.c index 8c4892f..90a4b23 100644 --- a/libs/libc/stdio/lib_vdprintf.c +++ b/libs/libc/stdio/lib_vdprintf.c @@ -2,7 +2,7 @@ * libs/libc/stdio/lib_vdprintf.c * * Copyright (C) 2012 Andrew Tridgell. All rights reserved. - * Authors: Author: Andrew Tridgell <and...@tridgell.net> + * Authors: Andrew Tridgell <and...@tridgell.net> * Gregory Nutt <gn...@nuttx.org> * * Redistribution and use in source and binary forms, with or without @@ -54,6 +54,6 @@ int vdprintf(int fd, FAR const IPTR char *fmt, va_list ap) /* Wrap the fd in a stream object and let lib_vsprintf do the work. */ - lib_rawoutstream(&rawoutstream, fd); - return lib_vsprintf(&rawoutstream.public, fmt, ap); + lib_rawoutstream(&rawoutstream, fd); + return lib_vsprintf(&rawoutstream.public, fmt, ap); } diff --git a/libs/libc/stdio/lib_vfscanf.c b/libs/libc/stdio/lib_vfscanf.c index d07b23d..e4d7939 100644 --- a/libs/libc/stdio/lib_vfscanf.c +++ b/libs/libc/stdio/lib_vfscanf.c @@ -66,8 +66,8 @@ int vfscanf(FAR FILE *stream, FAR const IPTR char *fmt, va_list ap) lib_stdinstream(&stdinstream, stream); /* Hold the stream semaphore throughout the lib_vscanf call so that - * this thread can get its entire message out before being pre-empted by - * the next thread. + * this thread can get its entire message out before being pre-empted + * by the next thread. */ lib_take_semaphore(stream); diff --git a/libs/libc/stdio/lib_vsnprintf.c b/libs/libc/stdio/lib_vsnprintf.c index b779b1c..65b979c 100644 --- a/libs/libc/stdio/lib_vsnprintf.c +++ b/libs/libc/stdio/lib_vsnprintf.c @@ -66,8 +66,8 @@ int vsnprintf(FAR char *buf, size_t size, FAR const IPTR char *format, /* "If the value of [size] is zero on a call to vsnprintf(), 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/stdlib/lib_itoa.c b/libs/libc/stdlib/lib_itoa.c index 40d576a..a1eb52d 100644 --- a/libs/libc/stdlib/lib_itoa.c +++ b/libs/libc/stdlib/lib_itoa.c @@ -52,7 +52,10 @@ FAR char *itoa(int val, FAR char *str, int base) { static FAR const char *digits = "0123456789abcdefghijklmnopqrstuvwxyz"; - int intval = abs(val), digit, pos, len; + int intval = abs(val); + int digit; + int pos; + int len; FAR char *buf = str; char swap; diff --git a/libs/libc/stdlib/lib_qsort.c b/libs/libc/stdlib/lib_qsort.c index 76f549e..293b4b0 100644 --- a/libs/libc/stdlib/lib_qsort.c +++ b/libs/libc/stdlib/lib_qsort.c @@ -196,7 +196,7 @@ loop: } return; - } + } pm = (FAR char *)base + (nel / 2) * width; if (nel > 7) diff --git a/libs/libc/stdlib/lib_strtod.c b/libs/libc/stdlib/lib_strtod.c index 2a43e63..57f6078 100644 --- a/libs/libc/stdlib/lib_strtod.c +++ b/libs/libc/stdlib/lib_strtod.c @@ -71,7 +71,7 @@ static inline int is_real(double x) { - const double infinite = 1.0/0.0; + const double infinite = 1.0 / 0.0; return (x < infinite) && (x >= -infinite); } @@ -97,7 +97,7 @@ double strtod(FAR const char *str, FAR char **endptr) int n; int num_digits; int num_decimals; - const double infinite = 1.0/0.0; + const double infinite = 1.0 / 0.0; /* Skip leading whitespace */ @@ -113,10 +113,14 @@ double strtod(FAR const char *str, FAR char **endptr) { case '-': negative = 1; /* Fall through to increment position */ + /* FALLTHROUGH */ + case '+': p++; + /* FALLTHROUGH */ + default: break; } @@ -177,10 +181,14 @@ double strtod(FAR const char *str, FAR char **endptr) { case '-': negative = 1; /* Fall through to increment pos */ + /* FALLTHROUGH */ + case '+': p++; + /* FALLTHROUGH */ + default: break; } diff --git a/libs/libc/stdlib/lib_strtof.c b/libs/libc/stdlib/lib_strtof.c index bf6becc..2c65bd2 100644 --- a/libs/libc/stdlib/lib_strtof.c +++ b/libs/libc/stdlib/lib_strtof.c @@ -73,7 +73,7 @@ static inline int is_real(float x) { - const float infinite = 1.0F/0.0F; + const float infinite = 1.0F / 0.0F; return (x < infinite) && (x >= -infinite); } @@ -99,7 +99,7 @@ float strtof(FAR const char *str, FAR char **endptr) int n; int num_digits; int num_decimals; - const float infinite = 1.0F/0.0F; + const float infinite = 1.0F / 0.0F; /* Skip leading whitespace */ @@ -115,10 +115,14 @@ float strtof(FAR const char *str, FAR char **endptr) { case '-': negative = 1; /* Fall through to increment position */ + /* FALLTHROUGH */ + case '+': p++; + /* FALLTHROUGH */ + default: break; } @@ -179,10 +183,14 @@ float strtof(FAR const char *str, FAR char **endptr) { case '-': negative = 1; /* Fall through to increment pos */ + /* FALLTHROUGH */ + case '+': p++; + /* FALLTHROUGH */ + default: break; } diff --git a/libs/libc/stdlib/lib_strtold.c b/libs/libc/stdlib/lib_strtold.c index 53c9107..322685f 100644 --- a/libs/libc/stdlib/lib_strtold.c +++ b/libs/libc/stdlib/lib_strtold.c @@ -71,7 +71,7 @@ static inline int is_real(long double x) { - const long double infinite = 1.0L/0.0L; + const long double infinite = 1.0L / 0.0L; return (x < infinite) && (x >= -infinite); } @@ -97,7 +97,7 @@ long double strtold(FAR const char *str, FAR char **endptr) int n; int num_digits; int num_decimals; - const long double infinite = 1.0L/0.0L; + const long double infinite = 1.0L / 0.0L; /* Skip leading whitespace */ @@ -113,10 +113,14 @@ long double strtold(FAR const char *str, FAR char **endptr) { case '-': negative = 1; /* Fall through to increment position */ + /* FALLTHROUGH */ + case '+': p++; + /* FALLTHROUGH */ + default: break; } @@ -177,10 +181,14 @@ long double strtold(FAR const char *str, FAR char **endptr) { case '-': negative = 1; /* Fall through to increment pos */ + /* FALLTHROUGH */ + case '+': p++; + /* FALLTHROUGH */ + default: break; } diff --git a/libs/libc/string/lib_explicit_bzero.c b/libs/libc/string/lib_explicit_bzero.c index 3b0dde0..251788c 100644 --- a/libs/libc/string/lib_explicit_bzero.c +++ b/libs/libc/string/lib_explicit_bzero.c @@ -41,7 +41,7 @@ #include <string.h> /**************************************************************************** - * Global Functions + * Public Functions ****************************************************************************/ /* memset that must not be optimized away by compiler (not even with LTO). */ diff --git a/libs/libc/string/lib_memccpy.c b/libs/libc/string/lib_memccpy.c index 5f71277..c9393bb 100644 --- a/libs/libc/string/lib_memccpy.c +++ b/libs/libc/string/lib_memccpy.c @@ -45,7 +45,6 @@ * Public Functions ****************************************************************************/ - /**************************************************************************** * Name: memccpy * diff --git a/libs/libc/string/lib_strtokr.c b/libs/libc/string/lib_strtokr.c index 6ed8bda..d6d5f04 100644 --- a/libs/libc/string/lib_strtokr.c +++ b/libs/libc/string/lib_strtokr.c @@ -133,7 +133,6 @@ FAR char *strtok_r(FAR char *str, FAR const char *delim, FAR char **saveptr) *pend && strchr(delim, *pend) == NULL; pend++); - /* pend either points to the end of the string or to * the first delimiter after the string. */ @@ -153,5 +152,6 @@ FAR char *strtok_r(FAR char *str, FAR const char *delim, FAR char **saveptr) { *saveptr = pend; } + return pbegin; } diff --git a/libs/libc/string/lib_vikmemcpy.c b/libs/libc/string/lib_vikmemcpy.c index abc0c3f..94a51bd 100644 --- a/libs/libc/string/lib_vikmemcpy.c +++ b/libs/libc/string/lib_vikmemcpy.c @@ -294,6 +294,7 @@ typedef uint32_t UIntN; /**************************************************************************** * Public Functions ****************************************************************************/ + /**************************************************************************** * Name: memcpy * diff --git a/libs/libc/wchar/lib_wcscmp.c b/libs/libc/wchar/lib_wcscmp.c index fb1beff..788aa77 100644 --- a/libs/libc/wchar/lib_wcscmp.c +++ b/libs/libc/wchar/lib_wcscmp.c @@ -49,10 +49,11 @@ * * Description: * The wcscmp() function returns zero if the wide-character strings at s1 - * and s2 are equal. It returns an integer greater than zero if at the first - * differing position i, the corresponding wide-character s1[i] is greater - * than s2[i]. It returns an integer less than zero if at the first differ- - * ing position i, the corresponding wide-character s1[i] is less than s2[i] + * and s2 are equal. It returns an integer greater than zero if at the + * first differing position i, the corresponding wide-character s1[i] is + * greater than s2[i]. It returns an integer less than zero if at the + * first differing position i, the corresponding wide-character s1[i] is + * less than s2[i] * ****************************************************************************/ diff --git a/libs/libc/wchar/lib_wcscoll.c b/libs/libc/wchar/lib_wcscoll.c index 991010a..590eb73 100644 --- a/libs/libc/wchar/lib_wcscoll.c +++ b/libs/libc/wchar/lib_wcscoll.c @@ -49,8 +49,8 @@ * * Description: * The wcscoll() compares the wide-character string pointed to by a to the - * wide-character string pointed to by b using an interpretation appropriate - * to the current LC_COLLATE state. + * wide-character string pointed to by b using an interpretation + * appropriate to the current LC_COLLATE state. * * The current implementation of wcscoll() simply uses wcscmp() and does * not support any language-specific sorting. diff --git a/libs/libc/wchar/lib_wcslcpy.c b/libs/libc/wchar/lib_wcslcpy.c index 5ffa0d0..d64d35f 100644 --- a/libs/libc/wchar/lib_wcslcpy.c +++ b/libs/libc/wchar/lib_wcslcpy.c @@ -21,11 +21,11 @@ * 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. + * 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. * ****************************************************************************/ diff --git a/libs/libc/wchar/lib_wcslen.c b/libs/libc/wchar/lib_wcslen.c index 4745d6a..85ec852 100644 --- a/libs/libc/wchar/lib_wcslen.c +++ b/libs/libc/wchar/lib_wcslen.c @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * citrus Id: wcslen.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp + * citrus Id: wcslen.c,v 1.1 1999/12/29 21:47:45 tshiozak Exp * ****************************************************************************/ diff --git a/libs/libc/wchar/lib_wcstoll.c b/libs/libc/wchar/lib_wcstoll.c index 1cb3a02..cf5b24e 100644 --- a/libs/libc/wchar/lib_wcstoll.c +++ b/libs/libc/wchar/lib_wcstoll.c @@ -52,7 +52,8 @@ * ****************************************************************************/ -long long int wcstoll(FAR const wchar_t *nptr, FAR wchar_t **endptr, int base) +long long int wcstoll(FAR const wchar_t *nptr, + FAR wchar_t **endptr, int base) { return strtoll((FAR const char *)nptr, (FAR char **)endptr, base); } diff --git a/libs/libc/wchar/lib_wcstoul.c b/libs/libc/wchar/lib_wcstoul.c index 23a3e23..b2bca7c 100644 --- a/libs/libc/wchar/lib_wcstoul.c +++ b/libs/libc/wchar/lib_wcstoul.c @@ -52,7 +52,8 @@ * ****************************************************************************/ -unsigned long int wcstoul(FAR const wchar_t *nptr, FAR wchar_t **endptr, int base) +unsigned long int wcstoul(FAR const wchar_t *nptr, + FAR wchar_t **endptr, int base) { return strtoul((const char *)nptr, (char **)endptr, base); } diff --git a/libs/libc/wchar/lib_wcstoull.c b/libs/libc/wchar/lib_wcstoull.c index 1bc9fa2..2ae1a54 100644 --- a/libs/libc/wchar/lib_wcstoull.c +++ b/libs/libc/wchar/lib_wcstoull.c @@ -47,8 +47,9 @@ * Name: wcstoull * * Description: - * The wcstoull() function is the wide-character equivalent of the strtoull() - * function. It converts a wchar string to unsigned long long value. + * The wcstoull() function is the wide-character equivalent of the + * strtoull() function. It converts a wchar string to unsigned long long + * value. * ****************************************************************************/ diff --git a/libs/libc/wchar/lib_wcsxfrm.c b/libs/libc/wchar/lib_wcsxfrm.c index 459150a..f8be0ec 100644 --- a/libs/libc/wchar/lib_wcsxfrm.c +++ b/libs/libc/wchar/lib_wcsxfrm.c @@ -48,10 +48,10 @@ * Name: wcsxfrm * * Description: - * The wcsxfrm() transforms the wide-character string pointed to by b to the - * wide-character string pointed to by a, comparing two transformed wide - * strings with wcscmp() should return the same result as comparing the - * original strings with wcscoll(). + * The wcsxfrm() transforms the wide-character string pointed to by b to + * the wide-character string pointed to by a, comparing two transformed + * wide strings with wcscmp() should return the same result as comparing + * the original strings with wcscoll(). * No more than n wide characters are transformed, including the trailing * null character. The current implementation of wcsxfrm() simply uses * wcslcpy() and does not support any language-specific transformations. diff --git a/libs/libc/wchar/lib_wmemchr.c b/libs/libc/wchar/lib_wmemchr.c index 3c9b147..38c9747 100644 --- a/libs/libc/wchar/lib_wmemchr.c +++ b/libs/libc/wchar/lib_wmemchr.c @@ -65,6 +65,7 @@ FAR wchar_t *wmemchr(FAR const wchar_t *s, wchar_t c, size_t n) return (FAR wchar_t *) s; } + s++; } diff --git a/libs/libc/wchar/lib_wmemmove.c b/libs/libc/wchar/lib_wmemmove.c index ff0f4fe..4b97732 100644 --- a/libs/libc/wchar/lib_wmemmove.c +++ b/libs/libc/wchar/lib_wmemmove.c @@ -46,9 +46,9 @@ * Name: wmemmove * * Description: - * The wmemmove() function is the wide-character equivalent of the memmove() - * function. It copies n wide characters from the array starting at src to - * the array starting at dest. The arrays may overlap. + * The wmemmove() function is the wide-character equivalent of the + * memmove() function. It copies n wide characters from the array starting + * at src to the array starting at dest. The arrays may overlap. * ****************************************************************************/ diff --git a/libs/libc/wctype/lib_iswctype.c b/libs/libc/wctype/lib_iswctype.c index ababe81..afccb8a 100644 --- a/libs/libc/wctype/lib_iswctype.c +++ b/libs/libc/wctype/lib_iswctype.c @@ -5,7 +5,8 @@ * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: + * modification, are permitted provided that the following conditions are + * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. @@ -18,16 +19,17 @@ * or promote products derived from this software without specific * prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 RED HAT INCORPORATED 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. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 RED HAT INCORPORATED 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. * ****************************************************************************/ diff --git a/libs/libc/wctype/lib_towlower.c b/libs/libc/wctype/lib_towlower.c index 19295e7..34da0c7 100644 --- a/libs/libc/wctype/lib_towlower.c +++ b/libs/libc/wctype/lib_towlower.c @@ -5,7 +5,8 @@ * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: + * modification, are permitted provided that the following conditions are + * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. @@ -18,16 +19,17 @@ * or promote products derived from this software without specific * prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 RED HAT INCORPORATED 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. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 RED HAT INCORPORATED 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. * ****************************************************************************/ diff --git a/libs/libc/wctype/lib_towupper.c b/libs/libc/wctype/lib_towupper.c index b54a511..acdd54c 100644 --- a/libs/libc/wctype/lib_towupper.c +++ b/libs/libc/wctype/lib_towupper.c @@ -5,7 +5,8 @@ * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: + * modification, are permitted provided that the following conditions are + * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. @@ -18,16 +19,17 @@ * or promote products derived from this software without specific * prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 RED HAT INCORPORATED 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. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 RED HAT INCORPORATED 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. * ****************************************************************************/ diff --git a/libs/libc/wctype/lib_wctype.c b/libs/libc/wctype/lib_wctype.c index 4342931..84b2c1f 100644 --- a/libs/libc/wctype/lib_wctype.c +++ b/libs/libc/wctype/lib_wctype.c @@ -5,7 +5,8 @@ * All rights reserved. * * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: + * modification, are permitted provided that the following conditions are + * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. @@ -18,16 +19,17 @@ * or promote products derived from this software without specific * prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 RED HAT INCORPORATED 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. + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "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 RED HAT INCORPORATED 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. * ****************************************************************************/