[HEADSUP] Change to __sFile structure (was Re: [PATCH] Do not break buffers in fvwrite for unbuffered files)
Corinna Vinschen
vinschen@redhat.com
Mon Oct 21 14:41:00 GMT 2013
On Oct 21 13:35, Corinna wrote:
> On Oct 21 10:36, Federico wrote:
> > - w = fp->_write (ptr, fp->_cookie, p, MIN (len, BUFSIZ));
> > + w = fp->_write (ptr, fp->_cookie, p, len);
> [...]
> 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.
The patchset is missing a patch to fflush.c:
* libc/stdio/fflush.c (__sflush_r): Change type of local variables
n and t to _READ_WRITE_BUFSIZE_TYPE and _READ_WRITE_RETURN_TYPE.
Index: libc/stdio/fflush.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio/fflush.c,v
retrieving revision 1.18
diff -u -p -r1.18 fflush.c
--- libc/stdio/fflush.c 10 Apr 2013 18:47:46 -0000 1.18
+++ libc/stdio/fflush.c 21 Oct 2013 14:41:41 -0000
@@ -75,7 +75,8 @@ _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;
t = fp->_flags;
if ((t & __SWR) == 0)
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/20131021/0ef8208c/attachment.sig>
More information about the Newlib
mailing list