parsers.c: avoid implicit conversion loses integer warnings
authorAndré Sintzoff <andre.sintzoff@gmail.com>
Sun, 29 Mar 2015 19:06:23 +0200
changeset 24499 90db70de6f9c
parent 24498 ab3a8ed7cf1d
child 24500 7b0a20cd8c95
parsers.c: avoid implicit conversion loses integer warnings These warnings are raised by Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn) and were introduced in 539b3c7eea44
mercurial/parsers.c
--- a/mercurial/parsers.c	Sun Mar 29 00:20:56 2015 -0400
+++ b/mercurial/parsers.c	Sun Mar 29 19:06:23 2015 +0200
@@ -912,7 +912,7 @@
 }
 
 static Py_ssize_t add_roots_get_min(indexObject *self, PyObject *list,
-                                    int marker, char *phases)
+                                    Py_ssize_t marker, char *phases)
 {
 	PyObject *iter = NULL;
 	PyObject *iter_item = NULL;
@@ -938,7 +938,7 @@
 }
 
 static inline void set_phase_from_parents(char *phases, int parent_1,
-                                          int parent_2, int i)
+                                          int parent_2, Py_ssize_t i)
 {
 	if (parent_1 >= 0 && phases[parent_1] > phases[i])
 		phases[i] = phases[parent_1];
@@ -960,7 +960,7 @@
 	Py_ssize_t minrevallphases = 0;
 	Py_ssize_t minrevphase = 0;
 	Py_ssize_t i = 0;
-	long parent_1, parent_2;
+	int parent_1, parent_2;
 	char *phases = NULL;
 	const char *data;
 
@@ -998,8 +998,8 @@
 				PyErr_SetString(PyExc_TypeError, "revlog parents are invalid");
 				goto release_phases;
 			}
-			parent_1 = PyInt_AS_LONG(p1);
-			parent_2 = PyInt_AS_LONG(p2);
+			parent_1 = (int)PyInt_AS_LONG(p1);
+			parent_2 = (int)PyInt_AS_LONG(p2);
 			set_phase_from_parents(phases, parent_1, parent_2, i+self->raw_length);
 		}
 	}