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

Re: compose_delta.c compiler warning

From: Branko Čibej <brane_at_xbc.nu>
Date: 2005-02-13 22:04:30 CET

Philip Martin wrote:

>compose_delta.c:copy_source_ops:
>
> /* This is an overlapping target copy.
> The idea here is to transpose the pattern, then generate
> another overlapping copy. */
> const apr_size_t ptn_length = off[0] - op->offset;
> const apr_size_t ptn_overlap = fix_offset % ptn_length;
> apr_size_t fix_off = fix_offset;
> apr_size_t tgt_off = target_offset;
> assert(ptn_length > ptn_overlap);
>
> if (ptn_overlap >= 0)
>
>The line above causes the warning:
>
>../svn/subversion/libsvn_delta/compose_delta.c:676: warning: comparison of unsigned expression >= 0 is always true
>
>
Hm, how long has this warning been around? I'm not aware of any changes
here lately.

>I'm not sure what was intended, possibly it's to catch % returning a
>negative value, but fix_offset, ptn_length are unsigned so that should
>not happen, and since ptn_overlap is unsigned the test won't catch it
>anyway.
>
> {
> /* Issue second subrange in the pattern. */
> const apr_size_t length =
> MIN(op->length - fix_off - fix_limit,
> ptn_length - ptn_overlap);
> copy_source_ops(op->offset + ptn_overlap,
> op->offset + ptn_overlap + length,
> tgt_off,
> build_baton, window, ndx, pool);
> fix_off += length;
> tgt_off += length;
> }
>
>
It's not impossible that the test should be >0, not >=0; but my brain
isn't working very well right now, so I won't venture to guess...

-- Brane

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Feb 13 22:05:57 2005

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.