diff options
Diffstat (limited to 'newlib/libc/include')
-rw-r--r-- | newlib/libc/include/stdio.h | 24 | ||||
-rw-r--r-- | newlib/libc/include/sys/config.h | 6 | ||||
-rw-r--r-- | newlib/libc/include/sys/reent.h | 11 |
3 files changed, 29 insertions, 12 deletions
diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index 504e671b0..20064d17e 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -516,24 +516,32 @@ int _EXFUN(__swbuf_r, (struct _reent *, int, FILE *)); #ifndef __STRICT_ANSI__ # ifdef __LARGE64_FILES FILE *_EXFUN(funopen,(const _PTR __cookie, - int (*__readfn)(_PTR __c, char *__buf, int __n), - int (*__writefn)(_PTR __c, const char *__buf, int __n), + int (*__readfn)(_PTR __c, char *__buf, + _READ_WRITE_BUFSIZE_TYPE __n), + int (*__writefn)(_PTR __c, const char *__buf, + _READ_WRITE_BUFSIZE_TYPE __n), _fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence), int (*__closefn)(_PTR __c))); FILE *_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie, - int (*__readfn)(_PTR __c, char *__buf, int __n), - int (*__writefn)(_PTR __c, const char *__buf, int __n), + int (*__readfn)(_PTR __c, char *__buf, + _READ_WRITE_BUFSIZE_TYPE __n), + int (*__writefn)(_PTR __c, const char *__buf, + _READ_WRITE_BUFSIZE_TYPE __n), _fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence), int (*__closefn)(_PTR __c))); # else FILE *_EXFUN(funopen,(const _PTR __cookie, - int (*__readfn)(_PTR __cookie, char *__buf, int __n), - int (*__writefn)(_PTR __cookie, const char *__buf, int __n), + int (*__readfn)(_PTR __cookie, char *__buf, + _READ_WRITE_BUFSIZE_TYPE __n), + int (*__writefn)(_PTR __cookie, const char *__buf + _READ_WRITE_BUFSIZE_TYPE __n), fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence), int (*__closefn)(_PTR __cookie))); FILE *_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie, - int (*__readfn)(_PTR __cookie, char *__buf, int __n), - int (*__writefn)(_PTR __cookie, const char *__buf, int __n), + int (*__readfn)(_PTR __cookie, char *__buf, + _READ_WRITE_BUFSIZE_TYPE __n), + int (*__writefn)(_PTR __cookie, const char *__buf, + _READ_WRITE_BUFSIZE_TYPE __n), fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence), int (*__closefn)(_PTR __cookie))); # endif /* !__LARGE64_FILES */ diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h index c726e14c9..0de3ffb88 100644 --- a/newlib/libc/include/sys/config.h +++ b/newlib/libc/include/sys/config.h @@ -250,6 +250,12 @@ #ifndef _READ_WRITE_RETURN_TYPE #define _READ_WRITE_RETURN_TYPE int #endif +/* Define `count' parameter of read/write routines. In POSIX, the `count' + parameter is "size_t" but legacy newlib code has been using "int" for some + time. If not specified, "int" is defaulted. */ +#ifndef _READ_WRITE_BUFSIZE_TYPE +#define _READ_WRITE_BUFSIZE_TYPE int +#endif #ifndef __WCHAR_MAX__ #if __INT_MAX__ == 32767 || defined (_WIN32) diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index c8ef6302f..ce5b3eda7 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -11,6 +11,7 @@ extern "C" { #define _SYS_REENT_H_ #include <_ansi.h> +#include <stddef.h> #include <sys/_types.h> #define _NULL 0 @@ -192,9 +193,10 @@ struct __sFILE { _PTR _cookie; /* cookie passed to io functions */ _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, _PTR, - char *, int)); + char *, _READ_WRITE_BUFSIZE_TYPE)); _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR, - const char *, int)); + const char *, + _READ_WRITE_BUFSIZE_TYPE)); _fpos_t _EXFNPTR(_seek, (struct _reent *, _PTR, _fpos_t, int)); int _EXFNPTR(_close, (struct _reent *, _PTR)); @@ -247,9 +249,10 @@ struct __sFILE64 { _PTR _cookie; /* cookie passed to io functions */ _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, _PTR, - char *, int)); + char *, _READ_WRITE_BUFSIZE_TYPE)); _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR, - const char *, int)); + const char *, + _READ_WRITE_BUFSIZE_TYPE)); _fpos_t _EXFNPTR(_seek, (struct _reent *, _PTR, _fpos_t, int)); int _EXFNPTR(_close, (struct _reent *, _PTR)); |