diff options
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r-- | newlib/libc/stdio/fflush.c | 10 | ||||
-rw-r--r-- | newlib/libc/stdio/fmemopen.c | 4 | ||||
-rw-r--r-- | newlib/libc/stdio/fopencookie.c | 4 | ||||
-rw-r--r-- | newlib/libc/stdio/funopen.c | 9 | ||||
-rw-r--r-- | newlib/libc/stdio/fvwrite.c | 2 | ||||
-rw-r--r-- | newlib/libc/stdio/local.h | 11 | ||||
-rw-r--r-- | newlib/libc/stdio/open_memstream.c | 2 | ||||
-rw-r--r-- | newlib/libc/stdio/stdio.c | 10 |
8 files changed, 29 insertions, 23 deletions
diff --git a/newlib/libc/stdio/fflush.c b/newlib/libc/stdio/fflush.c index ee24cf7ca..ea48b0126 100644 --- a/newlib/libc/stdio/fflush.c +++ b/newlib/libc/stdio/fflush.c @@ -75,10 +75,12 @@ _DEFUN(__sflush_r, (ptr, fp), register FILE * fp) { register unsigned char *p; - register int n, t; + register _READ_WRITE_BUFSIZE_TYPE n; + register _READ_WRITE_RETURN_TYPE t; + short flags; - t = fp->_flags; - if ((t & __SWR) == 0) + flags = fp->_flags; + if ((flags & __SWR) == 0) { #ifdef _FSEEK_OPTIMIZATION /* For a read stream, an fflush causes the next seek to be @@ -186,7 +188,7 @@ _DEFUN(__sflush_r, (ptr, fp), * write function. */ fp->_p = p; - fp->_w = t & (__SLBF | __SNBF) ? 0 : fp->_bf._size; + fp->_w = flags & (__SLBF | __SNBF) ? 0 : fp->_bf._size; while (n > 0) { diff --git a/newlib/libc/stdio/fmemopen.c b/newlib/libc/stdio/fmemopen.c index acfb23c1b..44b0c6d1d 100644 --- a/newlib/libc/stdio/fmemopen.c +++ b/newlib/libc/stdio/fmemopen.c @@ -87,7 +87,7 @@ _DEFUN(fmemreader, (ptr, cookie, buf, n), struct _reent *ptr _AND void *cookie _AND char *buf _AND - int n) + _READ_WRITE_BUFSIZE_TYPE n) { fmemcookie *c = (fmemcookie *) cookie; /* Can't read beyond current size, but EOF condition is not an error. */ @@ -107,7 +107,7 @@ _DEFUN(fmemwriter, (ptr, cookie, buf, n), struct _reent *ptr _AND void *cookie _AND const char *buf _AND - int n) + _READ_WRITE_BUFSIZE_TYPE n) { fmemcookie *c = (fmemcookie *) cookie; int adjust = 0; /* true if at EOF, but still need to write NUL. */ diff --git a/newlib/libc/stdio/fopencookie.c b/newlib/libc/stdio/fopencookie.c index f08d13289..588fd4879 100644 --- a/newlib/libc/stdio/fopencookie.c +++ b/newlib/libc/stdio/fopencookie.c @@ -101,7 +101,7 @@ _DEFUN(fcreader, (ptr, cookie, buf, n), struct _reent *ptr _AND void *cookie _AND char *buf _AND - int n) + _READ_WRITE_BUFSIZE_TYPE n) { int result; fccookie *c = (fccookie *) cookie; @@ -116,7 +116,7 @@ _DEFUN(fcwriter, (ptr, cookie, buf, n), struct _reent *ptr _AND void *cookie _AND const char *buf _AND - int n) + _READ_WRITE_BUFSIZE_TYPE n) { int result; fccookie *c = (fccookie *) cookie; diff --git a/newlib/libc/stdio/funopen.c b/newlib/libc/stdio/funopen.c index 065ed93d7..e71d23187 100644 --- a/newlib/libc/stdio/funopen.c +++ b/newlib/libc/stdio/funopen.c @@ -85,8 +85,9 @@ Supporting OS subroutines required: <<sbrk>>. #include <sys/lock.h> #include "local.h" -typedef int (*funread)(void *_cookie, char *_buf, int _n); -typedef int (*funwrite)(void *_cookie, const char *_buf, int _n); +typedef int (*funread)(void *_cookie, char *_buf, _READ_WRITE_BUFSIZE_TYPE _n); +typedef int (*funwrite)(void *_cookie, const char *_buf, + _READ_WRITE_BUFSIZE_TYPE _n); #ifdef __LARGE64_FILES typedef _fpos64_t (*funseek)(void *_cookie, _fpos64_t _off, int _whence); #else @@ -107,7 +108,7 @@ _DEFUN(funreader, (ptr, cookie, buf, n), struct _reent *ptr _AND void *cookie _AND char *buf _AND - int n) + _READ_WRITE_BUFSIZE_TYPE n) { int result; funcookie *c = (funcookie *) cookie; @@ -122,7 +123,7 @@ _DEFUN(funwriter, (ptr, cookie, buf, n), struct _reent *ptr _AND void *cookie _AND const char *buf _AND - int n) + _READ_WRITE_BUFSIZE_TYPE n) { int result; funcookie *c = (funcookie *) cookie; diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c index 384c62ce0..36a467845 100644 --- a/newlib/libc/stdio/fvwrite.c +++ b/newlib/libc/stdio/fvwrite.c @@ -52,7 +52,7 @@ _DEFUN(__sfvwrite_r, (ptr, fp, uio), register size_t len; register _CONST char *p = NULL; register struct __siov *iov; - register int w, s; + register _READ_WRITE_RETURN_TYPE w, s; char *nl; int nlknown, nldist; diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h index 54854b49d..0bd47a46a 100644 --- a/newlib/libc/stdio/local.h +++ b/newlib/libc/stdio/local.h @@ -149,11 +149,13 @@ extern int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*)); extern int _EXFUN(__sflush_r,(struct _reent *,FILE *)); extern int _EXFUN(__srefill_r,(struct _reent *,FILE *)); extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(struct _reent *, void *, char *, - int)); + _READ_WRITE_BUFSIZE_TYPE)); extern _READ_WRITE_RETURN_TYPE _EXFUN(__seofread,(struct _reent *, void *, - char *, int)); + char *, + _READ_WRITE_BUFSIZE_TYPE)); extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(struct _reent *, void *, - const char *, int)); + const char *, + _READ_WRITE_BUFSIZE_TYPE)); extern _fpos_t _EXFUN(__sseek,(struct _reent *, void *, _fpos_t, int)); extern int _EXFUN(__sclose,(struct _reent *, void *)); extern int _EXFUN(__stextmode,(int)); @@ -168,7 +170,8 @@ extern int _EXFUN(__submore, (struct _reent *, FILE *)); #ifdef __LARGE64_FILES extern _fpos64_t _EXFUN(__sseek64,(struct _reent *, void *, _fpos64_t, int)); extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite64,(struct _reent *, void *, - const char *, int)); + const char *, + _READ_WRITE_BUFSIZE_TYPE)); #endif /* Called by the main entry point fns to ensure stdio has been initialized. */ diff --git a/newlib/libc/stdio/open_memstream.c b/newlib/libc/stdio/open_memstream.c index 0b58720a1..e33063b7c 100644 --- a/newlib/libc/stdio/open_memstream.c +++ b/newlib/libc/stdio/open_memstream.c @@ -97,7 +97,7 @@ _DEFUN(memwriter, (ptr, cookie, buf, n), struct _reent *ptr _AND void *cookie _AND const char *buf _AND - int n) + _READ_WRITE_BUFSIZE_TYPE n) { memstream *c = (memstream *) cookie; char *cbuf = *c->pbuf; diff --git a/newlib/libc/stdio/stdio.c b/newlib/libc/stdio/stdio.c index 31b787bf8..a6e28f5a9 100644 --- a/newlib/libc/stdio/stdio.c +++ b/newlib/libc/stdio/stdio.c @@ -34,10 +34,10 @@ _DEFUN(__sread, (ptr, cookie, buf, n), struct _reent *ptr _AND void *cookie _AND char *buf _AND - int n) + _READ_WRITE_BUFSIZE_TYPE n) { register FILE *fp = (FILE *) cookie; - register int ret; + register ssize_t ret; #ifdef __SCLE int oldmode = 0; @@ -67,7 +67,7 @@ _DEFUN(__seofread, (ptr, cookie, buf, len), struct _reent *_ptr _AND _PTR cookie _AND char *buf _AND - int len) + _READ_WRITE_BUFSIZE_TYPE len) { return 0; } @@ -77,10 +77,10 @@ _DEFUN(__swrite, (ptr, cookie, buf, n), struct _reent *ptr _AND void *cookie _AND char const *buf _AND - int n) + _READ_WRITE_BUFSIZE_TYPE n) { register FILE *fp = (FILE *) cookie; - int w; + ssize_t w; #ifdef __SCLE int oldmode=0; #endif |