parsers: fix 'unsigned expression is always true' warning (issue4142) stable
authorDavid Soria Parra <davidsp@fb.com>
Thu, 23 Jan 2014 19:08:26 +0100
branchstable
changeset 20316 40f08c31844c
parent 20315 4dd91c466a81
child 20317 d6939f29b3b3
parsers: fix 'unsigned expression is always true' warning (issue4142) On Mac OS gcc-llvm throws an -Wtautological-compare warning because flen is defined as an unsigned integer, therefore flen < 0 is always true.
mercurial/parsers.c
--- a/mercurial/parsers.c	Thu Jan 23 14:06:15 2014 -0600
+++ b/mercurial/parsers.c	Thu Jan 23 19:08:26 2014 +0100
@@ -185,7 +185,7 @@
 		flen = getbe32(cur + 13);
 		pos += 17;
 		cur += 17;
-		if (flen > len - pos || flen < 0) {
+		if (flen > len - pos) {
 			PyErr_SetString(PyExc_ValueError, "overflow in dirstate");
 			goto quit;
 		}