Committed in r37188 with some minor tweaks (removed initializers on
err/err2, a blank line, and the extra parens around (err)).
Thanks for the patch!
Cheers,
-g
On Fri, Apr 10, 2009 at 18:06, Edmund Wong <ed_at_kdtc.net> wrote:
> Hi again,
>
> Here's another attempt at this patch. Â I took the
> liberty of doing the following:
>
> Â if ((err) || (len != SVN__STREAM_CHUNK_SIZE))
> Â Â Â break;
>
> Is this ok? Â Or is this a no-no. Â So far I haven't
> seen any of the real code (aside for merge.c),
> so I haven't seen evidence that leads to a different
> conclusion that this construct is invalid or
> illegal(in terms of SVN coding conduct).
>
> Thanks
>
> Edmund
>
> Log:
>
> [[[
> Â Â Â Â Â Completed the TODO as stated in svn_io.h for
> Â Â Â svn_stream_copy3().
>
> Â Â Â * subversion/libsvn_subr/stream.c
> Â Â Â Â (svn_stream_copy3): Even on error exit, the two files
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â from and to are closed.
>
> Â Â Â Â Patch by: Edmund Wong <edmund_at_belfordhk.com>
>
> Â Â Â Â Review by: mf
> Â Â Â Â Â Â Â Â Â gstein
> ]]]
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1632483
> Index: subversion/libsvn_subr/stream.c
> ===================================================================
> --- subversion/libsvn_subr/stream.c   (revision 37129)
> +++ subversion/libsvn_subr/stream.c   (working copy)
> @@ -210,6 +210,8 @@
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â apr_pool_t *scratch_pool)
> Â {
> Â char *buf = apr_palloc(scratch_pool, SVN__STREAM_CHUNK_SIZE);
> + Â svn_error_t *err = SVN_NO_ERROR;
> + Â svn_error_t *err2 = SVN_NO_ERROR;
>
> Â /* Read and write chunks until we get a short read, indicating the
> Â Â Â end of the stream. Â (We can't get a short write without an
> @@ -219,17 +221,28 @@
> Â Â Â apr_size_t len = SVN__STREAM_CHUNK_SIZE;
>
> Â Â Â if (cancel_func)
> - Â Â Â Â SVN_ERR(cancel_func(cancel_baton));
> + Â Â Â Â {
> + Â Â Â Â Â err = cancel_func(cancel_baton);
>
> - Â Â Â SVN_ERR(svn_stream_read(from, buf, &len));
> + Â Â Â Â Â if (err)
> + Â Â Â Â Â Â break;
> + Â Â Â Â }
> +
> + Â Â Â err = svn_stream_read(from, buf, &len);
> + Â Â Â if (err)
> + Â Â Â Â break;
> +
> Â Â Â if (len > 0)
> - Â Â Â Â SVN_ERR(svn_stream_write(to, buf, &len));
> - Â Â Â if (len != SVN__STREAM_CHUNK_SIZE)
> - Â Â Â Â break;
> + Â Â Â Â err = svn_stream_write(to, buf, &len);
> +
> + Â Â Â if ((err) || (len != SVN__STREAM_CHUNK_SIZE))
> + Â Â Â Â Â break;
> Â Â }
> +
> + Â err2 = svn_error_compose_create(svn_stream_close(from),
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â svn_stream_close(to));
>
> - Â return svn_error_compose_create(svn_stream_close(from),
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â svn_stream_close(to));
> + Â return svn_error_compose_create(err, err2);
> Â }
>
> Â svn_error_t *
>
>
------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=1673083
Received on 2009-04-12 20:10:16 CEST