Author: danielsh Date: Wed Jul 27 22:40:33 2011 New Revision: 1151658 URL: http://svn.apache.org/viewvc?rev=1151658&view=rev Log: On the revprop-packing branch:
Rename svn_stream_copy4() to svn_stream_bounded_copy(). * BRANCH-README: Remove this task. * subversion/libsvn_subr/stream.c (svn_stream_bounded_copy): Rename from svn_stream_copy4(). (svn_stream_copy3): Update caller. * subversion/include/svn_io.h (svn_stream_bounded_copy): Rename from svn_stream_copy4(). (svn_stream_copy3): Remove 'deprecated' designation. * subversion/libsvn_fs_fs/fs_fs.c (set_revision_proplist): Update callers. * subversion/tests/libsvn_subr/stream-test.c (test_stream_copy): Update callers. Modified: subversion/branches/revprop-packing/BRANCH-README subversion/branches/revprop-packing/subversion/include/svn_io.h subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs_fs.c subversion/branches/revprop-packing/subversion/libsvn_subr/stream.c subversion/branches/revprop-packing/subversion/tests/libsvn_subr/stream-test.c Modified: subversion/branches/revprop-packing/BRANCH-README URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/BRANCH-README?rev=1151658&r1=1151657&r2=1151658&view=diff ============================================================================== --- subversion/branches/revprop-packing/BRANCH-README (original) +++ subversion/branches/revprop-packing/BRANCH-README Wed Jul 27 22:40:33 2011 @@ -29,8 +29,6 @@ TODO: * drop heuristic in recover_body() uhohs=True -* svn_stream_copy4() should not be a revv of svn_stream_copy3() - Suggested: Modified: subversion/branches/revprop-packing/subversion/include/svn_io.h URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/include/svn_io.h?rev=1151658&r1=1151657&r2=1151658&view=diff ============================================================================== --- subversion/branches/revprop-packing/subversion/include/svn_io.h (original) +++ subversion/branches/revprop-packing/subversion/include/svn_io.h Wed Jul 27 22:40:33 2011 @@ -1180,13 +1180,27 @@ svn_stream_readline(svn_stream_t *stream apr_pool_t *pool); /** + * Like svn_stream_copy3(), but copy up to @a len bytes. @a len must be + * non-negative. + * + * @since New in 1.8. + */ +/* NOTE: Internally, we accept a -1 argument to mean "Copy the entire stream, + like svn_stream_copy3(). Presently this is not part of the public promise. + */ +svn_error_t * +svn_stream_bounded_copy(svn_stream_t *from, + svn_stream_t *to, + apr_ssize_t len, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *pool); + +/** * Read the contents of the readable stream @a from and write them to the * writable stream @a to calling @a cancel_func before copying each chunk. * - * If @a len is -1, then the entire source stream will be copied, otherwise, - * up to @a len bytes will be copied from @a from to @a to. - * - * @todo ### Should this API return the number of bytes actually copied, + * @todo ### Should this API, or svn_stream_ return the number of bytes actually copied, * a la svn_stream_read()? * * @a cancel_func may be @c NULL. @@ -1197,23 +1211,10 @@ svn_stream_readline(svn_stream_t *stream * svn_stream_disown() to protect either or both of the streams from * being closed. * - * @since New in 1.8. - */ -svn_error_t * -svn_stream_copy4(svn_stream_t *from, - svn_stream_t *to, - apr_ssize_t len, - svn_cancel_func_t cancel_func, - void *cancel_baton, - apr_pool_t *pool); - -/** Same as svn_stream_copy4(), but copies the source to the destination in - * its entirety. - * * @since New in 1.6. - * @deprecated Provided for backward compatibility with the 1.7 API. + * + * @see svn_stream_bounded_copy() */ -SVN_DEPRECATED svn_error_t * svn_stream_copy3(svn_stream_t *from, svn_stream_t *to, Modified: subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs_fs.c URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs_fs.c?rev=1151658&r1=1151657&r2=1151658&view=diff ============================================================================== --- subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs_fs.c (original) +++ subversion/branches/revprop-packing/subversion/libsvn_fs_fs/fs_fs.c Wed Jul 27 22:40:33 2011 @@ -3138,10 +3138,11 @@ set_revision_proplist(svn_fs_t *fs, pool, pool)); /* Copy manifest info up to the new prop's offset value. */ - SVN_ERR(svn_stream_copy4(svn_stream_disown(source_stream, pool), - svn_stream_disown(target_stream, pool), - shard_pos * (REVPROP_MANIFEST_FIELD_WIDTH + 1), - NULL, NULL, pool)); + SVN_ERR(svn_stream_bounded_copy(svn_stream_disown(source_stream, pool), + svn_stream_disown(target_stream, pool), + shard_pos * + (REVPROP_MANIFEST_FIELD_WIDTH + 1), + NULL, NULL, pool)); /* Read the old offset value from the existing pack file, and compute the difference. @@ -3184,9 +3185,9 @@ set_revision_proplist(svn_fs_t *fs, /* Now we copy the existing data over, in much the same way we copied over the offset values. */ - SVN_ERR(svn_stream_copy4(svn_stream_disown(source_stream, pool), - svn_stream_disown(target_stream, pool), - old_offset, NULL, NULL, pool)); + SVN_ERR(svn_stream_bounded_copy(svn_stream_disown(source_stream, pool), + svn_stream_disown(target_stream, pool), + old_offset, NULL, NULL, pool)); /* Write the new data. */ len = sb->len; @@ -3195,7 +3196,7 @@ set_revision_proplist(svn_fs_t *fs, SVN_ERR(svn_stream_skip(source_stream, len)); /* Copy the remaining existing data. */ - SVN_ERR(svn_stream_copy4(source_stream, target_stream, -1, + SVN_ERR(svn_stream_copy3(source_stream, target_stream, NULL, NULL, pool)); /* Move it all into place. */ Modified: subversion/branches/revprop-packing/subversion/libsvn_subr/stream.c URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_subr/stream.c?rev=1151658&r1=1151657&r2=1151658&view=diff ============================================================================== --- subversion/branches/revprop-packing/subversion/libsvn_subr/stream.c (original) +++ subversion/branches/revprop-packing/subversion/libsvn_subr/stream.c Wed Jul 27 22:40:33 2011 @@ -467,12 +467,12 @@ svn_stream_readline(svn_stream_t *stream } svn_error_t * -svn_stream_copy4(svn_stream_t *from, - svn_stream_t *to, - apr_ssize_t len_in, - svn_cancel_func_t cancel_func, - void *cancel_baton, - apr_pool_t *scratch_pool) +svn_stream_bounded_copy(svn_stream_t *from, + svn_stream_t *to, + apr_ssize_t len_in, + svn_cancel_func_t cancel_func, + void *cancel_baton, + apr_pool_t *scratch_pool) { char *buf = apr_palloc(scratch_pool, SVN__STREAM_CHUNK_SIZE); svn_error_t *err; @@ -523,9 +523,9 @@ svn_stream_copy3(svn_stream_t *from, void *cancel_baton, apr_pool_t *scratch_pool) { - return svn_error_trace(svn_stream_copy4(from, to, -1, - cancel_func, cancel_baton, - scratch_pool)); + return svn_error_trace(svn_stream_bounded_copy(from, to, -1, + cancel_func, cancel_baton, + scratch_pool)); } svn_error_t * Modified: subversion/branches/revprop-packing/subversion/tests/libsvn_subr/stream-test.c URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/tests/libsvn_subr/stream-test.c?rev=1151658&r1=1151657&r2=1151658&view=diff ============================================================================== --- subversion/branches/revprop-packing/subversion/tests/libsvn_subr/stream-test.c (original) +++ subversion/branches/revprop-packing/subversion/tests/libsvn_subr/stream-test.c Wed Jul 27 22:40:33 2011 @@ -594,7 +594,7 @@ test_stream_copy(apr_pool_t *pool) dst = svn_stream_from_stringbuf(actual, pool); /* Copy all of the original stream. */ - SVN_ERR(svn_stream_copy4(src, dst, -1, NULL, NULL, pool)); + SVN_ERR(svn_stream_bounded_copy(src, dst, -1, NULL, NULL, pool)); SVN_TEST_STRING_ASSERT(actual->data, expected->data); @@ -604,7 +604,7 @@ test_stream_copy(apr_pool_t *pool) src = svn_stream_from_stringbuf(orig, pool); dst = svn_stream_from_stringbuf(actual, pool); - SVN_ERR(svn_stream_copy4(src, dst, TEST_BUF_SIZE, NULL, NULL, pool)); + SVN_ERR(svn_stream_bounded_copy(src, dst, TEST_BUF_SIZE, NULL, NULL, pool)); SVN_TEST_STRING_ASSERT(actual->data, expected->data);