Paul Burba wrote:
> On Tue, Sep 23, 2008 at 3:51 PM, <hwright_at_tigris.org> wrote:
>> Author: hwright
>> Date: Tue Sep 23 12:51:13 2008
>> New Revision: 33260
>>
>> Log:
>> Deprectate svn_io_file_checksum(), which used the old-style digests in
>> favor of a svn_io_file_checksum2(), which has both a simpler
>> implementation and works with the newer checksum type.
>>
>> * subversion/include/svn_io.h,
>> subversion/libsvn_subr/io.c
>> (svn_io_file_checksum2): New.
>> (svn_io_file_checksum): Deprecated and reimplement.
>>
>> Modified:
>> trunk/subversion/include/svn_io.h
>> trunk/subversion/libsvn_subr/io.c
>>
>> Modified: trunk/subversion/include/svn_io.h
>> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/include/svn_io.h?pathrev=33260&r1=33259&r2=33260
>> ==============================================================================
>> --- trunk/subversion/include/svn_io.h Tue Sep 23 12:50:47 2008 (r33259)
>> +++ trunk/subversion/include/svn_io.h Tue Sep 23 12:51:13 2008 (r33260)
>> @@ -470,10 +470,25 @@ svn_io_filesizes_different_p(svn_boolean
>> apr_pool_t *pool);
>>
>>
>> +/** Return in @a *checksum the checksum of type @a kind of @a file
>> + * Use @a pool for temporary allocations and to allocate @a *checksum.
>> + *
>> + * @since New in 1.6.
>> + */
>> +svn_error_t *
>> +svn_io_file_checksum2(svn_checksum_t **checksum,
>> + const char *file,
>> + svn_checksum_kind_t kind,
>> + apr_pool_t *pool);
>> +
>> +
>> /** Put the md5 checksum of @a file into @a digest.
>> * @a digest points to @c APR_MD5_DIGESTSIZE bytes of storage.
>> * Use @a pool only for temporary allocations.
>> + *
>> + * @deprecated Provided for backward compatibility with the 1.5 API.
>> */
>> +SVN_DEPRECATED
>> svn_error_t *
>> svn_io_file_checksum(unsigned char digest[],
>> const char *file,
>>
>> Modified: trunk/subversion/libsvn_subr/io.c
>> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_subr/io.c?pathrev=33260&r1=33259&r2=33260
>> ==============================================================================
>> --- trunk/subversion/libsvn_subr/io.c Tue Sep 23 12:50:47 2008 (r33259)
>> +++ trunk/subversion/libsvn_subr/io.c Tue Sep 23 12:51:13 2008 (r33260)
>> @@ -955,40 +955,37 @@ svn_io_filesizes_different_p(svn_boolean
>>
>>
>> svn_error_t *
>> -svn_io_file_checksum(unsigned char digest[],
>> - const char *file,
>> - apr_pool_t *pool)
>> +svn_io_file_checksum2(svn_checksum_t **checksum,
>> + const char *file,
>> + svn_checksum_kind_t kind,
>> + apr_pool_t *pool)
>> {
>> - struct apr_md5_ctx_t context;
>> - apr_file_t *f = NULL;
>> - svn_error_t *err;
>> - char *buf = apr_palloc(pool, SVN__STREAM_CHUNK_SIZE);
>> - apr_size_t len;
>> -
>> - /* ### The apr_md5 functions return apr_status_t, but they only
>> - return success, and really, what could go wrong? So below, we
>> - ignore their return values. */
>> -
>> - apr_md5_init(&context);
>> + svn_stream_t *file_stream;
>> + svn_stream_t *checksum_stream;
>> + apr_file_t* f;
>>
>> SVN_ERR(svn_io_file_open(&f, file, APR_READ, APR_OS_DEFAULT, pool));
>> + file_stream = svn_stream_from_aprfile2(f, TRUE, pool);
>
> Hi Hyrum,
>
> Do you need to call svn_stream_from_aprfile2() here with DISOWN set to
> TRUE? Doing so means the subsequent svn_stream_close() does *not*
> close F right?
Paul,
You are correct, and r33268 corrects this problem. (I'm blaming the typo on
random cosmic ray <-> neuron interactions.)
-Hyrum
Received on 2008-09-24 19:00:29 CEST