Fix a few wide character build issues
This commit is contained in:
parent
b37c94bc68
commit
890a9eb45d
@ -42,8 +42,10 @@
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <nuttx/compiler.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <wchar.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
@ -202,6 +204,13 @@ double_t strtod(FAR const char *str, FAR char **endptr);
|
||||
|
||||
FAR char *itoa(int val, FAR char *str, int base);
|
||||
|
||||
/* Wide character operations */
|
||||
|
||||
#ifdef CONFIG_LIBC_WCHAR
|
||||
int mbtowc(FAR wchar_t *pwc, FAR const char *s, size_t n);
|
||||
int wctomb(FAR char *s, wchar_t wchar);
|
||||
#endif
|
||||
|
||||
/* Memory Management */
|
||||
|
||||
FAR void *malloc(size_t);
|
||||
|
@ -33,9 +33,6 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_WCHAR_H
|
||||
#define __INCLUDE_WCHAR_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
@ -50,6 +47,14 @@
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* REVISIT: Moving the idempotence to this location resolves a circular
|
||||
* dependency problem with stdlib.h which gets included indirectory and
|
||||
* needs wchar_t.
|
||||
*/
|
||||
|
||||
#ifndef __INCLUDE_WCHAR_H
|
||||
#define __INCLUDE_WCHAR_H
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@ -105,7 +110,6 @@ typedef int wint_t;
|
||||
* state, the results are unspecified.
|
||||
*/
|
||||
|
||||
#if 0 /* Not used */
|
||||
/* Commented out because this is dangerous. This defines a type that would
|
||||
* be internal to some wchar implementation. NuttX does not implement the
|
||||
* wchar functions. Having this definition is a time bomb: If this header
|
||||
@ -127,7 +131,6 @@ struct mbstate_s
|
||||
};
|
||||
|
||||
typedef struct mbstate_s mbstate_t;
|
||||
#endif
|
||||
|
||||
/* FILE
|
||||
* As described in <stdio.h>.
|
||||
@ -218,6 +221,8 @@ size_t wcscspn(const wchar_t *, const wchar_t *);
|
||||
size_t wcsftime(wchar_t *, size_t, const wchar_t *,
|
||||
const struct tm *);
|
||||
size_t wcslen(const wchar_t *);
|
||||
size_t wcslcpy(FAR wchar_t *, FAR const wchar_t *, size_t);
|
||||
size_t wcslcat(FAR wchar_t *, FAR const wchar_t *, size_t);
|
||||
wchar_t *wcsncat(wchar_t *, const wchar_t *, size_t);
|
||||
int wcsncmp(const wchar_t *, const wchar_t *, size_t);
|
||||
wchar_t *wcsncpy(wchar_t *, const wchar_t *, size_t);
|
||||
|
@ -37,7 +37,7 @@ ifeq ($(CONFIG_LIBC_LOCALE),y)
|
||||
|
||||
# Add the locale files to the build
|
||||
|
||||
CSRCS += lib_setlocale.c
|
||||
CSRCS += lib_setlocale.c lib_localeconv.c
|
||||
|
||||
# Add the locale directory to the build
|
||||
|
||||
|
@ -60,7 +60,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
FAR struct lconv *localeconv(void);
|
||||
FAR struct lconv *localeconv(void)
|
||||
{
|
||||
/* NULL indicates the the locale was not changed */
|
||||
|
||||
|
@ -45,6 +45,10 @@ ifeq ($(CONFIG_FS_WRITABLE),y)
|
||||
CSRCS += lib_mktemp.c lib_mkstemp.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_LIBC_WCHAR),y)
|
||||
CSRCS += lib_mbtowc.c lib_wctomb.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_PSEUDOTERM_SUSV1),y)
|
||||
CSRCS += lib_ptsname.c lib_ptsnamer.c
|
||||
endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* libc/wchar/lib_mbtowc.c
|
||||
* libc/stdlib/lib_mbtowc.c
|
||||
*
|
||||
* Copyright (c)1999 Citrus Project,
|
||||
* All rights reserved.
|
@ -1,5 +1,5 @@
|
||||
/****************************************************************************
|
||||
* libc/wchar/lib_wctomb.c
|
||||
* libc/stdlib/lib_wctomb.c
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Chris Torek.
|
||||
@ -35,9 +35,10 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <wchar.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef CONFIG_LIBC_WCHAR
|
@ -38,9 +38,8 @@ ifeq ($(CONFIG_LIBC_WCHAR),y)
|
||||
# Add the internal C files to the build
|
||||
|
||||
CSRCS += lib_wcscmp.c lib_wcslen.c lib_wmemchr.c lib_wmemcmp.c lib_wmemcpy.c
|
||||
CSRCS += lib_wmemmove.c lib_wmemset.c lib_mbtowc.c lib_btowc.c lib_mbrtowc.c
|
||||
CSRCS += lib_wctomb.c lib_wctob.c lib_wcslcpy.c lib_wcsxfrm.c lib_wctype.c
|
||||
CSRCS += lib_wcrtomb.c
|
||||
CSRCS += lib_wmemmove.c lib_wmemset.c lib_btowc.c lib_mbrtowc.c lib_wctob.c
|
||||
CSRCS +=lib_wcslcpy.c lib_wcsxfrm.c lib_wcrtomb.c
|
||||
|
||||
# Add the wchar directory to the build
|
||||
|
||||
|
@ -33,10 +33,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#ifdef CONFIG_LIBC_WCHAR
|
||||
|
||||
@ -54,18 +55,18 @@
|
||||
|
||||
wint_t btowc(int c)
|
||||
{
|
||||
int retval = 0;
|
||||
wchar_t pwc;
|
||||
unsigned char b;
|
||||
char b;
|
||||
int retval = 0;
|
||||
|
||||
if (c == EOF)
|
||||
{
|
||||
return WEOF;
|
||||
}
|
||||
|
||||
b = (unsigned char)c;
|
||||
b = (char)c;
|
||||
|
||||
retval = mbtowc(&pwc, &b, 1);
|
||||
retval = mbtowc(&pwc, (FAR const char *)&b, 1);
|
||||
|
||||
if (retval != 0 && retval != 1)
|
||||
{
|
||||
|
@ -33,11 +33,12 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#ifdef CONFIG_LIBC_WCHAR
|
||||
|
||||
@ -68,11 +69,11 @@ size_t mbrtowc(FAR wchar_t *pwc, FAR const char *s, size_t n, mbstate_t *ps)
|
||||
|
||||
if (retval == -1)
|
||||
{
|
||||
return (size_t) (-1);
|
||||
return (size_t)(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (size_t) retval;
|
||||
return (size_t)retval;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -32,6 +32,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
|
||||
|
@ -35,9 +35,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <nuttx/config.h>
|
||||
#include <wchar.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <wchar.h>
|
||||
#include <limits.h>
|
||||
|
||||
#ifdef CONFIG_LIBC_WCHAR
|
||||
|
Loading…
Reference in New Issue
Block a user