* 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.
This commit is contained in:
parent
27f8495dd5
commit
0c3d8e5ab5
|
@ -1,3 +1,41 @@
|
|||
2013-10-23 Corinna Vinschen <vinschen@redhat.com>
|
||||
|
||||
* 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.
|
||||
|
||||
2013-10-18 Joey Ye <joey.ye@arm.com>
|
||||
|
||||
* configure.in (enable-newlib-global-atexit): New option.
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -51,10 +51,10 @@ _DEFUN(__swrite64, (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;
|
||||
_READ_WRITE_RETURN_TYPE w;
|
||||
#ifdef __SCLE
|
||||
int oldmode=0;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue