Rev 5363: Fix some signed integer warnings in diff-delta.c in http://bazaar.launchpad.net/~jameinel/bzr/2.3-sizeof

John Arbash Meinel john at arbash-meinel.com
Wed Jul 28 22:53:07 BST 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.3-sizeof

------------------------------------------------------------
revno: 5363
revision-id: john at arbash-meinel.com-20100728215251-ylmowc0jmddlbmuc
parent: john at arbash-meinel.com-20100728213644-3k50bbdkq4r1fb9j
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.3-sizeof
timestamp: Wed 2010-07-28 16:52:51 -0500
message:
  Fix some signed integer warnings in diff-delta.c
  
  We know that the first item comes after the second, so 'x - y' is known
  to be positive. So we can just cast it, to avoid the compiler warning.
-------------- next part --------------
=== modified file 'bzrlib/diff-delta.c'
--- a/bzrlib/diff-delta.c	2009-12-14 15:54:42 +0000
+++ b/bzrlib/diff-delta.c	2010-07-28 21:52:51 +0000
@@ -853,7 +853,8 @@
     free(index);
 }
 
-unsigned long sizeof_delta_index(struct delta_index *index)
+unsigned long
+sizeof_delta_index(struct delta_index *index)
 {
     if (index)
         return index->memsize;
@@ -956,14 +957,14 @@
                  * match more bytes with this location that we have already
                  * matched.
                  */
-                if (ref_size > top - src)
+                if (ref_size > (unsigned int)(top - src))
                     ref_size = top - src;
                 if (ref_size <= msize)
                     break;
                 /* See how many bytes actually match at this location. */
                 while (ref_size-- && *src++ == *ref)
                     ref++;
-                if (msize < ref - entry->ptr) {
+                if (msize < (unsigned int)(ref - entry->ptr)) {
                     /* this is our best match so far */
                     msize = ref - entry->ptr;
                     msource = entry->src;



More information about the bazaar-commits mailing list