[PATCH 1 of 3] diffhelpers: use Py_ssize_t in _fix_newline()
Adrian Buehlmann
adrian at cadifra.com
Sat May 12 13:19:37 CDT 2012
# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1336817238 -7200
# Node ID 0bae01c2a7a675cd18f4abb869eca2b22e7b096a
# Parent 76c744e0c5bbd0900beba49787b7e04ba862939b
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.
diff --git a/mercurial/diffhelpers.c b/mercurial/diffhelpers.c
--- a/mercurial/diffhelpers.c
+++ b/mercurial/diffhelpers.c
@@ -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 */
More information about the Mercurial-devel
mailing list