[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1068684 - in /subversion/branches/integrate-io-improvements: ./ subversion/include/ subversion/libsvn_diff/ subversion/libsvn_fs_fs/ subversion/libsvn_repos/ subversion/libsvn_subr/

From: Daniel Shahaf <d.s_at_daniel.shahaf.name>
Date: Fri, 11 Feb 2011 18:50:06 +0200

stefan2_at_apache.org wrote on Tue, Feb 08, 2011 at 23:37:32 -0000:
> @@ -3788,33 +3810,21 @@ contents_identical_p(svn_boolean_t *iden

I'll just paste the patched function:

> /* Do a byte-for-byte comparison of FILE1 and FILE2. */
> static svn_error_t *
> contents_identical_p(svn_boolean_t *identical_p,
> const char *file1,
> const char *file2,
> apr_pool_t *pool)
> {
> svn_error_t *err;
> apr_size_t bytes_read1, bytes_read2;
> char *buf1 = apr_palloc(pool, SVN__STREAM_CHUNK_SIZE);
> char *buf2 = apr_palloc(pool, SVN__STREAM_CHUNK_SIZE);
> apr_file_t *file1_h = NULL;
> apr_file_t *file2_h = NULL;
> svn_boolean_t eof1 = FALSE;
> svn_boolean_t eof2 = FALSE;
>
> SVN_ERR(svn_io_file_open(&file1_h, file1, APR_READ, APR_OS_DEFAULT,
> pool));
>
> err = svn_io_file_open(&file2_h, file2, APR_READ, APR_OS_DEFAULT,
> pool);
>
> if (err)
> return svn_error_return(
> svn_error_compose_create(err,
> svn_io_file_close(file1_h, pool)));
>
> *identical_p = TRUE; /* assume TRUE, until disproved below */
> while (!err && !eof1 && !eof2)
> {
> err = svn_io_file_read_full2(file1_h, buf1,
> SVN__STREAM_CHUNK_SIZE, &bytes_read1,
> &eof1, pool);
> if (err)
> break;
>
> err = svn_io_file_read_full2(file2_h, buf2,
> SVN__STREAM_CHUNK_SIZE, &bytes_read2,
> &eof2, pool);
> if (err)
> break;
>
> if ((bytes_read1 != bytes_read2) || memcmp(buf1, buf2, bytes_read1))
> {
> *identical_p = FALSE;
> break;
> }
> }
>

This seems to never set IDENTICAL_P to FALSE in the case that FILE2 is
a prefix of FILE1 and the length of the shorter file is an integer
multiple of the chunk size.

> return svn_error_return(
> svn_error_compose_create(
> err,
> svn_error_compose_create(svn_io_file_close(file1_h, pool),
> svn_io_file_close(file2_h, pool))));
> }
Received on 2011-02-11 17:55:12 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.