[PATCH STABLE] parsers: silence warning of implicit integer conversion issued by clang

Yuya Nishihara yuya at tcha.org
Mon Jul 20 10:35:21 CDT 2015


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1437403136 -32400
#      Mon Jul 20 23:38:56 2015 +0900
# Branch stable
# Node ID 672e19f810dbe71afe3cd3ecfd4b80191e21f2cf
# Parent  6e79dc5971e7d5f2aaa290b1ca4a8308484ee88d
parsers: silence warning of implicit integer conversion issued by clang

"-Wshorten-64-to-32" is enabled by default on Mac OS X. Because "len" should
be represented in 32bit integer, this patch simply cast ssize_t to int.

diff --git a/mercurial/parsers.c b/mercurial/parsers.c
--- a/mercurial/parsers.c
+++ b/mercurial/parsers.c
@@ -1156,7 +1156,8 @@ static PyObject *compute_phases_map_sets
 	if (minrevallphases != -1) {
 		int parents[2];
 		for (i = minrevallphases; i < len; i++) {
-			if (index_get_parents(self, i, parents, len - 1) < 0)
+			if (index_get_parents(self, i, parents,
+					      (int)len - 1) < 0)
 				goto release_phasesetlist;
 			set_phase_from_parents(phases, parents[0], parents[1], i);
 		}
@@ -1256,7 +1257,7 @@ static PyObject *index_headrevs(indexObj
 			continue;
 		}
 
-		if (index_get_parents(self, i, parents, len - 1) < 0)
+		if (index_get_parents(self, i, parents, (int)len - 1) < 0)
 			goto bail;
 		for (j = 0; j < 2; j++) {
 			if (parents[j] >= 0)


More information about the Mercurial-devel mailing list