diffhelpers: use Py_ssize_t in _fix_newline()
authorAdrian Buehlmann <adrian@cadifra.com>
Sat, 12 May 2012 12:07:18 +0200
changeset 16693 f1aa3010642f
parent 16692 b9969574540a
child 16694 797b76205408
diffhelpers: use Py_ssize_t in _fix_newline() Eliminates mercurial/diffhelpers.c(23) : warning C4244: 'initializing' : conversion from 'Py_ssize_t' to 'int', possible loss of data mercurial/diffhelpers.c(26) : warning C4244: 'initializing' : conversion from 'Py_ssize_t' to 'int', possible loss of data mercurial/diffhelpers.c(27) : warning C4244: 'initializing' : conversion from 'Py_ssize_t' to 'int', possible loss of data mercurial/diffhelpers.c(30) : warning C4244: 'initializing' : conversion from 'Py_ssize_t' to 'int', possible loss of data when compiling for Windows x64 target using the Microsoft compiler.
mercurial/diffhelpers.c
--- a/mercurial/diffhelpers.c	Sat May 12 11:45:22 2012 +0200
+++ b/mercurial/diffhelpers.c	Sat May 12 12:07:18 2012 +0200
@@ -20,14 +20,14 @@
 /* fixup the last lines of a and b when the patch has no newline at eof */
 static void _fix_newline(PyObject *hunk, PyObject *a, PyObject *b)
 {
-	int hunksz = PyList_Size(hunk);
+	Py_ssize_t hunksz = PyList_Size(hunk);
 	PyObject *s = PyList_GET_ITEM(hunk, hunksz-1);
 	char *l = PyBytes_AsString(s);
-	int alen = PyList_Size(a);
-	int blen = PyList_Size(b);
+	Py_ssize_t alen = PyList_Size(a);
+	Py_ssize_t blen = PyList_Size(b);
 	char c = l[0];
 	PyObject *hline;
-	int sz = PyBytes_GET_SIZE(s);
+	Py_ssize_t sz = PyBytes_GET_SIZE(s);
 
 	if (sz > 1 && l[sz-2] == '\r')
 		/* tolerate CRLF in last line */