This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi Federico,
On Nov 1 10:39, Federico Terraneo wrote:
> On 10/31/2013 03:41 PM, Corinna Vinschen wrote:
> > On Oct 31 12:55, Federico Terraneo wrote:
> >>
> >> This can't happen, since there's an
> >>
> >> else if (fp->_p > fp->_bf._base || len < fp->_bf._size)
> >>
> >> that catches this case and fills the file buffer instead.
> >
> > Oh, hmm. I didn't notice the || in the if clause. Doesn't that
> > mean that the last else branch is never used since there's always a
> > buffer at _bf._base? The fact that we use a FILE buffer is now
> > sufficient to use it and never to write directly, AFAICS.
> >
>
> Not exactly. The
>
> if (fp->_p > fp->_bf._base
>
> isn't true if there's a buffer. It's true if there is at least a
> character in the buffer, fp->_p is the 'put pointer'.
> [...]
Apparently I didn't wear my glasses because I misread the if clause.
Somehow I managed to read that as
if (fp->_bf._base || len < fp->_bf._size)
entirely dropping the "fp->_p > ". Sorry about that.
I checked the patch in with a minor change:
> - w = fp->_write (ptr, fp->_cookie, p, MIN (len, BUFSIZ));
> + w = fp->_write (ptr, fp->_cookie, p, MIN (len, INT_MAX));
I made that
w = fp->_write (ptr, fp->_cookie, p,
MIN (len, INT_MAX - INT_MAX % BUFSIZ));
so the chunk is a multiple of BUFSIZ.
Thanks a lot,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
Attachment:
pgpMsfynbF5Mv.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |