summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nuttx/lib/lib_basename.c11
-rw-r--r--nuttx/lib/lib_calendar2utc.c14
-rw-r--r--nuttx/lib/lib_chdir.c4
-rw-r--r--nuttx/lib/lib_checkbase.c5
-rw-r--r--nuttx/lib/lib_daysbeforemonth.c11
-rw-r--r--nuttx/lib/lib_dbg.c3
-rw-r--r--nuttx/lib/lib_dirname.c11
-rw-r--r--nuttx/lib/lib_dumpbuffer.c9
-rw-r--r--nuttx/lib/lib_fclose.c6
-rw-r--r--nuttx/lib/lib_fflush.c12
-rw-r--r--nuttx/lib/lib_fgets.c8
-rw-r--r--nuttx/lib/lib_fileno.c1
-rw-r--r--nuttx/lib/lib_filesem.c42
-rw-r--r--nuttx/lib/lib_fixedmath.c41
-rw-r--r--nuttx/lib/lib_fopen.c9
-rw-r--r--nuttx/lib/lib_fread.c10
-rw-r--r--nuttx/lib/lib_fwrite.c10
-rw-r--r--nuttx/lib/lib_getopt.c11
-rw-r--r--nuttx/lib/lib_getoptargp.c2
-rw-r--r--nuttx/lib/lib_getoptindp.c2
-rw-r--r--nuttx/lib/lib_getoptoptp.c2
-rw-r--r--nuttx/lib/lib_gmtime.c1
-rw-r--r--nuttx/lib/lib_gmtimer.c12
-rw-r--r--nuttx/lib/lib_htonl.c12
-rw-r--r--nuttx/lib/lib_htons.c10
-rw-r--r--nuttx/lib/lib_internal.h13
-rw-r--r--nuttx/lib/lib_isbasedigit.c18
-rw-r--r--nuttx/lib/lib_isleapyear.c4
-rw-r--r--nuttx/lib/lib_libfflush.c3
-rw-r--r--nuttx/lib/lib_libflushall.c12
-rw-r--r--nuttx/lib/lib_libfread.c11
-rw-r--r--nuttx/lib/lib_libfwrite.c12
-rw-r--r--nuttx/lib/lib_libvsprintf.c124
-rw-r--r--nuttx/lib/lib_mktime.c1
-rw-r--r--nuttx/lib/lib_qsort.c2
-rw-r--r--nuttx/lib/lib_sem.c10
-rw-r--r--nuttx/lib/lib_skipspace.c2
-rw-r--r--nuttx/lib/lib_snprintf.c6
-rw-r--r--nuttx/lib/lib_strcasecmp.c5
-rw-r--r--nuttx/lib/lib_strcat.c4
-rw-r--r--nuttx/lib/lib_strchr.c2
-rw-r--r--nuttx/lib/lib_strcmp.c8
-rw-r--r--nuttx/lib/lib_strcpy.c24
-rw-r--r--nuttx/lib/lib_strdup.c20
-rw-r--r--nuttx/lib/lib_streamsem.c41
-rw-r--r--nuttx/lib/lib_strerror.c11
-rw-r--r--nuttx/lib/lib_strpbrk.c2
-rw-r--r--nuttx/lib/lib_strrchr.c24
-rw-r--r--nuttx/lib/lib_strstr.c2
-rw-r--r--nuttx/lib/lib_strtol.c12
-rw-r--r--nuttx/lib/lib_strtoll.c8
-rw-r--r--nuttx/lib/lib_strtoul.c3
-rw-r--r--nuttx/lib/lib_strtoull.c3
-rw-r--r--nuttx/lib/lib_vfprintf.c5
-rw-r--r--nuttx/lib/lib_vsnprintf.c6
-rw-r--r--nuttx/lib/lib_vsprintf.c9
-rw-r--r--nuttx/lib/lib_wrflush.c12
57 files changed, 325 insertions, 353 deletions
diff --git a/nuttx/lib/lib_basename.c b/nuttx/lib/lib_basename.c
index 853110ebd..6464b1770 100644
--- a/nuttx/lib/lib_basename.c
+++ b/nuttx/lib/lib_basename.c
@@ -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.
*
@@ -34,15 +34,10 @@
****************************************************************************/
/****************************************************************************
- * Compilation Switches
- ****************************************************************************/
-
-/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
#include <string.h>
#include <libgen.h>
diff --git a/nuttx/lib/lib_calendar2utc.c b/nuttx/lib/lib_calendar2utc.c
index ead92958f..dab69b0d9 100644
--- a/nuttx/lib/lib_calendar2utc.c
+++ b/nuttx/lib/lib_calendar2utc.c
@@ -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
{
diff --git a/nuttx/lib/lib_chdir.c b/nuttx/lib/lib_chdir.c
index 0db29829d..942ced697 100644
--- a/nuttx/lib/lib_chdir.c
+++ b/nuttx/lib/lib_chdir.c
@@ -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>
diff --git a/nuttx/lib/lib_checkbase.c b/nuttx/lib/lib_checkbase.c
index bf4dadf02..ed2654b1f 100644
--- a/nuttx/lib/lib_checkbase.c
+++ b/nuttx/lib/lib_checkbase.c
@@ -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"
/****************************************************************************
diff --git a/nuttx/lib/lib_daysbeforemonth.c b/nuttx/lib/lib_daysbeforemonth.c
index 718668bd1..0dbe4aeee 100644
--- a/nuttx/lib/lib_daysbeforemonth.c
+++ b/nuttx/lib/lib_daysbeforemonth.c
@@ -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)
diff --git a/nuttx/lib/lib_dbg.c b/nuttx/lib/lib_dbg.c
index b1c66adf4..890928cc2 100644
--- a/nuttx/lib/lib_dbg.c
+++ b/nuttx/lib/lib_dbg.c
@@ -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>
diff --git a/nuttx/lib/lib_dirname.c b/nuttx/lib/lib_dirname.c
index b77a0b689..c80bc80a3 100644
--- a/nuttx/lib/lib_dirname.c
+++ b/nuttx/lib/lib_dirname.c
@@ -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.
*
@@ -34,15 +34,10 @@
****************************************************************************/
/****************************************************************************
- * Compilation Switches
- ****************************************************************************/
-
-/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
#include <string.h>
#include <libgen.h>
diff --git a/nuttx/lib/lib_dumpbuffer.c b/nuttx/lib/lib_dumpbuffer.c
index a090bcb61..7444a5ced 100644
--- a/nuttx/lib/lib_dumpbuffer.c
+++ b/nuttx/lib/lib_dumpbuffer.c
@@ -34,16 +34,13 @@
****************************************************************************/
/****************************************************************************
- * 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;
diff --git a/nuttx/lib/lib_fclose.c b/nuttx/lib/lib_fclose.c
index 1c791ea21..218b38080 100644
--- a/nuttx/lib/lib_fclose.c
+++ b/nuttx/lib/lib_fclose.c
@@ -34,15 +34,11 @@
****************************************************************************/
/****************************************************************************
- * Compilation Switches
- ****************************************************************************/
-
-/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
diff --git a/nuttx/lib/lib_fflush.c b/nuttx/lib/lib_fflush.c
index f62d487b2..0e46edce3 100644
--- a/nuttx/lib/lib_fflush.c
+++ b/nuttx/lib/lib_fflush.c
@@ -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
@@ -34,16 +34,12 @@
****************************************************************************/
/****************************************************************************
- * 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.
diff --git a/nuttx/lib/lib_fgets.c b/nuttx/lib/lib_fgets.c
index bf638a38f..67d553c57 100644
--- a/nuttx/lib/lib_fgets.c
+++ b/nuttx/lib/lib_fgets.c
@@ -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 */
diff --git a/nuttx/lib/lib_fileno.c b/nuttx/lib/lib_fileno.c
index 65bd54a2d..1f33cd8f4 100644
--- a/nuttx/lib/lib_fileno.c
+++ b/nuttx/lib/lib_fileno.c
@@ -38,7 +38,6 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
#include <stdio.h>
#include <errno.h>
diff --git a/nuttx/lib/lib_filesem.c b/nuttx/lib/lib_filesem.c
index 0eaecf99f..cea6092dc 100644
--- a/nuttx/lib/lib_filesem.c
+++ b/nuttx/lib/lib_filesem.c
@@ -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)
{
diff --git a/nuttx/lib/lib_fixedmath.c b/nuttx/lib/lib_fixedmath.c
index dcd100559..d1717d945 100644
--- a/nuttx/lib/lib_fixedmath.c
+++ b/nuttx/lib/lib_fixedmath.c
@@ -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 */
diff --git a/nuttx/lib/lib_fopen.c b/nuttx/lib/lib_fopen.c
index e45a891f6..672fb5bbe 100644
--- a/nuttx/lib/lib_fopen.c
+++ b/nuttx/lib/lib_fopen.c
@@ -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
@@ -34,21 +34,18 @@
****************************************************************************/
/****************************************************************************
- * 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"
/****************************************************************************
diff --git a/nuttx/lib/lib_fread.c b/nuttx/lib/lib_fread.c
index d25c7b1e4..3345e55b1 100644
--- a/nuttx/lib/lib_fread.c
+++ b/nuttx/lib/lib_fread.c
@@ -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
@@ -34,14 +34,14 @@
****************************************************************************/
/****************************************************************************
- * Compilation Switches
- ****************************************************************************/
-
-/****************************************************************************
* Included Files
****************************************************************************/
+#include <nuttx/config.h>
+
+#include <sys/types.h>
#include <stdio.h>
+
#include "lib_internal.h"
/****************************************************************************
diff --git a/nuttx/lib/lib_fwrite.c b/nuttx/lib/lib_fwrite.c
index 0072ff09f..2ec35cd60 100644
--- a/nuttx/lib/lib_fwrite.c
+++ b/nuttx/lib/lib_fwrite.c
@@ -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
@@ -34,14 +34,14 @@
****************************************************************************/
/****************************************************************************
- * Compilation Switches
- ****************************************************************************/
-
-/****************************************************************************
* Included Files
****************************************************************************/
+#include <nuttx/config.h>
+
+#include <sys/types.h>
#include <stdio.h>
+
#include "lib_internal.h"
/****************************************************************************
diff --git a/nuttx/lib/lib_getopt.c b/nuttx/lib/lib_getopt.c
index 9df4efe0f..31ba31f66 100644
--- a/nuttx/lib/lib_getopt.c
+++ b/nuttx/lib/lib_getopt.c
@@ -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 */
diff --git a/nuttx/lib/lib_getoptargp.c b/nuttx/lib/lib_getoptargp.c
index 953dba3ef..75a1434a1 100644
--- a/nuttx/lib/lib_getoptargp.c
+++ b/nuttx/lib/lib_getoptargp.c
@@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+
#include <unistd.h>
/****************************************************************************
diff --git a/nuttx/lib/lib_getoptindp.c b/nuttx/lib/lib_getoptindp.c
index c77742b46..87ddbca41 100644
--- a/nuttx/lib/lib_getoptindp.c
+++ b/nuttx/lib/lib_getoptindp.c
@@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+
#include <unistd.h>
/****************************************************************************
diff --git a/nuttx/lib/lib_getoptoptp.c b/nuttx/lib/lib_getoptoptp.c
index 316d77b04..4a0452f65 100644
--- a/nuttx/lib/lib_getoptoptp.c
+++ b/nuttx/lib/lib_getoptoptp.c
@@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+
#include <unistd.h>
/****************************************************************************
diff --git a/nuttx/lib/lib_gmtime.c b/nuttx/lib/lib_gmtime.c
index 14076b0ee..692159a92 100644
--- a/nuttx/lib/lib_gmtime.c
+++ b/nuttx/lib/lib_gmtime.c
@@ -38,7 +38,6 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
#include <time.h>
#include <errno.h>
diff --git a/nuttx/lib/lib_gmtimer.c b/nuttx/lib/lib_gmtimer.c
index a8555edc6..823aa8bb9 100644
--- a/nuttx/lib/lib_gmtimer.c
+++ b/nuttx/lib/lib_gmtimer.c
@@ -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:
diff --git a/nuttx/lib/lib_htonl.c b/nuttx/lib/lib_htonl.c
index 941919709..94af90f0f 100644
--- a/nuttx/lib/lib_htonl.c
+++ b/nuttx/lib/lib_htonl.c
@@ -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>
@@ -34,21 +34,19 @@
************************************************************/
/************************************************************
- * 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;
diff --git a/nuttx/lib/lib_htons.c b/nuttx/lib/lib_htons.c
index cee422436..cea07b871 100644
--- a/nuttx/lib/lib_htons.c
+++ b/nuttx/lib/lib_htons.c
@@ -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;
diff --git a/nuttx/lib/lib_internal.h b/nuttx/lib/lib_internal.h
index 9e5b55f93..46af49cf4 100644
--- a/nuttx/lib/lib_internal.h
+++ b/nuttx/lib/lib_internal.h
@@ -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 */
diff --git a/nuttx/lib/lib_isbasedigit.c b/nuttx/lib/lib_isbasedigit.c
index c3976ea86..adc8dfd32 100644
--- a/nuttx/lib/lib_isbasedigit.c
+++ b/nuttx/lib/lib_isbasedigit.c
@@ -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;
}
}
diff --git a/nuttx/lib/lib_isleapyear.c b/nuttx/lib/lib_isleapyear.c
index f27f14109..15d379c86 100644
--- a/nuttx/lib/lib_isleapyear.c
+++ b/nuttx/lib/lib_isleapyear.c
@@ -38,11 +38,11 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+
#include <nuttx/time.h>
/****************************************************************************
- * Definitions
+ * Pre-processor Definitions
****************************************************************************/
/****************************************************************************
diff --git a/nuttx/lib/lib_libfflush.c b/nuttx/lib/lib_libfflush.c
index a54a09386..3604d00b9 100644
--- a/nuttx/lib/lib_libfflush.c
+++ b/nuttx/lib/lib_libfflush.c
@@ -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;
diff --git a/nuttx/lib/lib_libflushall.c b/nuttx/lib/lib_libflushall.c
index 16ee4f7a9..49ee41e66 100644
--- a/nuttx/lib/lib_libflushall.c
+++ b/nuttx/lib/lib_libflushall.c
@@ -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
@@ -34,16 +34,12 @@
****************************************************************************/
/****************************************************************************
- * 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.
diff --git a/nuttx/lib/lib_libfread.c b/nuttx/lib/lib_libfread.c
index 0ff12d0dd..52f80fee8 100644
--- a/nuttx/lib/lib_libfread.c
+++ b/nuttx/lib/lib_libfread.c
@@ -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
@@ -34,23 +34,22 @@
****************************************************************************/
/****************************************************************************
- * 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
****************************************************************************/
/****************************************************************************
diff --git a/nuttx/lib/lib_libfwrite.c b/nuttx/lib/lib_libfwrite.c
index 3ea9f6e60..616e8a624 100644
--- a/nuttx/lib/lib_libfwrite.c
+++ b/nuttx/lib/lib_libfwrite.c
@@ -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
@@ -34,15 +34,13 @@
****************************************************************************/
/****************************************************************************
- * 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;
diff --git a/nuttx/lib/lib_libvsprintf.c b/nuttx/lib/lib_libvsprintf.c
index 8e9742ef2..dff001545 100644
--- a/nuttx/lib/lib_libvsprintf.c
+++ b/nuttx/lib/lib_libvsprintf.c
@@ -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>
@@ -34,22 +34,20 @@
****************************************************************************/
/****************************************************************************
- * 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++)
{
diff --git a/nuttx/lib/lib_mktime.c b/nuttx/lib/lib_mktime.c
index 46e16c50f..a9fece631 100644
--- a/nuttx/lib/lib_mktime.c
+++ b/nuttx/lib/lib_mktime.c
@@ -38,7 +38,6 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
#include <time.h>
#include <debug.h>
diff --git a/nuttx/lib/lib_qsort.c b/nuttx/lib/lib_qsort.c
index 2b4083da5..42d895a66 100644
--- a/nuttx/lib/lib_qsort.c
+++ b/nuttx/lib/lib_qsort.c
@@ -45,6 +45,8 @@
****************************************************************************/
#include <nuttx/config.h>
+
+#include <sys/types.h>
#include <stdlib.h>
/****************************************************************************
diff --git a/nuttx/lib/lib_sem.c b/nuttx/lib/lib_sem.c
index 604313d3d..af38f3293 100644
--- a/nuttx/lib/lib_sem.c
+++ b/nuttx/lib/lib_sem.c
@@ -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
************************************************************/
/************************************************************
diff --git a/nuttx/lib/lib_skipspace.c b/nuttx/lib/lib_skipspace.c
index d111645e7..bfd4d14fe 100644
--- a/nuttx/lib/lib_skipspace.c
+++ b/nuttx/lib/lib_skipspace.c
@@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+
#include <string.h>
#include <ctype.h>
#include "lib_internal.h"
diff --git a/nuttx/lib/lib_snprintf.c b/nuttx/lib/lib_snprintf.c
index ecb428999..4c3b01e30 100644
--- a/nuttx/lib/lib_snprintf.c
+++ b/nuttx/lib/lib_snprintf.c
@@ -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
****************************************************************************/
/****************************************************************************
diff --git a/nuttx/lib/lib_strcasecmp.c b/nuttx/lib/lib_strcasecmp.c
index 233cd3fc1..cb4585b5b 100644
--- a/nuttx/lib/lib_strcasecmp.c
+++ b/nuttx/lib/lib_strcasecmp.c
@@ -34,16 +34,11 @@
*****************************************************************************/
/****************************************************************************
- * Compilation Switches
- *****************************************************************************/
-
-/****************************************************************************
* Included Files
*****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
#include <string.h>
#include <ctype.h>
diff --git a/nuttx/lib/lib_strcat.c b/nuttx/lib/lib_strcat.c
index b6eb23a6b..e1104f4d4 100644
--- a/nuttx/lib/lib_strcat.c
+++ b/nuttx/lib/lib_strcat.c
@@ -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>
/****************************************************************************
diff --git a/nuttx/lib/lib_strchr.c b/nuttx/lib/lib_strchr.c
index ff7c6197a..86a44530b 100644
--- a/nuttx/lib/lib_strchr.c
+++ b/nuttx/lib/lib_strchr.c
@@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+
#include <string.h>
/****************************************************************************
diff --git a/nuttx/lib/lib_strcmp.c b/nuttx/lib/lib_strcmp.c
index 1fa24f177..fd384926f 100644
--- a/nuttx/lib/lib_strcmp.c
+++ b/nuttx/lib/lib_strcmp.c
@@ -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
@@ -34,15 +34,11 @@
*****************************************************************************/
/****************************************************************************
- * Compilation Switches
- *****************************************************************************/
-
-/****************************************************************************
* Included Files
*****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+
#include <string.h>
/****************************************************************************
diff --git a/nuttx/lib/lib_strcpy.c b/nuttx/lib/lib_strcpy.c
index d5cc99993..10ef6918f 100644
--- a/nuttx/lib/lib_strcpy.c
+++ b/nuttx/lib/lib_strcpy.c
@@ -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)
diff --git a/nuttx/lib/lib_strdup.c b/nuttx/lib/lib_strdup.c
index 4b3ff8aa5..2bb9dbc9d 100644
--- a/nuttx/lib/lib_strdup.c
+++ b/nuttx/lib/lib_strdup.c
@@ -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)
{
diff --git a/nuttx/lib/lib_streamsem.c b/nuttx/lib/lib_streamsem.c
index 1394a5501..5560778cf 100644
--- a/nuttx/lib/lib_streamsem.c
+++ b/nuttx/lib/lib_streamsem.c
@@ -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)
{
diff --git a/nuttx/lib/lib_strerror.c b/nuttx/lib/lib_strerror.c
index 994af8d5b..4a3c891a1 100644
--- a/nuttx/lib/lib_strerror.c
+++ b/nuttx/lib/lib_strerror.c
@@ -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;
};
diff --git a/nuttx/lib/lib_strpbrk.c b/nuttx/lib/lib_strpbrk.c
index 2c6565d2f..e429bb079 100644
--- a/nuttx/lib/lib_strpbrk.c
+++ b/nuttx/lib/lib_strpbrk.c
@@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+
#include <string.h>
/****************************************************************************
diff --git a/nuttx/lib/lib_strrchr.c b/nuttx/lib/lib_strrchr.c
index 70bc2be6f..fcec61efe 100644
--- a/nuttx/lib/lib_strrchr.c
+++ b/nuttx/lib/lib_strrchr.c
@@ -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.
diff --git a/nuttx/lib/lib_strstr.c b/nuttx/lib/lib_strstr.c
index 0dd43ce1b..6db0da642 100644
--- a/nuttx/lib/lib_strstr.c
+++ b/nuttx/lib/lib_strstr.c
@@ -38,7 +38,7 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+
#include <string.h>
/****************************************************************************
diff --git a/nuttx/lib/lib_strtol.c b/nuttx/lib/lib_strtol.c
index dcd376523..b07bd9973 100644
--- a/nuttx/lib/lib_strtol.c
+++ b/nuttx/lib/lib_strtol.c
@@ -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 == '+')
diff --git a/nuttx/lib/lib_strtoll.c b/nuttx/lib/lib_strtoll.c
index 6566d75c6..8ddc6afe2 100644
--- a/nuttx/lib/lib_strtoll.c
+++ b/nuttx/lib/lib_strtoll.c
@@ -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 == '+')
diff --git a/nuttx/lib/lib_strtoul.c b/nuttx/lib/lib_strtoul.c
index 6479d60c1..ba88139ad 100644
--- a/nuttx/lib/lib_strtoul.c
+++ b/nuttx/lib/lib_strtoul.c
@@ -38,8 +38,9 @@
****************************************************************************/
#include <nuttx/config.h>
-#include <sys/types.h>
+
#include <stdlib.h>
+
#include "lib_internal.h"
/****************************************************************************
diff --git a/nuttx/lib/lib_strtoull.c b/nuttx/lib/lib_strtoull.c
index 2a135b3c8..f84bf7e11 100644
--- a/nuttx/lib/lib_strtoull.c
+++ b/nuttx/lib/lib_strtoull.c
@@ -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
diff --git a/nuttx/lib/lib_vfprintf.c b/nuttx/lib/lib_vfprintf.c
index 38da9c028..5e17526a1 100644
--- a/nuttx/lib/lib_vfprintf.c
+++ b/nuttx/lib/lib_vfprintf.c
@@ -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
****************************************************************************/
/****************************************************************************
diff --git a/nuttx/lib/lib_vsnprintf.c b/nuttx/lib/lib_vsnprintf.c
index ea6580bd4..6391701c8 100644
--- a/nuttx/lib/lib_vsnprintf.c
+++ b/nuttx/lib/lib_vsnprintf.c
@@ -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
****************************************************************************/
/****************************************************************************
diff --git a/nuttx/lib/lib_vsprintf.c b/nuttx/lib/lib_vsprintf.c
index 36cb9ac7f..a22de0d65 100644
--- a/nuttx/lib/lib_vsprintf.c
+++ b/nuttx/lib/lib_vsprintf.c
@@ -34,20 +34,17 @@
****************************************************************************/
/****************************************************************************
- * Compilation Switches
- ****************************************************************************/
-
-/****************************************************************************
* Included Files
****************************************************************************/
-#include <sys/types.h>
+#include <nuttx/config.h>
+
#include <stdio.h>
#include "lib_internal.h"
/****************************************************************************
- * Definitions
+ * Pre-processor Definitions
****************************************************************************/
/****************************************************************************
diff --git a/nuttx/lib/lib_wrflush.c b/nuttx/lib/lib_wrflush.c
index a928d9dcc..0714c4d3c 100644
--- a/nuttx/lib/lib_wrflush.c
+++ b/nuttx/lib/lib_wrflush.c
@@ -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
@@ -34,23 +34,19 @@
****************************************************************************/
/****************************************************************************
- * 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