You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2015/12/12 12:25:03 UTC
svn commit: r1719655 - in /subversion/trunk/subversion:
include/private/svn_packed_data.h libsvn_subr/packed_data.c
tests/libsvn_subr/packed-data-test.c
Author: stefan2
Date: Sat Dec 12 11:25:03 2015
New Revision: 1719655
URL: http://svn.apache.org/viewvc?rev=1719655&view=rev
Log:
Introduce a previously missing "size" function to the svn_packed API.
We'll need it shortly and this fixes an asymmetry between integer data
and blob data streams.
* subversion/include/private/svn_packed_data.h
(svn_packed__byte_block_count): Declare new internal API.
* subversion/libsvn_subr/packed_data.c
(svn_packed__byte_block_count): Implement.
* subversion/tests/libsvn_subr/packed-data-test.c
(test_byte_stream): Cover the new API as well.
Modified:
subversion/trunk/subversion/include/private/svn_packed_data.h
subversion/trunk/subversion/libsvn_subr/packed_data.c
subversion/trunk/subversion/tests/libsvn_subr/packed-data-test.c
Modified: subversion/trunk/subversion/include/private/svn_packed_data.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_packed_data.h?rev=1719655&r1=1719654&r2=1719655&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_packed_data.h (original)
+++ subversion/trunk/subversion/include/private/svn_packed_data.h Sat Dec 12 11:25:03 2015
@@ -218,6 +218,11 @@ svn_packed__int_count(svn_packed__int_st
apr_size_t
svn_packed__byte_count(svn_packed__byte_stream_t *stream);
+/* Return the number of entries left to read from STREAM.
+ */
+apr_size_t
+svn_packed__byte_block_count(svn_packed__byte_stream_t *stream);
+
/* Return the next number from STREAM as unsigned integer. Returns 0 when
* reading beyond the end of the stream.
*/
Modified: subversion/trunk/subversion/libsvn_subr/packed_data.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/packed_data.c?rev=1719655&r1=1719654&r2=1719655&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/packed_data.c (original)
+++ subversion/trunk/subversion/libsvn_subr/packed_data.c Sat Dec 12 11:25:03 2015
@@ -676,6 +676,12 @@ svn_packed__byte_count(svn_packed__byte_
return stream->packed->len;
}
+apr_size_t
+svn_packed__byte_block_count(svn_packed__byte_stream_t *stream)
+{
+ return svn_packed__int_count(stream->lengths_stream);
+}
+
/* Read one 7b/8b encoded value from *P and return it in *RESULT. Returns
* the first position after the parsed data.
*
Modified: subversion/trunk/subversion/tests/libsvn_subr/packed-data-test.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/libsvn_subr/packed-data-test.c?rev=1719655&r1=1719654&r2=1719655&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/libsvn_subr/packed-data-test.c (original)
+++ subversion/trunk/subversion/tests/libsvn_subr/packed-data-test.c Sat Dec 12 11:25:03 2015
@@ -222,6 +222,7 @@ test_byte_stream(apr_pool_t *pool)
/* the stream shall contain exactly the items we put into it */
SVN_TEST_ASSERT(svn_packed__byte_count(stream) == 20);
+ SVN_TEST_ASSERT(svn_packed__byte_block_count(stream) == COUNT);
for (i = 0; i < COUNT; ++i)
{
svn_string_t string;