summaryrefslogtreecommitdiff
path: root/mercurial/base85.c
diff options
context:
space:
mode:
Diffstat (limited to 'mercurial/base85.c')
-rw-r--r--mercurial/base85.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/mercurial/base85.c b/mercurial/base85.c
index 0d45da2..df96629 100644
--- a/mercurial/base85.c
+++ b/mercurial/base85.c
@@ -9,7 +9,6 @@
Largely based on git's implementation
*/
-#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include "util.h"
@@ -34,7 +33,7 @@ b85encode(PyObject *self, PyObject *args)
const unsigned char *text;
PyObject *out;
char *dst;
- Py_ssize_t len, olen, i;
+ int len, olen, i;
unsigned int acc, val, ch;
int pad = 0;
@@ -82,8 +81,7 @@ b85decode(PyObject *self, PyObject *args)
PyObject *out;
const char *text;
char *dst;
- Py_ssize_t len, i, j, olen, cap;
- int c;
+ int len, i, j, olen, c, cap;
unsigned int acc;
if (!PyArg_ParseTuple(args, "s#", &text, &len))
@@ -111,8 +109,7 @@ b85decode(PyObject *self, PyObject *args)
if (c < 0)
return PyErr_Format(
PyExc_ValueError,
- "bad base85 character at position %d",
- (int)i);
+ "Bad base85 character at position %d", i);
acc = acc * 85 + c;
}
if (i++ < len)
@@ -121,15 +118,13 @@ b85decode(PyObject *self, PyObject *args)
if (c < 0)
return PyErr_Format(
PyExc_ValueError,
- "bad base85 character at position %d",
- (int)i);
+ "Bad base85 character at position %d", i);
/* overflow detection: 0xffffffff == "|NsC0",
* "|NsC" == 0x03030303 */
if (acc > 0x03030303 || (acc *= 85) > 0xffffffff - c)
return PyErr_Format(
PyExc_ValueError,
- "bad base85 sequence at position %d",
- (int)i);
+ "Bad base85 sequence at position %d", i);
acc += c;
}