[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: Daniel Berlin <dberlin_at_dberlin.org>
Date: 2005-02-19 01:49:13 CET

On Fri, 18 Feb 2005, Julian Foad wrote:

> 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 :-)

I'll edit it

>
>
>> 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)".

GCC tends to require the exact opposite in almost all cases, so it's out
of habit. Especially since svn_boolean_type isn't a real boolean type,
you'd want to know if it accidently took on some non-TRUE/non-FALSE value
(I was raised in the "if you simulate boolean with int or char, make sure
you compare it against true or false" school :P)
However, i'll remember not to do it in the future. It certainly seems odd
to me.

>
>
> Oh, I see you've just committed it. (That wasn't even one hour, was it? :-)
I sent this email roughly 4 hours beforehand. It's possible my mail
didn't make it to my mail server until i reconnected, but it didn't appear
to be sitting in my outbox
  :)

> Did you know you can edit your log message with "svn propedit --revprop
> -r13058 svn:log"?

I'll edit it

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Feb 19 01:50:29 2005

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