##// END OF EJS Templates
diffhelpers: use Py_ssize_t in _fix_newline()...
Adrian Buehlmann -
r16693:f1aa3010 default
parent child Browse files
Show More
@@ -20,14 +20,14 b' static PyObject *diffhelpers_Error;'
20 /* fixup the last lines of a and b when the patch has no newline at eof */
20 /* fixup the last lines of a and b when the patch has no newline at eof */
21 static void _fix_newline(PyObject *hunk, PyObject *a, PyObject *b)
21 static void _fix_newline(PyObject *hunk, PyObject *a, PyObject *b)
22 {
22 {
23 int hunksz = PyList_Size(hunk);
23 Py_ssize_t hunksz = PyList_Size(hunk);
24 PyObject *s = PyList_GET_ITEM(hunk, hunksz-1);
24 PyObject *s = PyList_GET_ITEM(hunk, hunksz-1);
25 char *l = PyBytes_AsString(s);
25 char *l = PyBytes_AsString(s);
26 int alen = PyList_Size(a);
26 Py_ssize_t alen = PyList_Size(a);
27 int blen = PyList_Size(b);
27 Py_ssize_t blen = PyList_Size(b);
28 char c = l[0];
28 char c = l[0];
29 PyObject *hline;
29 PyObject *hline;
30 int sz = PyBytes_GET_SIZE(s);
30 Py_ssize_t sz = PyBytes_GET_SIZE(s);
31
31
32 if (sz > 1 && l[sz-2] == '\r')
32 if (sz > 1 && l[sz-2] == '\r')
33 /* tolerate CRLF in last line */
33 /* tolerate CRLF in last line */
General Comments 0
You need to be logged in to leave comments. Login now