base85: use Py_ssize_t for string lengths
authorAdrian Buehlmann <adrian@cadifra.com>
Thu, 24 May 2012 01:30:12 +0200
changeset 16837 1b9d54c00d50
parent 16836 1ba3e17186c8
child 16838 d37d221334be
base85: use Py_ssize_t for string lengths
mercurial/base85.c
--- a/mercurial/base85.c	Tue May 22 15:17:37 2012 -0700
+++ b/mercurial/base85.c	Thu May 24 01:30:12 2012 +0200
@@ -9,6 +9,7 @@
  Largely based on git's implementation
 */
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include "util.h"
@@ -33,7 +34,7 @@
 	const unsigned char *text;
 	PyObject *out;
 	char *dst;
-	int len, olen, i;
+	Py_ssize_t len, olen, i;
 	unsigned int acc, val, ch;
 	int pad = 0;
 
@@ -81,7 +82,8 @@
 	PyObject *out;
 	const char *text;
 	char *dst;
-	int len, i, j, olen, c, cap;
+	Py_ssize_t len, i, j, olen, cap;
+	int c;
 	unsigned int acc;
 
 	if (!PyArg_ParseTuple(args, "s#", &text, &len))