On 25 October 2013 15:12, <stefan2_at_apache.org> wrote:
> Author: stefan2
> Date: Fri Oct 25 11:12:27 2013
> New Revision: 1535686
>
> URL: http://svn.apache.org/r1535686
> Log:
> On the log-addressing branch: Automatically upgrade transactions from
> physical to logical addressing mode for recently upgraded repositories.
> Provide a test-case.
>
Hi Stefan,
[...]
> +/* Determine the checksum for the SIZE bytes of data starting at START
> + * in FILE and return the result in *FNV1_CHECKSUM.
> + * Use POOL for tempoary allocations.
> + */
> +static svn_error_t *
> +fnv1a_checksum_on_file_range(apr_uint32_t *fnv1_checksum,
> + apr_file_t *file,
> + apr_off_t start,
> + apr_off_t size,
> + apr_pool_t *pool)
> +{
> + char buffer[4096];
> +
Why you're using non-standard sized buffer for IO operations on stack?
It should be apr_palloc(SVN__STREAM_CHUNK_SIZE). Is not it?
> + svn_checksum_ctx_t *checksum_ctx
> + = svn_checksum_ctx_create(svn_checksum_fnv1a_32x4, pool);
> +
> + SVN_ERR(svn_io_file_seek(file, APR_SET, &start, pool));
> + while (size > 0)
> + {
> + apr_size_t to_read = MIN(size, sizeof(buffer));
> +
> + SVN_ERR(svn_io_file_read_full2(file, buffer, to_read, &to_read,
> + NULL, pool));
> + SVN_ERR(svn_checksum_update(checksum_ctx, buffer, to_read));
> + size -= to_read;
> + }
> + SVN_ERR(fnv1a_checksum_finalize(fnv1_checksum, checksum_ctx, pool));
> +
> + return SVN_NO_ERROR;
> +}
> +
--
Ivan Zhakov
CTO | VisualSVN | http://www.visualsvn.com
Received on 2014-04-19 22:33:25 CEST