diff --git a/mercurial/mpatch.c b/mercurial/mpatch.c --- a/mercurial/mpatch.c +++ b/mercurial/mpatch.c @@ -38,7 +38,7 @@ struct flist { struct frag *base, *head, *tail; }; -static struct flist *lalloc(int size) +static struct flist *lalloc(Py_ssize_t size) { struct flist *a = NULL; @@ -68,7 +68,7 @@ static void lfree(struct flist *a) } } -static int lsize(struct flist *a) +static Py_ssize_t lsize(struct flist *a) { return a->tail - a->head; } @@ -197,7 +197,7 @@ static struct flist *combine(struct flis } /* decode a binary patch into a hunk list */ -static struct flist *decode(const char *bin, int len) +static struct flist *decode(const char *bin, Py_ssize_t len) { struct flist *l; struct frag *lt; @@ -236,9 +236,9 @@ static struct flist *decode(const char * } /* calculate the size of resultant text */ -static int calcsize(int len, struct flist *l) +static Py_ssize_t calcsize(Py_ssize_t len, struct flist *l) { - int outlen = 0, last = 0; + Py_ssize_t outlen = 0, last = 0; struct frag *f = l->head; while (f != l->tail) { @@ -258,7 +258,7 @@ static int calcsize(int len, struct flis return outlen; } -static int apply(char *buf, const char *orig, int len, struct flist *l) +static int apply(char *buf, const char *orig, Py_ssize_t len, struct flist *l) { struct frag *f = l->head; int last = 0; @@ -283,10 +283,9 @@ static int apply(char *buf, const char * } /* recursively generate a patch of all bins between start and end */ -static struct flist *fold(PyObject *bins, int start, int end) +static struct flist *fold(PyObject *bins, Py_ssize_t start, Py_ssize_t end) { - int len; - Py_ssize_t blen; + Py_ssize_t len, blen; const char *buffer; if (start + 1 == end) { @@ -312,8 +311,7 @@ patches(PyObject *self, PyObject *args) struct flist *patch; const char *in; char *out; - int len, outlen; - Py_ssize_t inlen; + Py_ssize_t len, outlen, inlen; if (!PyArg_ParseTuple(args, "OO:mpatch", &text, &bins)) return NULL;