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

compose_delta.c compiler warning

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2005-02-13 21:24:39 CET


              /* 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

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

                  /* 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,
                                  build_baton, window, ndx, pool);
                  fix_off += length;
                  tgt_off += length;

Philip Martin
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Feb 13 21:25:45 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.