changeset 39074:acd23830bcd6

cext: fix most truncation warnings in revlog on Windows There's one more, and I'm not sure why it isn't being tripped on other platforms: mercurial/cext/revlog.c(430) : warning C4244: '=' : conversion from 'Py_ssize_t' to 'char', possible loss of data
author Matt Harbison <matt_harbison@yahoo.com>
date Fri, 10 Aug 2018 00:14:47 -0400
parents beab6690f202
children b935adb4b041
files mercurial/cext/revlog.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/cext/revlog.c	Thu Aug 09 23:52:45 2018 -0400
+++ b/mercurial/cext/revlog.c	Fri Aug 10 00:14:47 2018 -0400
@@ -303,7 +303,7 @@
 		return NULL;
 
 	if (self->nt)
-		nt_insert(self->nt, node, len);
+		nt_insert(self->nt, node, (int)len);
 
 	Py_CLEAR(self->headrevs);
 	Py_RETURN_NONE;
@@ -578,7 +578,7 @@
 			      revstates[parents[1] + 1]) & RS_REACHABLE)
 			    && !(revstates[i + 1] & RS_REACHABLE)) {
 				revstates[i + 1] |= RS_REACHABLE;
-				val = PyInt_FromLong(i);
+				val = PyInt_FromSsize_t(i);
 				if (val == NULL)
 					goto bail;
 				r = PyList_Append(reachable, val);
@@ -665,7 +665,7 @@
 		}
 	}
 	/* Transform phase list to a python list */
-	phasessize = PyInt_FromLong(len);
+	phasessize = PyInt_FromSsize_t(len);
 	if (phasessize == NULL)
 		goto release;
 	for (i = 0; i < len; i++) {
@@ -674,7 +674,7 @@
 		 * is computed as a difference */
 		if (phase != 0) {
 			phaseset = PyList_GET_ITEM(phasessetlist, phase);
-			rev = PyInt_FromLong(i);
+			rev = PyInt_FromSsize_t(i);
 			if (rev == NULL)
 				goto release;
 			PySet_Add(phaseset, rev);