Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2013-10-23 14:04:43 +0400
committerCorinna Vinschen <corinna@vinschen.de>2013-10-23 14:04:43 +0400
commit0c3d8e5ab5f177ae080bf7afa2cbdc5ebcc9f401 (patch)
tree4a947f48e5edc605a8b04cc9c9033e010a665448 /newlib/libc/stdio
parent27f8495dd59a4d5827040ab599ef457ee9e21af6 (diff)
* libc/include/stdio.h (funopen): Change prototype of
__readfn and __writefn parameter to match new definition of FILE's _read and _write methods. (_funopen_r): Ditto. (funopen): Ditto. (_funopen_r): Ditto. * libc/include/sys/config.h (_READ_WRITE_BUFSIZE_TYPE) Define as type int if not already defined. Add comment to explain. * libc/include/sys/reent.h: Include stddef.h. (struct __sFILE): Change type of last parameter in declaration of _read and _write methods to _READ_WRITE_BUFSIZE_TYPE. (struct __sFILE64): Ditto. * libc/stdio/local.h (__sread): Declare with last parameter set to _READ_WRITE_BUFSIZE_TYPE. (__seofread): Ditto. (__swrite): Ditto. (__swrite64): Ditto. * libc/stdio/fvwrite.c (__sfvwrite_r): Change type of local variables w and s to _READ_WRITE_RETURN_TYPE. * libc/stdio/fflush.c (__sflush_r): Change type of local variables n and t to _READ_WRITE_BUFSIZE_TYPE and _READ_WRITE_RETURN_TYPE. Add local variables flags to keep _flags value. * libc/stdio/fmemopen.c (fmemreader): Align to above change. (fmemwriter): Ditto. * libc/stdio/fopencookie.c (fcreader): Ditto. (fcwriter): Ditto. * libc/stdio/funopen.c (funread): Ditto. (funwrite): Ditto. (funreader): Ditto. (funwriter): Ditto. * libc/stdio/open_memstream.c (memwriter): Ditto. * libc/stdio/stdio.c (__sread): Ditto. (__seofread): Ditto. (__swrite): Ditto. * libc/stdio64/stdio64.c (__swrite64): Ditto.
Diffstat (limited to 'newlib/libc/stdio')
-rw-r--r--newlib/libc/stdio/fflush.c10
-rw-r--r--newlib/libc/stdio/fmemopen.c4
-rw-r--r--newlib/libc/stdio/fopencookie.c4
-rw-r--r--newlib/libc/stdio/funopen.c9
-rw-r--r--newlib/libc/stdio/fvwrite.c2
-rw-r--r--newlib/libc/stdio/local.h11
-rw-r--r--newlib/libc/stdio/open_memstream.c2
-rw-r--r--newlib/libc/stdio/stdio.c10
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