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

Re: [PATCH]: Fix off-by-one error in xdelta

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2005-02-19 00:54:33 CET

Daniel Berlin wrote:
> I'll commit this in a few hours, giving someone time to pick nits if
> they want :)

Oh, me, me, please let it be me!

> ------------------------------------------------------------------------
>
> * subversion/libsvn_delta/xdelta.c (init_matches_table): use apr_size_t instead
> of apr_uint32_t to match what svn_txdelta_op does.
> (find_match): Return an svn_boolean_t now.
> (compute_delta): Use apr_size_t here too. Also use
> return value of find_match, instead of size of match, to determine
> whether to copy or not.

Of course you were intending to start the log message with a summary, and give
it some indentation :-)

> Index: subversion/libsvn_delta/xdelta.c
> ===================================================================
> --- subversion/libsvn_delta/xdelta.c (revision 13030)
> +++ subversion/libsvn_delta/xdelta.c (working copy)
[...]
> /* If we didn't find a real match, insert the byte at the target
> position into the pending insert. */
> - if (alen < MATCH_BLOCKSIZE &&
> - (apos + alen < asize))
> + if (match == FALSE)

Please may I beg you not to compare Boolean values with TRUE or FALSE, but just
write "if (match)" or in this case "if (! match)".

> {
> +
> if (pending_insert != NULL)
> svn_stringbuf_appendbytes (pending_insert, b + lo, 1);
> else
> @@ -285,6 +288,12 @@
> }
> else
> {
> + /* The only legal way to end up here is to find a match. If we
> + didn't find a match, we are going to generate a copy instruction
> + when we should have generated an insert, so something about the
> + condition above, or what the match routine did, is wrong. */
> + assert (match == TRUE);

and here

> +
> if (pending_insert)
> {
> svn_txdelta__insert_op (build_baton, svn_txdelta_new,
>

Oh, I see you've just committed it. (That wasn't even one hour, was it? :-)
Did you know you can edit your log message with "svn propedit --revprop -r13058
svn:log"?

Thanks,

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Feb 19 00:57:25 2005

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