You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Greg Stein <gs...@lyra.org> on 2002/05/09 21:18:32 UTC

Re: svn commit: rev 1915 - trunk/subversion/include trunk/subversion/libsvn_subr trunk/subversion/libsvn_repos

On Thu, May 09, 2002 at 12:39:10PM -0500, sussman@tigris.org wrote:
>...
> +++ trunk/subversion/libsvn_subr/io.c	Thu May  9 12:39:09 2002
>...
>    while (1)
>      {
>        numbytes = 1;
>        SVN_ERR (svn_stream_read (stream, &c, &numbytes));
> +      if (numbytes != 1)
> +        {
> +          /* a 'short' read means the stream has run out. */
> +          *stringbuf = NULL;
> +          return SVN_NO_ERROR;

This means that a file without a trailing newline will throw out the last
line of data. You're returning NULL rather than the data up to EOF.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: svn commit: rev 1915 - trunk/subversion/include trunk/subversion/libsvn_subr trunk/subversion/libsvn_repos

Posted by Ben Collins-Sussman <su...@collab.net>.
Greg Stein <gs...@lyra.org> writes:

> On Thu, May 09, 2002 at 12:39:10PM -0500, sussman@tigris.org wrote:
> >...
> > +++ trunk/subversion/libsvn_subr/io.c	Thu May  9 12:39:09 2002
> >...
> >    while (1)
> >      {
> >        numbytes = 1;
> >        SVN_ERR (svn_stream_read (stream, &c, &numbytes));
> > +      if (numbytes != 1)
> > +        {
> > +          /* a 'short' read means the stream has run out. */
> > +          *stringbuf = NULL;
> > +          return SVN_NO_ERROR;
> 
> This means that a file without a trailing newline will throw out the last
> line of data. You're returning NULL rather than the data up to EOF.

This is svn_stream_readline.  If the stream doesn't end with a line,
my feeling is that there's no final line to return.  The stream has
effectively "run out of lines".

Our dumpfile stream is line-based anyway (except for the
length-prefixed content blobs).  So this works pretty well.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org