diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2011-10-01 20:49:36 +0000 |
---|---|---|
committer | Lorry <lorry@roadtrain.codethink.co.uk> | 2012-09-27 13:27:51 +0000 |
commit | 921ced43c48c1d170452a7b251b94cc96ec8dd44 (patch) | |
tree | 3c4a89176ea67fe4c7bf7b375488361a823c95fa /mercurial/base85.c | |
parent | 9039c805b0a7e36220101323f82735f08a104b37 (diff) | |
download | mercurial-tarball-master.tar.gz |
Imported from /srv/lorry/lorry-area/mercurial-tarball/mercurial-1.9.3.tar.gz.HEADmercurial-1.9.3master
Diffstat (limited to 'mercurial/base85.c')
-rw-r--r-- | mercurial/base85.c | 15 |
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; } |