Commit f98db65e authored by Thomas Wouters's avatar Thomas Wouters

Make Py_ssize_t-clean.

parent 0b300be8
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
** Brandon Long, September 2001. ** Brandon Long, September 2001.
*/ */
#include PY_SSIZE_T_CLEAN
#include "Python.h" #include "Python.h"
...@@ -189,7 +190,7 @@ binascii_a2b_uu(PyObject *self, PyObject *args) ...@@ -189,7 +190,7 @@ binascii_a2b_uu(PyObject *self, PyObject *args)
unsigned char this_ch; unsigned char this_ch;
unsigned int leftchar = 0; unsigned int leftchar = 0;
PyObject *rv; PyObject *rv;
int ascii_len, bin_len; Py_ssize_t ascii_len, bin_len;
if ( !PyArg_ParseTuple(args, "t#:a2b_uu", &ascii_data, &ascii_len) ) if ( !PyArg_ParseTuple(args, "t#:a2b_uu", &ascii_data, &ascii_len) )
return NULL; return NULL;
...@@ -265,7 +266,7 @@ binascii_b2a_uu(PyObject *self, PyObject *args) ...@@ -265,7 +266,7 @@ binascii_b2a_uu(PyObject *self, PyObject *args)
unsigned char this_ch; unsigned char this_ch;
unsigned int leftchar = 0; unsigned int leftchar = 0;
PyObject *rv; PyObject *rv;
int bin_len; Py_ssize_t bin_len;
if ( !PyArg_ParseTuple(args, "s#:b2a_uu", &bin_data, &bin_len) ) if ( !PyArg_ParseTuple(args, "s#:b2a_uu", &bin_data, &bin_len) )
return NULL; return NULL;
...@@ -307,7 +308,7 @@ binascii_b2a_uu(PyObject *self, PyObject *args) ...@@ -307,7 +308,7 @@ binascii_b2a_uu(PyObject *self, PyObject *args)
static int static int
binascii_find_valid(unsigned char *s, int slen, int num) binascii_find_valid(unsigned char *s, Py_ssize_t slen, int num)
{ {
/* Finds & returns the (num+1)th /* Finds & returns the (num+1)th
** valid character for base64, or -1 if none. ** valid character for base64, or -1 if none.
...@@ -341,7 +342,7 @@ binascii_a2b_base64(PyObject *self, PyObject *args) ...@@ -341,7 +342,7 @@ binascii_a2b_base64(PyObject *self, PyObject *args)
unsigned char this_ch; unsigned char this_ch;
unsigned int leftchar = 0; unsigned int leftchar = 0;
PyObject *rv; PyObject *rv;
int ascii_len, bin_len; Py_ssize_t ascii_len, bin_len;
int quad_pos = 0; int quad_pos = 0;
if ( !PyArg_ParseTuple(args, "t#:a2b_base64", &ascii_data, &ascii_len) ) if ( !PyArg_ParseTuple(args, "t#:a2b_base64", &ascii_data, &ascii_len) )
...@@ -432,7 +433,7 @@ binascii_b2a_base64(PyObject *self, PyObject *args) ...@@ -432,7 +433,7 @@ binascii_b2a_base64(PyObject *self, PyObject *args)
unsigned char this_ch; unsigned char this_ch;
unsigned int leftchar = 0; unsigned int leftchar = 0;
PyObject *rv; PyObject *rv;
int bin_len; Py_ssize_t bin_len;
if ( !PyArg_ParseTuple(args, "s#:b2a_base64", &bin_data, &bin_len) ) if ( !PyArg_ParseTuple(args, "s#:b2a_base64", &bin_data, &bin_len) )
return NULL; return NULL;
...@@ -485,7 +486,7 @@ binascii_a2b_hqx(PyObject *self, PyObject *args) ...@@ -485,7 +486,7 @@ binascii_a2b_hqx(PyObject *self, PyObject *args)
unsigned char this_ch; unsigned char this_ch;
unsigned int leftchar = 0; unsigned int leftchar = 0;
PyObject *rv; PyObject *rv;
int len; Py_ssize_t len;
int done = 0; int done = 0;
if ( !PyArg_ParseTuple(args, "t#:a2b_hqx", &ascii_data, &len) ) if ( !PyArg_ParseTuple(args, "t#:a2b_hqx", &ascii_data, &len) )
...@@ -549,7 +550,7 @@ binascii_rlecode_hqx(PyObject *self, PyObject *args) ...@@ -549,7 +550,7 @@ binascii_rlecode_hqx(PyObject *self, PyObject *args)
unsigned char *in_data, *out_data; unsigned char *in_data, *out_data;
PyObject *rv; PyObject *rv;
unsigned char ch; unsigned char ch;
int in, inend, len; Py_ssize_t in, inend, len;
if ( !PyArg_ParseTuple(args, "s#:rlecode_hqx", &in_data, &len) ) if ( !PyArg_ParseTuple(args, "s#:rlecode_hqx", &in_data, &len) )
return NULL; return NULL;
...@@ -598,7 +599,7 @@ binascii_b2a_hqx(PyObject *self, PyObject *args) ...@@ -598,7 +599,7 @@ binascii_b2a_hqx(PyObject *self, PyObject *args)
unsigned char this_ch; unsigned char this_ch;
unsigned int leftchar = 0; unsigned int leftchar = 0;
PyObject *rv; PyObject *rv;
int len; Py_ssize_t len;
if ( !PyArg_ParseTuple(args, "s#:b2a_hqx", &bin_data, &len) ) if ( !PyArg_ParseTuple(args, "s#:b2a_hqx", &bin_data, &len) )
return NULL; return NULL;
...@@ -636,7 +637,7 @@ binascii_rledecode_hqx(PyObject *self, PyObject *args) ...@@ -636,7 +637,7 @@ binascii_rledecode_hqx(PyObject *self, PyObject *args)
unsigned char *in_data, *out_data; unsigned char *in_data, *out_data;
unsigned char in_byte, in_repeat; unsigned char in_byte, in_repeat;
PyObject *rv; PyObject *rv;
int in_len, out_len, out_len_left; Py_ssize_t in_len, out_len, out_len_left;
if ( !PyArg_ParseTuple(args, "s#:rledecode_hqx", &in_data, &in_len) ) if ( !PyArg_ParseTuple(args, "s#:rledecode_hqx", &in_data, &in_len) )
return NULL; return NULL;
...@@ -732,7 +733,7 @@ binascii_crc_hqx(PyObject *self, PyObject *args) ...@@ -732,7 +733,7 @@ binascii_crc_hqx(PyObject *self, PyObject *args)
{ {
unsigned char *bin_data; unsigned char *bin_data;
unsigned int crc; unsigned int crc;
int len; Py_ssize_t len;
if ( !PyArg_ParseTuple(args, "s#i:crc_hqx", &bin_data, &len, &crc) ) if ( !PyArg_ParseTuple(args, "s#i:crc_hqx", &bin_data, &len, &crc) )
return NULL; return NULL;
...@@ -870,7 +871,7 @@ binascii_crc32(PyObject *self, PyObject *args) ...@@ -870,7 +871,7 @@ binascii_crc32(PyObject *self, PyObject *args)
{ /* By Jim Ahlstrom; All rights transferred to CNRI */ { /* By Jim Ahlstrom; All rights transferred to CNRI */
unsigned char *bin_data; unsigned char *bin_data;
unsigned long crc = 0UL; /* initial value of CRC */ unsigned long crc = 0UL; /* initial value of CRC */
int len; Py_ssize_t len;
long result; long result;
if ( !PyArg_ParseTuple(args, "s#|l:crc32", &bin_data, &len, &crc) ) if ( !PyArg_ParseTuple(args, "s#|l:crc32", &bin_data, &len, &crc) )
...@@ -903,10 +904,10 @@ static PyObject * ...@@ -903,10 +904,10 @@ static PyObject *
binascii_hexlify(PyObject *self, PyObject *args) binascii_hexlify(PyObject *self, PyObject *args)
{ {
char* argbuf; char* argbuf;
int arglen; Py_ssize_t arglen;
PyObject *retval; PyObject *retval;
char* retbuf; char* retbuf;
int i, j; Py_ssize_t i, j;
if (!PyArg_ParseTuple(args, "t#:b2a_hex", &argbuf, &arglen)) if (!PyArg_ParseTuple(args, "t#:b2a_hex", &argbuf, &arglen))
return NULL; return NULL;
...@@ -960,10 +961,10 @@ static PyObject * ...@@ -960,10 +961,10 @@ static PyObject *
binascii_unhexlify(PyObject *self, PyObject *args) binascii_unhexlify(PyObject *self, PyObject *args)
{ {
char* argbuf; char* argbuf;
int arglen; Py_ssize_t arglen;
PyObject *retval; PyObject *retval;
char* retbuf; char* retbuf;
int i, j; Py_ssize_t i, j;
if (!PyArg_ParseTuple(args, "s#:a2b_hex", &argbuf, &arglen)) if (!PyArg_ParseTuple(args, "s#:a2b_hex", &argbuf, &arglen))
return NULL; return NULL;
...@@ -1030,7 +1031,7 @@ binascii_a2b_qp(PyObject *self, PyObject *args, PyObject *kwargs) ...@@ -1030,7 +1031,7 @@ binascii_a2b_qp(PyObject *self, PyObject *args, PyObject *kwargs)
unsigned int in, out; unsigned int in, out;
char ch; char ch;
unsigned char *data, *odata; unsigned char *data, *odata;
unsigned int datalen = 0; Py_ssize_t datalen = 0;
PyObject *rv; PyObject *rv;
static char *kwlist[] = {"data", "header", NULL}; static char *kwlist[] = {"data", "header", NULL};
int header = 0; int header = 0;
...@@ -1130,7 +1131,7 @@ binascii_b2a_qp (PyObject *self, PyObject *args, PyObject *kwargs) ...@@ -1130,7 +1131,7 @@ binascii_b2a_qp (PyObject *self, PyObject *args, PyObject *kwargs)
{ {
unsigned int in, out; unsigned int in, out;
unsigned char *data, *odata; unsigned char *data, *odata;
unsigned int datalen = 0, odatalen = 0; Py_ssize_t datalen = 0, odatalen = 0;
PyObject *rv; PyObject *rv;
unsigned int linelen = 0; unsigned int linelen = 0;
static char *kwlist[] = {"data", "quotetabs", "istext", static char *kwlist[] = {"data", "quotetabs", "istext",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment