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

login
register
mail settings
Submitter Yuya Nishihara
Date July 20, 2015, 3:35 p.m.
Message ID <672e19f810dbe71afe3c.1437406521@mimosa>
Download mbox | patch
Permalink /patch/10043/
State Accepted
Headers show

Comments

Yuya Nishihara - July 20, 2015, 3:35 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.
Matt Mackall - July 21, 2015, 6:38 p.m.
On Tue, 2015-07-21 at 00:35 +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@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

Queued for stable, thanks.

Patch

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)