subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Shahaf <...@daniel.shahaf.name>
Subject 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/
Date Fri, 11 Feb 2011 16:50:06 GMT
stefan2@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))));
> }

Mime
View raw message