libs: fix nxstyle errors
fix erros reported by nxstyle Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
This commit is contained in:
parent
8975a65197
commit
ed8e5e971b
53 changed files with 410 additions and 307 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -62,6 +62,5 @@ long double floorl(long double x)
|
|||
}
|
||||
|
||||
return modx;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,10 @@
|
|||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
double rint(double x)
|
||||
{
|
||||
long linteger;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,10 @@
|
|||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
float rintf(float x)
|
||||
{
|
||||
long linteger;
|
||||
|
|
|
|||
|
|
@ -71,6 +71,10 @@
|
|||
* Private Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
long double rintl(long double x)
|
||||
{
|
||||
int64_t llinteger;
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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) */
|
||||
|
|
|
|||
|
|
@ -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| */
|
||||
|
|
|
|||
|
|
@ -6,19 +6,14 @@
|
|||
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@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;
|
||||
|
|
|
|||
|
|
@ -90,6 +90,7 @@ static const uint32_t crc32_tab[] =
|
|||
/************************************************************************************************
|
||||
* Public Functions
|
||||
************************************************************************************************/
|
||||
|
||||
/************************************************************************************************
|
||||
* Name: crc32part
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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++)
|
||||
|
|
|
|||
|
|
@ -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, ':');
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
/* 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 */
|
||||
|
||||
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;
|
||||
{
|
||||
long i;
|
||||
long p;
|
||||
fc = fcode.code;
|
||||
|
||||
hp = ((((long)(fcode.e.c)) << (HBITS - 8)) ^ (long)(fcode.e.ent));
|
||||
hp = ((((long)(fcode.e.c)) << (HBITS - 8)) ^
|
||||
(long)(fcode.e.ent));
|
||||
|
||||
if ((i = htabof(hp)) == fc)
|
||||
goto hfound;
|
||||
if (i == -1)
|
||||
goto out;
|
||||
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:;
|
||||
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;
|
||||
{
|
||||
int i;
|
||||
|
||||
if (outpos + (i = (de_stack - stackp)) >= OBUFSIZ)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (i > OBUFSIZ - outpos)
|
||||
i = OBUFSIZ - outpos;
|
||||
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 (i > 0)
|
||||
{
|
||||
memcpy(outbuf + outpos, stackp, i);
|
||||
outpos += i;
|
||||
}
|
||||
|
||||
if (outpos >= OBUFSIZ)
|
||||
{
|
||||
if (write(fdout, outbuf, outpos) != outpos)
|
||||
write_error();
|
||||
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;
|
||||
}
|
||||
}
|
||||
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. */
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -48,3 +48,7 @@
|
|||
****************************************************************************/
|
||||
|
||||
const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -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 <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ FAR char *__ultoa_invert(unsigned long val, FAR char *str, int base)
|
|||
upper = 1;
|
||||
base &= ~XTOA_UPPER;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
int v;
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
* libs/libc/stdio/lib_vdprintf.c
|
||||
*
|
||||
* Copyright (C) 2012 Andrew Tridgell. All rights reserved.
|
||||
* Authors: Author: Andrew Tridgell <andrew@tridgell.net>
|
||||
* Authors: Andrew Tridgell <andrew@tridgell.net>
|
||||
* Gregory Nutt <gnutt@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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ loop:
|
|||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pm = (FAR char *)base + (nel / 2) * width;
|
||||
if (nel > 7)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include <string.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Global Functions
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/* memset that must not be optimized away by compiler (not even with LTO). */
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@
|
|||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Name: memccpy
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -294,6 +294,7 @@ typedef uint32_t UIntN;
|
|||
/****************************************************************************
|
||||
* Public Functions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Name: memcpy
|
||||
*
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue