Patchwork D2766: xdiff: resolve signed unsigned comparison warning

login
register
mail settings
Submitter phabricator
Date March 9, 2018, 11:25 p.m.
Message ID <97558334c6a7ceaa299176371b7eaf46@localhost.localdomain>
Download mbox | patch
Permalink /patch/29221/
State Not Applicable
Headers show

Comments

phabricator - March 9, 2018, 11:25 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG9ddc9aa26801: xdiff: resolve signed unsigned comparison warning (authored by quark, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2766?vs=6803&id=6810

REVISION DETAIL
  https://phab.mercurial-scm.org/D2766

AFFECTED FILES
  mercurial/thirdparty/xdiff/xdiffi.c

CHANGE DETAILS




To: quark, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/mercurial/thirdparty/xdiff/xdiffi.c b/mercurial/thirdparty/xdiff/xdiffi.c
--- a/mercurial/thirdparty/xdiff/xdiffi.c
+++ b/mercurial/thirdparty/xdiff/xdiffi.c
@@ -1015,16 +1015,14 @@ 
 xdchange_t *xdl_get_hunk(xdchange_t **xscr)
 {
 	xdchange_t *xch, *xchp, *lxch;
-	int64_t max_common = 0;
-	int64_t max_ignorable = 0;
 	uint64_t ignored = 0; /* number of ignored blank lines */
 
 	/* remove ignorable changes that are too far before other changes */
 	for (xchp = *xscr; xchp && xchp->ignore; xchp = xchp->next) {
 		xch = xchp->next;
 
 		if (xch == NULL ||
-		    xch->i1 - (xchp->i1 + xchp->chg1) >= max_ignorable)
+		    xch->i1 - (xchp->i1 + xchp->chg1) >= 0)
 			*xscr = xch;
 	}
 
@@ -1035,16 +1033,16 @@ 
 
 	for (xchp = *xscr, xch = xchp->next; xch; xchp = xch, xch = xch->next) {
 		int64_t distance = xch->i1 - (xchp->i1 + xchp->chg1);
-		if (distance > max_common)
+		if (distance > 0)
 			break;
 
-		if (distance < max_ignorable && (!xch->ignore || lxch == xchp)) {
+		if (distance < 0 && (!xch->ignore || lxch == xchp)) {
 			lxch = xch;
 			ignored = 0;
-		} else if (distance < max_ignorable && xch->ignore) {
+		} else if (distance < 0 && xch->ignore) {
 			ignored += xch->chg2;
 		} else if (lxch != xchp &&
-			   xch->i1 + ignored - (lxch->i1 + lxch->chg1) > max_common) {
+			   xch->i1 + ignored - (lxch->i1 + lxch->chg1) > 0) {
 			break;
 		} else if (!xch->ignore) {
 			lxch = xch;