diff --git a/include/nuttx/fs/fs.h b/include/nuttx/fs/fs.h index fed454fc7d2..651f94ebabb 100644 --- a/include/nuttx/fs/fs.h +++ b/include/nuttx/fs/fs.h @@ -527,19 +527,19 @@ struct file_struct cookie_io_functions_t fs_iofunc; /* Callbacks to user / system functions */ FAR void *fs_cookie; /* Pointer to file descriptor / cookie struct */ #ifndef CONFIG_STDIO_DISABLE_BUFFERING - FAR unsigned char *fs_bufstart; /* Pointer to start of buffer */ - FAR unsigned char *fs_bufend; /* Pointer to 1 past end of buffer */ - FAR unsigned char *fs_bufpos; /* Current position in buffer */ - FAR unsigned char *fs_bufread; /* Pointer to 1 past last buffered read char. */ + FAR char *fs_bufstart; /* Pointer to start of buffer */ + FAR char *fs_bufend; /* Pointer to 1 past end of buffer */ + FAR char *fs_bufpos; /* Current position in buffer */ + FAR char *fs_bufread; /* Pointer to 1 past last buffered read char. */ # if CONFIG_STDIO_BUFFER_SIZE > 0 - unsigned char fs_buffer[CONFIG_STDIO_BUFFER_SIZE]; + char fs_buffer[CONFIG_STDIO_BUFFER_SIZE]; # endif #endif uint16_t fs_oflags; /* Open mode flags */ uint8_t fs_flags; /* Stream flags */ #if CONFIG_NUNGET_CHARS > 0 uint8_t fs_nungotten; /* The number of characters buffered for ungetc */ - unsigned char fs_ungotten[CONFIG_NUNGET_CHARS]; + char fs_ungotten[CONFIG_NUNGET_CHARS]; #endif }; diff --git a/libs/libc/stdio/lib_getdelim.c b/libs/libc/stdio/lib_getdelim.c index 4b170280656..46c3acd2c82 100644 --- a/libs/libc/stdio/lib_getdelim.c +++ b/libs/libc/stdio/lib_getdelim.c @@ -121,7 +121,7 @@ ssize_t getdelim(FAR char **lineptr, size_t *n, int delimiter, dest = *lineptr; if (dest == NULL) { - dest = (FAR char *)lib_malloc(bufsize); + dest = lib_malloc(bufsize); if (dest == NULL) { ret = ENOMEM; @@ -156,7 +156,7 @@ ssize_t getdelim(FAR char **lineptr, size_t *n, int delimiter, */ bufsize += BUFSIZE_INCR; - newbuffer = (FAR char *)lib_realloc(*lineptr, bufsize); + newbuffer = lib_realloc(*lineptr, bufsize); if (newbuffer == NULL) { ret = ENOMEM; diff --git a/libs/libc/stdio/lib_libfflush.c b/libs/libc/stdio/lib_libfflush.c index 4502ca31d10..94a8c37a661 100644 --- a/libs/libc/stdio/lib_libfflush.c +++ b/libs/libc/stdio/lib_libfflush.c @@ -102,7 +102,7 @@ ssize_t lib_fflush_unlocked(FAR FILE *stream, bool bforce) /* Try to write that amount */ - src = (FAR const char *)stream->fs_bufstart; + src = stream->fs_bufstart; do { /* Perform the write */ diff --git a/libs/libc/stdio/lib_libfread_unlocked.c b/libs/libc/stdio/lib_libfread_unlocked.c index 2c5e8bcb385..9b56854e3d0 100644 --- a/libs/libc/stdio/lib_libfread_unlocked.c +++ b/libs/libc/stdio/lib_libfread_unlocked.c @@ -229,7 +229,7 @@ ssize_t lib_fread_unlocked(FAR void *ptr, size_t count, FAR FILE *stream) { bytes_read = stream->fs_iofunc.read( stream->fs_cookie, - (FAR char *)stream->fs_bufread, + stream->fs_bufread, buffer_available); } else diff --git a/libs/libc/stdio/lib_libvsprintf.c b/libs/libc/stdio/lib_libvsprintf.c index 2f13334f5c2..5933ba77139 100644 --- a/libs/libc/stdio/lib_libvsprintf.c +++ b/libs/libc/stdio/lib_libvsprintf.c @@ -166,9 +166,9 @@ static int vsprintf_internal(FAR struct lib_outstream_s *stream, union { #if defined (CONFIG_LIBC_LONG_LONG) || (ULONG_MAX > 4294967295UL) - unsigned char __buf[22]; /* Size for -1 in octal, without '\0' */ + char __buf[22]; /* Size for -1 in octal, without '\0' */ #else - unsigned char __buf[11]; /* Size for -1 in octal, without '\0' */ + char __buf[11]; /* Size for -1 in octal, without '\0' */ #endif #ifdef CONFIG_LIBC_FLOATINGPOINT struct dtoa_s __dtoa; @@ -860,7 +860,7 @@ flt_oper: } stream_putc(ndigs, stream); - c = __ultoa_invert(exp, (FAR char *)buf, 10) - (FAR char *)buf; + c = __ultoa_invert(exp, buf, 10) - buf; if (exp >= 0 && exp <= 9) { @@ -904,7 +904,7 @@ flt_oper: #else buf[0] = va_arg(ap, int); #endif - pnt = (FAR char *)buf; + pnt = buf; size = 1; goto str_lpad; @@ -913,7 +913,7 @@ flt_oper: #ifdef CONFIG_LIBC_NUMBERED_ARGS if ((flags & FL_ARGNUMBER) != 0) { - pnt = (FAR char *)arglist[argnumber - 1].value.cp; + pnt = arglist[argnumber - 1].value.cp; } else { @@ -1028,7 +1028,7 @@ str_lpad: #if !defined(CONFIG_LIBC_LONG_LONG) && defined(CONFIG_HAVE_LONG_LONG) DEBUGASSERT(x >= 0 && x <= ULONG_MAX); #endif - c = __ultoa_invert(x, (FAR char *)buf, 10) - (FAR char *)buf; + c = __ultoa_invert(x, buf, 10) - buf; } } else @@ -1204,7 +1204,7 @@ str_lpad: #if !defined(CONFIG_LIBC_LONG_LONG) && defined(CONFIG_HAVE_LONG_LONG) DEBUGASSERT(x <= ULONG_MAX); #endif - c = __ultoa_invert(x, (FAR char *)buf, base) - (FAR char *)buf; + c = __ultoa_invert(x, buf, base) - buf; } flags &= ~FL_NEGATIVE; diff --git a/libs/libc/stdio/lib_setvbuf.c b/libs/libc/stdio/lib_setvbuf.c index a0cbd9c4d60..0277cfdd210 100644 --- a/libs/libc/stdio/lib_setvbuf.c +++ b/libs/libc/stdio/lib_setvbuf.c @@ -77,7 +77,7 @@ int setvbuf(FAR FILE *stream, FAR char *buffer, int mode, size_t size) { #ifndef CONFIG_STDIO_DISABLE_BUFFERING - FAR unsigned char *newbuf = NULL; + FAR char *newbuf = NULL; uint8_t flags; int errcode; @@ -174,7 +174,7 @@ int setvbuf(FAR FILE *stream, FAR char *buffer, int mode, size_t size) if (buffer != NULL) { - newbuf = (FAR unsigned char *)buffer; + newbuf = buffer; /* Indicate that we have an I/O buffer managed by the caller * of setvbuf. @@ -184,7 +184,7 @@ int setvbuf(FAR FILE *stream, FAR char *buffer, int mode, size_t size) } else { - newbuf = (FAR unsigned char *)lib_malloc(size); + newbuf = lib_malloc(size); if (newbuf == NULL) { errcode = ENOMEM; diff --git a/libs/libc/stdio/lib_sprintf.c b/libs/libc/stdio/lib_sprintf.c index 4c7cee096d4..d99840a815d 100644 --- a/libs/libc/stdio/lib_sprintf.c +++ b/libs/libc/stdio/lib_sprintf.c @@ -41,14 +41,12 @@ int sprintf(FAR char *buf, FAR const IPTR char *fmt, ...) /* Initialize a memory stream to write to the buffer */ - lib_memoutstream((FAR struct lib_memoutstream_s *)&memoutstream, buf, - LIB_BUFLEN_UNKNOWN); + lib_memoutstream(&memoutstream, buf, LIB_BUFLEN_UNKNOWN); /* Then let lib_vsprintf do the real work */ va_start(ap, fmt); - n = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.common, - fmt, ap); + n = lib_vsprintf(&memoutstream.common, fmt, ap); va_end(ap); return n; } diff --git a/libs/libc/stdio/lib_vasprintf.c b/libs/libc/stdio/lib_vasprintf.c index bdac04a4871..efaed060aac 100644 --- a/libs/libc/stdio/lib_vasprintf.c +++ b/libs/libc/stdio/lib_vasprintf.c @@ -84,13 +84,13 @@ int vasprintf(FAR char **ptr, FAR const IPTR char *fmt, va_list ap) */ lib_nulloutstream(&nulloutstream); - lib_vsprintf((FAR struct lib_outstream_s *)&nulloutstream, fmt, ap); + lib_vsprintf(&nulloutstream, fmt, ap); /* Then allocate a buffer to hold that number of characters, adding one * for the null terminator. */ - buf = (FAR char *)lib_malloc(nulloutstream.nput + 1); + buf = lib_malloc(nulloutstream.nput + 1); if (!buf) { #ifdef va_copy @@ -104,18 +104,15 @@ int vasprintf(FAR char **ptr, FAR const IPTR char *fmt, va_list ap) * null terminator and will not report this in the number of output bytes. */ - lib_memoutstream((FAR struct lib_memoutstream_s *)&memoutstream, - buf, nulloutstream.nput + 1); + lib_memoutstream(&memoutstream, buf, nulloutstream.nput + 1); /* Then let lib_vsprintf do it's real thing */ #ifdef va_copy - nbytes = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.common, - fmt, ap2); + nbytes = lib_vsprintf(&memoutstream.common, fmt, ap2); va_end(ap2); #else - nbytes = lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.common, - fmt, ap); + nbytes = lib_vsprintf(&memoutstream.common, fmt, ap); #endif /* Return a pointer to the string to the caller. NOTE: the memstream put() diff --git a/libs/libc/stdio/lib_vsprintf.c b/libs/libc/stdio/lib_vsprintf.c index 8bd1e18c113..08378f7f085 100644 --- a/libs/libc/stdio/lib_vsprintf.c +++ b/libs/libc/stdio/lib_vsprintf.c @@ -44,8 +44,6 @@ int vsprintf(FAR char *dest, FAR const IPTR char *src, va_list ap) * libs/libc/stdio/lib_vsprintf do the work. */ - lib_memoutstream((FAR struct lib_memoutstream_s *)&memoutstream, dest, - LIB_BUFLEN_UNKNOWN); - return lib_vsprintf((FAR struct lib_outstream_s *)&memoutstream.common, - src, ap); + lib_memoutstream(&memoutstream, dest, LIB_BUFLEN_UNKNOWN); + return lib_vsprintf(&memoutstream.common, src, ap); } diff --git a/libs/libc/stdio/lib_vsscanf.c b/libs/libc/stdio/lib_vsscanf.c index d6a22307c92..5b53a9e0212 100644 --- a/libs/libc/stdio/lib_vsscanf.c +++ b/libs/libc/stdio/lib_vsscanf.c @@ -45,12 +45,10 @@ int vsscanf(FAR const char *buf, FAR const IPTR char *fmt, va_list ap) /* Initialize a memory stream to freadm from the buffer */ - lib_meminstream((FAR struct lib_meminstream_s *)&meminstream, buf, - LIB_BUFLEN_UNKNOWN); + lib_meminstream(&meminstream, buf, LIB_BUFLEN_UNKNOWN); /* Then let lib_vscanf do the real work */ - n = lib_vscanf((FAR struct lib_instream_s *)&meminstream.common, NULL, - fmt, ap); + n = lib_vscanf(&meminstream.common, NULL, fmt, ap); return n; }