Switching to C99 stdint.h types

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2338 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2009-12-14 20:51:11 +00:00
parent 2c2a85f086
commit 3d1383407c
57 changed files with 325 additions and 353 deletions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib_basename.c
* lib/lib_basename.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -33,16 +33,11 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
#include <libgen.h>

View File

@ -38,15 +38,15 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <time.h>
#include <debug.h>
#include <nuttx/time.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@ -129,7 +129,7 @@ time_t clock_calendar2utc(int year, int month, int day)
{
int dyear;
#ifdef CONFIG_JULIAN_TIME
int isgreg;
bool isgreg;
#endif /* CONFIG_JULIAN_TIME */
/* Correct year & month ranges. Shift month into range 1-12 */
@ -149,19 +149,19 @@ time_t clock_calendar2utc(int year, int month, int day)
if (year > GREG_YEAR)
{
isgreg = TRUE;
isgreg = true;
}
else if (year < GREG_YEAR)
{
isgreg = FALSE;
isgreg = false;
}
else if (month > GREG_MONTH)
{
isgreg = TRUE;
isgreg = true;
}
else if (month < GREG_MONTH)
{
isgreg = FALSE;
isgreg = false;
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_chdir.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,9 +39,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

View File

@ -1,5 +1,5 @@
/****************************************************************************
* lib_checkbase.c
* lib/lib_checkbase.c
*
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@ -38,9 +38,10 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
#include <ctype.h>
#include "lib_internal.h"
/****************************************************************************

View File

@ -38,11 +38,14 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <nuttx/time.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@ -61,7 +64,7 @@
* Public Variables
****************************************************************************/
uint16 g_daysbeforemonth[13] =
uint16_t g_daysbeforemonth[13] =
{
0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365
};
@ -86,7 +89,7 @@ uint16 g_daysbeforemonth[13] =
*
****************************************************************************/
int clock_daysbeforemonth(int month, boolean leapyear)
int clock_daysbeforemonth(int month, bool leapyear)
{
int retval = g_daysbeforemonth[month];
if (month >= 2 && leapyear)

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_dbg.c
*
* Copyright (C) 2007, 2008, 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -39,7 +39,6 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdarg.h>
#include <debug.h>

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib_dirname.c
* lib/lib_dirname.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -33,16 +33,11 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
#include <libgen.h>

View File

@ -33,17 +33,14 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <sys/types.h>
#include <stdint.h>
#include <debug.h>
/****************************************************************************
@ -78,7 +75,7 @@
*
****************************************************************************/
void lib_dumpbuffer(FAR const char *msg, FAR const ubyte *buffer, unsigned int buflen)
void lib_dumpbuffer(FAR const char *msg, FAR const uint8_t *buffer, unsigned int buflen)
{
int i, j, k;

View File

@ -33,16 +33,12 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_fflush.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -33,17 +33,13 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
@ -53,7 +49,7 @@
#include "lib_internal.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@ -109,7 +105,7 @@ int fflush(FAR FILE *stream)
return lib_flushall(sched_getstreams());
}
else if (lib_fflush(stream, TRUE) != 0)
else if (lib_fflush(stream, true) != 0)
{
/* An error occurred during the flush AND/OR we were unable to flush all
* of the buffered write data. Return EOF on failure.

View File

@ -38,6 +38,8 @@
****************************************************************************/
#include <nuttx/config.h>
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
@ -154,10 +156,10 @@ static inline void _lib_consoleputs(FAR const char *str)
char *fgets(FAR char *buf, int buflen, FILE *stream)
{
#ifdef CONFIG_FGETS_ECHO
boolean console;
bool console;
#endif
int escape = 0;
int nch = 0;
int escape = 0;
int nch = 0;
/* Sanity checks */

View File

@ -38,7 +38,6 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdio.h>
#include <errno.h>

View File

@ -1,7 +1,7 @@
/************************************************************
* lib_filesem.c
/************************************************************************
* lib/lib_filesem.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -31,37 +31,39 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
************************************************************************/
/************************************************************
/************************************************************************
* Included Files
************************************************************/
************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <unistd.h>
#include <semaphore.h>
#include <errno.h>
#include <assert.h>
#include "lib_internal.h"
#if CONFIG_STDIO_BUFFER_SIZE > 0
/************************************************************
* Definitions
************************************************************/
/************************************************************************
* Pre-processor Definitions
************************************************************************/
/************************************************************
/************************************************************************
* Private Data
************************************************************/
************************************************************************/
/************************************************************
/************************************************************************
* Global Functions
************************************************************/
************************************************************************/
/************************************************************
/************************************************************************
* lib_sem_initialize
************************************************************/
************************************************************************/
void lib_sem_initialize(FAR struct file_struct *stream)
{
@ -75,9 +77,9 @@ void lib_sem_initialize(FAR struct file_struct *stream)
stream->fs_counts = 0;
}
/************************************************************
/************************************************************************
* lib_take_semaphore
************************************************************/
************************************************************************/
void lib_take_semaphore(FAR struct file_struct *stream)
{
@ -111,9 +113,9 @@ void lib_take_semaphore(FAR struct file_struct *stream)
}
}
/************************************************************
/************************************************************************
* lib_give_semaphore
************************************************************/
************************************************************************/
void lib_give_semaphore(FAR struct file_struct *stream)
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_fixedmath.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -38,12 +38,15 @@
****************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <stdbool.h>
#include <fixedmath.h>
#ifndef CONFIG_HAVE_LONG_LONG
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@ -66,23 +69,23 @@
* Name: fixsign
****************************************************************************/
static void fixsign(b16_t *parg1, b16_t *parg2, boolean *pnegate)
static void fixsign(b16_t *parg1, b16_t *parg2, bool *pnegate)
{
boolean negate = FALSE;
bool negate = false;
b16_t arg;
arg = *parg1;
if (arg < 0)
{
*parg1 = -arg;
negate = TRUE;
negate = true;
}
arg = *parg2;
if (arg < 0)
{
*parg2 = -arg;
negate ^= TRUE;
negate ^= true;
}
*pnegate = negate;
@ -92,7 +95,7 @@ static void fixsign(b16_t *parg1, b16_t *parg2, boolean *pnegate)
* Name: adjustsign
****************************************************************************/
static b16_t adjustsign(b16_t result, boolean negate)
static b16_t adjustsign(b16_t result, bool negate)
{
/* If the product is negative, then we overflowed */
@ -127,7 +130,7 @@ static b16_t adjustsign(b16_t result, boolean negate)
b16_t b16mulb16(b16_t m1, b16_t m2)
{
boolean negate;
bool negate;
b16_t product;
fixsign(&m1, &m2, &negate);
@ -153,10 +156,10 @@ ub16_t ub16mulub16(ub16_t m1, ub16_t m2)
* = a*2**16 + b + c*2**-16
*/
uint32 m1i = ((uint32)m1 >> 16);
uint32 m2i = ((uint32)m1 >> 16);
uint32 m1f = ((uint32)m1 & 0x0000ffff);
uint32 m2f = ((uint32)m2 & 0x0000ffff);
uint32_t m1i = ((uint32_t)m1 >> 16);
uint32_t m2i = ((uint32_t)m1 >> 16);
uint32_t m1f = ((uint32_t)m1 & 0x0000ffff);
uint32_t m2f = ((uint32_t)m2 & 0x0000ffff);
return (m1i*m2i << 16) + m1i*m2f + m2i*m1f + (((m1f*m2f) + b16HALF) >> 16);
}
@ -202,8 +205,8 @@ ub16_t ub16sqr(ub16_t a)
* = (mi*mi)*2**16 + 2*(mi*mf) + mf*mf*2**-16 (b16)
*/
uint32 mi = ((uint32)a >> 16);
uint32 mf = ((uint32)a & 0x0000ffff);
uint32_t mi = ((uint32_t)a >> 16);
uint32_t mf = ((uint32_t)a & 0x0000ffff);
return (mi*mi << 16) + (mi*mf << 1) + ((mf*mf + b16HALF) >> 16);
}
@ -214,7 +217,7 @@ ub16_t ub16sqr(ub16_t a)
b16_t b16divb16(b16_t num, b16_t denom)
{
boolean negate;
bool negate;
b16_t quotient;
fixsign(&num, &denom, &negate);
@ -228,9 +231,9 @@ b16_t b16divb16(b16_t num, b16_t denom)
ub16_t ub16divub16(ub16_t num, ub16_t denom)
{
uint32 term1;
uint32 numf;
uint32 product;
uint32_t term1;
uint32_t numf;
uint32_t product;
/* Let:
*
@ -245,7 +248,7 @@ ub16_t ub16divub16(ub16_t num, ub16_t denom)
/* Check for overflow in the first part of the quotient */
term1 = ((uint32)num & 0xffff0000) / denom;
term1 = ((uint32_t)num & 0xffff0000) / denom;
if (term1 >= 0x00010000)
{
return ub16MAX; /* Will overflow */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_fopen.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -33,22 +33,19 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include "lib_internal.h"
/****************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_fread.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -33,15 +33,15 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdio.h>
#include "lib_internal.h"
/****************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_fwrite.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -33,15 +33,15 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdio.h>
#include "lib_internal.h"
/****************************************************************************

View File

@ -38,7 +38,8 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <unistd.h>
#include <string.h>
@ -59,7 +60,7 @@ int optopt = '?'; /* unrecognized option character */
****************************************************************************/
static FAR char *g_optptr = NULL;
static boolean g_binitialized = FALSE;
static bool g_binitialized = false;
/****************************************************************************
* Global Functions
@ -120,7 +121,7 @@ int getopt(int argc, FAR char *const argv[], FAR const char *optstring)
{
optind = 1; /* Skip over the program name */
g_optptr = NULL; /* Start at the beginning of the first argument */
g_binitialized = TRUE; /* Now we are initialized */
g_binitialized = true; /* Now we are initialized */
}
/* If the first character of opstring s ':', then ':' is in the event of
@ -160,7 +161,7 @@ int getopt(int argc, FAR char *const argv[], FAR const char *optstring)
{
/* There are no more arguments, we are finished */
g_binitialized = FALSE;
g_binitialized = false;
/* Return -1 with optind == all of the arguments */
@ -176,7 +177,7 @@ int getopt(int argc, FAR char *const argv[], FAR const char *optstring)
/* The argument does not start with '-', we are finished */
g_optptr = NULL;
g_binitialized = FALSE;
g_binitialized = false;
/* Return the -1 with optind set to the non-option argument */

View File

@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <unistd.h>
/****************************************************************************

View File

@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <unistd.h>
/****************************************************************************

View File

@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <unistd.h>
/****************************************************************************

View File

@ -38,7 +38,6 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <time.h>
#include <errno.h>

View File

@ -38,8 +38,8 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <time.h>
#include <errno.h>
#include <debug.h>
@ -171,11 +171,11 @@ static void clock_utc2julian(time_t jd, int *year, int *month, int *day)
static void clock_utc2calendar(time_t days, int *year, int *month, int *day)
{
int value;
int min;
int max;
int tmp;
boolean leapyear;
int value;
int min;
int max;
int tmp;
bool leapyear;
/* There is one leap year every four years, so we can get close with the
* following:

View File

@ -1,5 +1,5 @@
/************************************************************
* lib_ntohl.c
* lib/lib_ntohl.c
*
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@ -33,22 +33,20 @@
*
************************************************************/
/************************************************************
* Compilation Switches
************************************************************/
/************************************************************
* Included Files
************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <arpa/inet.h>
/************************************************************
* Global Functions
************************************************************/
uint32 htonl(uint32 hl)
uint32_t htonl(uint32_t hl)
{
#ifdef CONFIG_ENDIAN_BIG
return hl;
@ -60,7 +58,7 @@ uint32 htonl(uint32 hl)
#endif
}
uint32 ntohl(uint32 nl)
uint32_t ntohl(uint32_t nl)
{
#ifdef CONFIG_ENDIAN_BIG
return nl;

View File

@ -1,7 +1,7 @@
/***************************************************************************
* lib_htons.c
* lib/lib_htons.c
*
* Copyright (C) 2007, 2008, 2009 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -42,18 +42,20 @@
***************************************************************************/
#include <nuttx/config.h>
#include <stdint.h>
#include <arpa/inet.h>
/***************************************************************************
* Global Functions
***************************************************************************/
uint16 htons(uint16 hs)
uint16_t htons(uint16_t hs)
{
return HTONS(hs);
}
uint16 ntohs(uint16 ns)
uint16_t ntohs(uint16_t ns)
{
#ifdef CONFIG_ENDIAN_BIG
return ns;

View File

@ -33,14 +33,17 @@
*
****************************************************************************/
#ifndef __LIB_INTERNAL_H
#define __LIB_INTERNAL_H
#ifndef __LIB_LIB_INTERNAL_H
#define __LIB_LIB_INTERNAL_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <stdio.h>
#include <limits.h>
#include <semaphore.h>
@ -109,7 +112,7 @@ extern ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream);
/* Defined in lib_libfflush.c */
extern ssize_t lib_fflush(FAR FILE *stream, boolean bforce);
extern ssize_t lib_fflush(FAR FILE *stream, bool bforce);
/* Defined in lib_rdflush.c */
@ -137,10 +140,10 @@ extern void lib_skipspace(const char **pptr);
/* Defined in lib_isbasedigit.c */
extern boolean lib_isbasedigit(int ch, int base, int *value);
extern bool lib_isbasedigit(int ch, int base, int *value);
/* Defined in lib_checkbase.c */
extern int lib_checkbase(int base, const char **pptr);
#endif /* __LIB_INTERNAL_H */
#endif /* __LIB_LIB_INTERNAL_H */

View File

@ -38,9 +38,11 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
#include "lib_internal.h"
/****************************************************************************
@ -61,17 +63,17 @@
*
****************************************************************************/
boolean lib_isbasedigit(int ch, int base, int *value)
bool lib_isbasedigit(int ch, int base, int *value)
{
boolean ret = FALSE;
int tmp = 0;
bool ret = false;
int tmp = 0;
if (base <= 10)
{
if (ch >= '0' && ch <= base + '0' - 1)
{
tmp = ch - '0';
ret = TRUE;
ret = true;
}
}
else if (base <= 36)
@ -79,17 +81,17 @@ boolean lib_isbasedigit(int ch, int base, int *value)
if (ch >= '0' && ch <= '9')
{
tmp = ch - '0';
ret =TRUE;
ret = true;
}
else if (ch >= 'a' && ch <= 'a' + base - 11)
{
tmp = ch - 'a' + 10;
ret = TRUE;
ret = true;
}
else if (ch >= 'A' && ch <= 'A' + base - 11)
{
tmp = ch - 'A' + 10;
ret = TRUE;
ret = true;
}
}

View File

@ -38,11 +38,11 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <nuttx/time.h>
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************

View File

@ -44,6 +44,7 @@
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
@ -102,7 +103,7 @@
*
****************************************************************************/
ssize_t lib_fflush(FAR FILE *stream, boolean bforce)
ssize_t lib_fflush(FAR FILE *stream, bool bforce)
{
#if CONFIG_STDIO_BUFFER_SIZE > 0
FAR const unsigned char *src;

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_libflushall.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -33,17 +33,13 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <fcntl.h>
#include <errno.h>
@ -52,7 +48,7 @@
#include "lib_internal.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@ -119,7 +115,7 @@ int lib_flushall(FAR struct streamlist *list)
{
/* Flush the writable FILE */
if (lib_fflush(stream, TRUE) != 0)
if (lib_fflush(stream, true) != 0)
{
/* An error occurred during the flush AND/OR we were unable
* to flush all of the buffered write data. Return EOF on failure.

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_libfread.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -33,24 +33,23 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h> /* for CONFIG_STDIO_BUFFER_SIZE */
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <fcntl.h>
#include <errno.h>
#include "lib_internal.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_libfwrite.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -33,16 +33,14 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h> /* for CONFIG_STDIO_BUFFER_SIZE */
#include <sys/types.h>
#include <stdbool.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
@ -51,7 +49,7 @@
#include "lib_internal.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@ -155,7 +153,7 @@ ssize_t lib_fwrite(FAR const void *ptr, size_t count, FAR FILE *stream)
{
/* Flush the buffered data to the IO stream */
int bytes_buffered = lib_fflush(stream, FALSE);
int bytes_buffered = lib_fflush(stream, false);
if (bytes_buffered < 0)
{
goto errout_with_semaphore;

View File

@ -1,5 +1,5 @@
/****************************************************************************
* lib_libvsprintf.c
* lib/lib_libvsprintf.c
*
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
@ -33,23 +33,21 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/compiler.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include "lib_internal.h"
/****************************************************************************
* Definitions
* Pre-processor oDefinitions
****************************************************************************/
enum
@ -109,38 +107,38 @@ enum
/* Pointer to ASCII conversion */
#ifdef CONFIG_PTR_IS_NOT_INT
static void ptohex(FAR struct lib_outstream_s *obj, ubyte flags, FAR void *p);
static void ptohex(FAR struct lib_outstream_s *obj, uint8_t flags, FAR void *p);
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
static int getsizesize(ubyte fmt, ubyte flags, FAR void *p)
static int getsizesize(uint8_t fmt, uint8_t flags, FAR void *p)
#endif /* CONFIG_NOPRINTF_FIELDWIDTH */
#endif /* CONFIG_PTR_IS_NOT_INT */
/* Unsigned int to ASCII conversion */
static void utodec(FAR struct lib_outstream_s *obj, unsigned int n);
static void utohex(FAR struct lib_outstream_s *obj, unsigned int n, ubyte a);
static void utohex(FAR struct lib_outstream_s *obj, unsigned int n, uint8_t a);
static void utooct(FAR struct lib_outstream_s *obj, unsigned int n);
static void utobin(FAR struct lib_outstream_s *obj, unsigned int n);
static void utoascii(FAR struct lib_outstream_s *obj, ubyte fmt,
ubyte flags, unsigned int lln);
static void utoascii(FAR struct lib_outstream_s *obj, uint8_t fmt,
uint8_t flags, unsigned int lln);
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
static void fixup(ubyte fmt, FAR ubyte *flags, int *n);
static int getusize(ubyte fmt, ubyte flags, unsigned int lln);
static void fixup(uint8_t fmt, FAR uint8_t *flags, int *n);
static int getusize(uint8_t fmt, uint8_t flags, unsigned int lln);
#endif
/* Unsigned long int to ASCII conversion */
#ifdef CONFIG_LONG_IS_NOT_INT
static void lutodec(FAR struct lib_outstream_s *obj, unsigned long ln);
static void lutohex(FAR struct lib_outstream_s *obj, unsigned long ln, ubyte a);
static void lutohex(FAR struct lib_outstream_s *obj, unsigned long ln, uint8_t a);
static void lutooct(FAR struct lib_outstream_s *obj, unsigned long ln);
static void lutobin(FAR struct lib_outstream_s *obj, unsigned long ln);
static void lutoascii(FAR struct lib_outstream_s *obj, ubyte fmt,
ubyte flags, unsigned long ln);
static void lutoascii(FAR struct lib_outstream_s *obj, uint8_t fmt,
uint8_t flags, unsigned long ln);
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
static void lfixup(ubyte fmt, FAR ubyte *flags, long *ln);
static int getlusize(ubyte fmt, FAR ubyte flags, unsigned long ln);
static void lfixup(uint8_t fmt, FAR uint8_t *flags, long *ln);
static int getlusize(uint8_t fmt, FAR uint8_t flags, unsigned long ln);
#endif
#endif
@ -148,22 +146,22 @@ static int getlusize(ubyte fmt, FAR ubyte flags, unsigned long ln);
#ifdef CONFIG_HAVE_LONG_LONG
static void llutodec(FAR struct lib_outstream_s *obj, unsigned long long lln);
static void llutohex(FAR struct lib_outstream_s *obj, unsigned long long lln, ubyte a);
static void llutohex(FAR struct lib_outstream_s *obj, unsigned long long lln, uint8_t a);
static void llutooct(FAR struct lib_outstream_s *obj, unsigned long long lln);
static void llutobin(FAR struct lib_outstream_s *obj, unsigned long long lln);
static void llutoascii(FAR struct lib_outstream_s *obj, ubyte fmt,
ubyte flags, unsigned long long lln);
static void llutoascii(FAR struct lib_outstream_s *obj, uint8_t fmt,
uint8_t flags, unsigned long long lln);
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
static void llfixup(ubyte fmt, FAR ubyte *flags, FAR long long *lln);
static int getllusize(ubyte fmt, FAR ubyte flags, FAR unsigned long long lln);
static void llfixup(uint8_t fmt, FAR uint8_t *flags, FAR long long *lln);
static int getllusize(uint8_t fmt, FAR uint8_t flags, FAR unsigned long long lln);
#endif
#endif
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
static void prejustify(FAR struct lib_outstream_s *obj, ubyte fmt,
ubyte flags, int fieldwidth, int numwidth);
static void postjustify(FAR struct lib_outstream_s *obj, ubyte fmt,
ubyte flags, int fieldwidth, int numwidth);
static void prejustify(FAR struct lib_outstream_s *obj, uint8_t fmt,
uint8_t flags, int fieldwidth, int numwidth);
static void postjustify(FAR struct lib_outstream_s *obj, uint8_t fmt,
uint8_t flags, int fieldwidth, int numwidth);
#endif
/****************************************************************************
@ -193,14 +191,14 @@ static const char g_nullstring[] = "(null)";
****************************************************************************/
#ifdef CONFIG_PTR_IS_NOT_INT
static void ptohex(FAR struct lib_outstream_s *obj, ubyte flags, FAR void *p)
static void ptohex(FAR struct lib_outstream_s *obj, uint8_t flags, FAR void *p)
{
union
{
uint32 dw;
uint32_t dw;
FAR void *p;
} u;
ubyte bits;
uint8_t bits;
/* Check for alternate form */
@ -217,7 +215,7 @@ static void ptohex(FAR struct lib_outstream_s *obj, ubyte flags, FAR void *p)
for (bits = 8*sizeof(void *); bits > 0; bits -= 4)
{
ubyte nibble = (ubyte)((u.dw >> (bits - 4)) & 0xf);
uint8_t nibble = (uint8_t)((u.dw >> (bits - 4)) & 0xf);
if (nibble < 10)
{
obj->put(obj, nibble + '0');
@ -234,7 +232,7 @@ static void ptohex(FAR struct lib_outstream_s *obj, ubyte flags, FAR void *p)
****************************************************************************/
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
static int getpsize(ubyte flags, FAR void *p)
static int getpsize(uint8_t flags, FAR void *p)
{
struct lib_outstream_s nulloutstream;
lib_nulloutstream(&nulloutstream);
@ -267,17 +265,17 @@ static void utodec(FAR struct lib_outstream_s *obj, unsigned int n)
* Name: utohex
****************************************************************************/
static void utohex(FAR struct lib_outstream_s *obj, unsigned int n, ubyte a)
static void utohex(FAR struct lib_outstream_s *obj, unsigned int n, uint8_t a)
{
boolean nonzero = FALSE;
ubyte bits;
bool nonzero = false;
uint8_t bits;
for (bits = 8*sizeof(unsigned int); bits > 0; bits -= 4)
{
ubyte nibble = (ubyte)((n >> (bits - 4)) & 0xf);
uint8_t nibble = (uint8_t)((n >> (bits - 4)) & 0xf);
if (nibble || nonzero)
{
nonzero = TRUE;
nonzero = true;
if (nibble < 10)
{
@ -334,7 +332,7 @@ static void utobin(FAR struct lib_outstream_s *obj, unsigned int n)
* Name: utoascii
****************************************************************************/
static void utoascii(FAR struct lib_outstream_s *obj, ubyte fmt, ubyte flags, unsigned int n)
static void utoascii(FAR struct lib_outstream_s *obj, uint8_t fmt, uint8_t flags, unsigned int n)
{
/* Perform the integer conversion according to the format specifier */
@ -446,7 +444,7 @@ static void utoascii(FAR struct lib_outstream_s *obj, ubyte fmt, ubyte flags, un
****************************************************************************/
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
static void fixup(ubyte fmt, FAR ubyte *flags, FAR int *n)
static void fixup(uint8_t fmt, FAR uint8_t *flags, FAR int *n)
{
/* Perform the integer conversion according to the format specifier */
@ -488,7 +486,7 @@ static void fixup(ubyte fmt, FAR ubyte *flags, FAR int *n)
* Name: getusize
****************************************************************************/
static int getusize(ubyte fmt, ubyte flags, unsigned int n)
static int getusize(uint8_t fmt, uint8_t flags, unsigned int n)
{
struct lib_outstream_s nulloutstream;
lib_nulloutstream(&nulloutstream);
@ -520,17 +518,17 @@ static void lutodec(FAR struct lib_outstream_s *obj, unsigned long n)
* Name: lutohex
****************************************************************************/
static void lutohex(FAR struct lib_outstream_s *obj, unsigned long n, ubyte a)
static void lutohex(FAR struct lib_outstream_s *obj, unsigned long n, uint8_t a)
{
boolean nonzero = FALSE;
ubyte bits;
bool nonzero = false;
uint8_t bits;
for (bits = 8*sizeof(unsigned long); bits > 0; bits -= 4)
{
ubyte nibble = (ubyte)((n >> (bits - 4)) & 0xf);
uint8_t nibble = (uint8_t)((n >> (bits - 4)) & 0xf);
if (nibble || nonzero)
{
nonzero = TRUE;
nonzero = true;
if (nibble < 10)
{
@ -587,7 +585,7 @@ static void lutobin(FAR struct lib_outstream_s *obj, unsigned long n)
* Name: lutoascii
****************************************************************************/
static void lutoascii(FAR struct lib_outstream_s *obj, ubyte fmt, ubyte flags, unsigned long ln)
static void lutoascii(FAR struct lib_outstream_s *obj, uint8_t fmt, uint8_t flags, unsigned long ln)
{
/* Perform the integer conversion according to the format specifier */
@ -694,7 +692,7 @@ static void lutoascii(FAR struct lib_outstream_s *obj, ubyte fmt, ubyte flags, u
****************************************************************************/
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
static void lfixup(ubyte fmt, FAR ubyte *flags, FAR long *ln)
static void lfixup(uint8_t fmt, FAR uint8_t *flags, FAR long *ln)
{
/* Perform the integer conversion according to the format specifier */
@ -736,7 +734,7 @@ static void lfixup(ubyte fmt, FAR ubyte *flags, FAR long *ln)
* Name: getlusize
****************************************************************************/
static int getlusize(ubyte fmt, ubyte flags, unsigned long ln)
static int getlusize(uint8_t fmt, uint8_t flags, unsigned long ln)
{
struct lib_outstream_s nulloutstream;
lib_nulloutstream(&nulloutstream);
@ -770,17 +768,17 @@ static void llutodec(FAR struct lib_outstream_s *obj, unsigned long long n)
* Name: llutohex
****************************************************************************/
static void llutohex(FAR struct lib_outstream_s *obj, unsigned long long n, ubyte a)
static void llutohex(FAR struct lib_outstream_s *obj, unsigned long long n, uint8_t a)
{
boolean nonzero = FALSE;
ubyte bits;
bool nonzero = false;
uint8_t bits;
for (bits = 8*sizeof(unsigned long long); bits > 0; bits -= 4)
{
ubyte nibble = (ubyte)((n >> (bits - 4)) & 0xf);
uint8_t nibble = (uint8_t)((n >> (bits - 4)) & 0xf);
if (nibble || nonzero)
{
nonzero = TRUE;
nonzero = true;
if (nibble < 10)
{
@ -837,7 +835,7 @@ static void llutobin(FAR struct lib_outstream_s *obj, unsigned long long n)
* Name: llutoascii
****************************************************************************/
static void llutoascii(FAR struct lib_outstream_s *obj, ubyte fmt, ubyte flags, unsigned long long lln)
static void llutoascii(FAR struct lib_outstream_s *obj, uint8_t fmt, uint8_t flags, unsigned long long lln)
{
/* Perform the integer conversion according to the format specifier */
@ -944,7 +942,7 @@ static void llutoascii(FAR struct lib_outstream_s *obj, ubyte fmt, ubyte flags,
****************************************************************************/
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
static void llfixup(ubyte fmt, FAR ubyte *flags, FAR long long *lln)
static void llfixup(uint8_t fmt, FAR uint8_t *flags, FAR long long *lln)
{
/* Perform the integer conversion according to the format specifier */
@ -986,7 +984,7 @@ static void llfixup(ubyte fmt, FAR ubyte *flags, FAR long long *lln)
* Name: getllusize
****************************************************************************/
static int getllusize(ubyte fmt, ubyte flags, unsigned long long lln)
static int getllusize(uint8_t fmt, uint8_t flags, unsigned long long lln)
{
struct lib_outstream_s nulloutstream;
lib_nulloutstream(&nulloutstream);
@ -1004,8 +1002,8 @@ static int getllusize(ubyte fmt, ubyte flags, unsigned long long lln)
****************************************************************************/
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
static void prejustify(FAR struct lib_outstream_s *obj, ubyte fmt,
ubyte flags, int fieldwidth, int numwidth)
static void prejustify(FAR struct lib_outstream_s *obj, uint8_t fmt,
uint8_t flags, int fieldwidth, int numwidth)
{
int i;
@ -1070,8 +1068,8 @@ static void prejustify(FAR struct lib_outstream_s *obj, ubyte fmt,
****************************************************************************/
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
static void postjustify(FAR struct lib_outstream_s *obj, ubyte fmt,
ubyte flags, int fieldwidth, int numwidth)
static void postjustify(FAR struct lib_outstream_s *obj, uint8_t fmt,
uint8_t flags, int fieldwidth, int numwidth)
{
int i;
@ -1113,9 +1111,9 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, const char *src, va_list ap)
#ifndef CONFIG_NOPRINTF_FIELDWIDTH
int width;
int trunc;
ubyte fmt;
uint8_t fmt;
#endif
ubyte flags;
uint8_t flags;
for (; *src; src++)
{

View File

@ -38,7 +38,6 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <time.h>
#include <debug.h>

View File

@ -45,6 +45,8 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdlib.h>
/****************************************************************************

View File

@ -1,7 +1,7 @@
/************************************************************
* lib_sem.c
* lib/lib_sem.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -41,14 +41,16 @@
#ifdef CONFIG_STDIO_BUFFERED_IO
#include <sys/types.h>
#include <unistd.h>
#include <semaphore.h>
#include <errno.h>
#include <assert.h>
#include "lib_internal.h"
/************************************************************
* Definitions
* Pre-processor Definitions
************************************************************/
/************************************************************

View File

@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
#include <ctype.h>
#include "lib_internal.h"

View File

@ -37,11 +37,15 @@
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdio.h>
#include "lib_internal.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************

View File

@ -33,17 +33,12 @@
*
*****************************************************************************/
/****************************************************************************
* Compilation Switches
*****************************************************************************/
/****************************************************************************
* Included Files
*****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
#include <ctype.h>

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_strcat.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
/****************************************************************************

View File

@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
/****************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_strcmp.c
*
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2007-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -33,16 +33,12 @@
*
*****************************************************************************/
/****************************************************************************
* Compilation Switches
*****************************************************************************/
/****************************************************************************
* Included Files
*****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
/****************************************************************************

View File

@ -1,7 +1,7 @@
/************************************************************
* lib_strcpy.c
/************************************************************************
* lib/lib_strcpy.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -31,23 +31,19 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
************************************************************************/
/************************************************************
* Compilation Switches
************************************************************/
/************************************************************
/************************************************************************
* Included Files
************************************************************/
************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
/************************************************************
/************************************************************************
* Global Functions
************************************************************/
************************************************************************/
#ifndef CONFIG_ARCH_STRCPY
char *strcpy(char *dest, const char *src)

View File

@ -1,7 +1,7 @@
/************************************************************
* lib_strdup.c
/************************************************************************
* lib/lib_strdup.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -31,20 +31,20 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
************************************************************************/
/************************************************************
/************************************************************************
* Included Files
************************************************************/
************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
/************************************************************
/************************************************************************
* Global Functions
************************************************************/
************************************************************************/
FAR char *strdup(const char *s)
{

View File

@ -1,7 +1,7 @@
/************************************************************
* lib_streamsem.c
/************************************************************************
* lib/ib_streamsem.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -31,45 +31,42 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
************************************************************************/
/************************************************************
* Compilation Switches
************************************************************/
/************************************************************
/************************************************************************
* Included Files
************************************************************/
************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <semaphore.h>
#include <errno.h>
#include <nuttx/fs.h>
#include "lib_internal.h"
/************************************************************
/************************************************************************
* Private types
************************************************************/
************************************************************************/
/************************************************************
/************************************************************************
* Private Variables
************************************************************/
************************************************************************/
/************************************************************
/************************************************************************
* Public Variables
************************************************************/
************************************************************************/
/************************************************************
/************************************************************************
* Private Functions
************************************************************/
************************************************************************/
/************************************************************
/************************************************************************
* Public Functions
************************************************************/
************************************************************************/
void stream_semtake(FAR struct streamlist *list)
{

View File

@ -1,7 +1,7 @@
/************************************************************************
* lib_strerror.c
* lib/lib_strerror.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -38,7 +38,8 @@
************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
@ -52,7 +53,7 @@
struct errno_strmap_s
{
ubyte errnum;
uint8_t errnum;
const char *str;
};

View File

@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
/****************************************************************************

View File

@ -1,7 +1,7 @@
/************************************************************
* lib_strrchr.c
/************************************************************************
* lib/lib_strrchr.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -31,23 +31,19 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
************************************************************************/
/************************************************************
* Compilation Switches
************************************************************/
/************************************************************
/************************************************************************
* Included Files
************************************************************/
************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
/************************************************************
/************************************************************************
* Global Functions
************************************************************/
************************************************************************/
/* The strrchr() function returns a pointer to the last
* occurrence of the character c in the string s.

View File

@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <string.h>
/****************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib_strtol.c
* lib/lib_strtol.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -38,8 +38,10 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <stdlib.h>
#include "lib_internal.h"
/****************************************************************************
@ -65,7 +67,7 @@
long strtol(const char *nptr, char **endptr, int base)
{
unsigned long accum = 0;
boolean negate = FALSE;
bool negate = false;
if (nptr)
{
@ -77,7 +79,7 @@ long strtol(const char *nptr, char **endptr, int base)
if (*nptr == '-')
{
negate = TRUE;
negate = true;
nptr++;
}
else if (*nptr == '+')

View File

@ -38,8 +38,10 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <stdlib.h>
#include "lib_internal.h"
#ifdef CONFIG_HAVE_LONG_LONG
@ -67,7 +69,7 @@
long long strtoll(const char *nptr, char **endptr, int base)
{
unsigned long long accum = 0;
boolean negate = FALSE;
bool negate = false;
if (nptr)
{
@ -79,7 +81,7 @@ long long strtoll(const char *nptr, char **endptr, int base)
if (*nptr == '-')
{
negate = TRUE;
negate = true;
nptr++;
}
else if (*nptr == '+')

View File

@ -38,8 +38,9 @@
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdlib.h>
#include "lib_internal.h"
/****************************************************************************

View File

@ -39,8 +39,9 @@
#include <nuttx/config.h>
#include <nuttx/compiler.h>
#include <sys/types.h>
#include <stdlib.h>
#include "lib_internal.h"
#ifdef CONFIG_HAVE_LONG_LONG

View File

@ -37,14 +37,15 @@
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <nuttx/config.h>
#include <stdio.h>
#include <semaphore.h>
#include "lib_internal.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************

View File

@ -37,11 +37,15 @@
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdio.h>
#include "lib_internal.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************

View File

@ -33,21 +33,18 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <sys/types.h>
#include <nuttx/config.h>
#include <stdio.h>
#include "lib_internal.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************

View File

@ -1,7 +1,7 @@
/****************************************************************************
* lib/lib_wrflush.c
*
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -33,24 +33,20 @@
*
****************************************************************************/
/****************************************************************************
* Compilation Switches
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdbool.h>
#include <fcntl.h>
#include <errno.h>
#include "lib_internal.h"
/****************************************************************************
* Definitions
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
@ -103,7 +99,7 @@ int lib_wrflush(FAR FILE *stream)
*/
if ((stream->fs_oflags & O_WROK) == 0 ||
lib_fflush(stream, TRUE) == 0)
lib_fflush(stream, true) == 0)
{
/* Return success if there is no buffered write data -- i.e., that
* the stream is not opened for writing or, if it is, that all of