[HEADSUP] Change to __sFile structure (was Re: [PATCH] Do not break buffers in fvwrite for unbuffered files)
Corinna Vinschen
vinschen@redhat.com
Wed Oct 23 10:05:00 GMT 2013
On Oct 21 13:35, Corinna wrote:
> Here's my Proposal:
>
> We introduce a new define called _READ_WRITE_BUFSIZE_TYPE. It is used
> as the type of the `count' parameter for the _read and _write methods in
> struct __sFILE. It's set to int by default for backward compatibility.
> Interested targets can set it to the more correct size_t in
> include/sys/config.h.
>
> Here's a patch. Please check if that's ok for your targets. In theory,
> it shouldnt change anything for existing targets, unless you define your
> own _READ_WRITE_BUFSIZE_TYPE. I'm going to do so for Cygwin, if the
> patch is ok.
>
>
> Thanks,
> Corinna
>
>
> * 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_BUFSIZE_TYPE.
> * 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.
I applied the patch.
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20131023/87399575/attachment.sig>
More information about the Newlib
mailing list