[Python-checkins] r42742 - python/trunk/Modules/binascii.c

thomas.wouters python-checkins at python.org
Wed Mar 1 22:37:34 CET 2006


Author: thomas.wouters
Date: Wed Mar  1 22:37:32 2006
New Revision: 42742

Modified:
   python/trunk/Modules/binascii.c
Log:

Make Py_ssize_t-clean.



Modified: python/trunk/Modules/binascii.c
==============================================================================
--- python/trunk/Modules/binascii.c	(original)
+++ python/trunk/Modules/binascii.c	Wed Mar  1 22:37:32 2006
@@ -53,6 +53,7 @@
 ** Brandon Long, September 2001.
 */
 
+#include PY_SSIZE_T_CLEAN
 
 #include "Python.h"
 
@@ -189,7 +190,7 @@
 	unsigned char this_ch;
 	unsigned int leftchar = 0;
 	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) )
 		return NULL;
@@ -265,7 +266,7 @@
 	unsigned char this_ch;
 	unsigned int leftchar = 0;
 	PyObject *rv;
-	int bin_len;
+	Py_ssize_t bin_len;
 
 	if ( !PyArg_ParseTuple(args, "s#:b2a_uu", &bin_data, &bin_len) )
 		return NULL;
@@ -307,7 +308,7 @@
 
 
 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
 	** valid character for base64, or -1 if none.
@@ -341,7 +342,7 @@
 	unsigned char this_ch;
 	unsigned int leftchar = 0;
 	PyObject *rv;
-	int ascii_len, bin_len;
+	Py_ssize_t ascii_len, bin_len;
 	int quad_pos = 0;
 
 	if ( !PyArg_ParseTuple(args, "t#:a2b_base64", &ascii_data, &ascii_len) )
@@ -432,7 +433,7 @@
 	unsigned char this_ch;
 	unsigned int leftchar = 0;
 	PyObject *rv;
-	int bin_len;
+	Py_ssize_t bin_len;
 
 	if ( !PyArg_ParseTuple(args, "s#:b2a_base64", &bin_data, &bin_len) )
 		return NULL;
@@ -485,7 +486,7 @@
 	unsigned char this_ch;
 	unsigned int leftchar = 0;
 	PyObject *rv;
-	int len;
+	Py_ssize_t len;
 	int done = 0;
 
 	if ( !PyArg_ParseTuple(args, "t#:a2b_hqx", &ascii_data, &len) )
@@ -549,7 +550,7 @@
 	unsigned char *in_data, *out_data;
 	PyObject *rv;
 	unsigned char ch;
-	int in, inend, len;
+	Py_ssize_t in, inend, len;
 
 	if ( !PyArg_ParseTuple(args, "s#:rlecode_hqx", &in_data, &len) )
 		return NULL;
@@ -598,7 +599,7 @@
 	unsigned char this_ch;
 	unsigned int leftchar = 0;
 	PyObject *rv;
-	int len;
+	Py_ssize_t len;
 
 	if ( !PyArg_ParseTuple(args, "s#:b2a_hqx", &bin_data, &len) )
 		return NULL;
@@ -636,7 +637,7 @@
 	unsigned char *in_data, *out_data;
 	unsigned char in_byte, in_repeat;
 	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) )
 		return NULL;
@@ -732,7 +733,7 @@
 {
 	unsigned char *bin_data;
 	unsigned int crc;
-	int len;
+	Py_ssize_t len;
 
 	if ( !PyArg_ParseTuple(args, "s#i:crc_hqx", &bin_data, &len, &crc) )
 		return NULL;
@@ -870,7 +871,7 @@
 { /* By Jim Ahlstrom; All rights transferred to CNRI */
 	unsigned char *bin_data;
 	unsigned long crc = 0UL;	/* initial value of CRC */
-	int len;
+	Py_ssize_t len;
 	long result;
 
 	if ( !PyArg_ParseTuple(args, "s#|l:crc32", &bin_data, &len, &crc) )
@@ -903,10 +904,10 @@
 binascii_hexlify(PyObject *self, PyObject *args)
 {
 	char* argbuf;
-	int arglen;
+	Py_ssize_t arglen;
 	PyObject *retval;
 	char* retbuf;
-	int i, j;
+	Py_ssize_t i, j;
 
 	if (!PyArg_ParseTuple(args, "t#:b2a_hex", &argbuf, &arglen))
 		return NULL;
@@ -960,10 +961,10 @@
 binascii_unhexlify(PyObject *self, PyObject *args)
 {
 	char* argbuf;
-	int arglen;
+	Py_ssize_t arglen;
 	PyObject *retval;
 	char* retbuf;
-	int i, j;
+	Py_ssize_t i, j;
 
 	if (!PyArg_ParseTuple(args, "s#:a2b_hex", &argbuf, &arglen))
 		return NULL;
@@ -1030,7 +1031,7 @@
 	unsigned int in, out;
 	char ch;
 	unsigned char *data, *odata;
-	unsigned int datalen = 0;
+	Py_ssize_t datalen = 0;
 	PyObject *rv;
 	static char *kwlist[] = {"data", "header", NULL};
 	int header = 0;
@@ -1130,7 +1131,7 @@
 {
 	unsigned int in, out;
 	unsigned char *data, *odata;
-	unsigned int datalen = 0, odatalen = 0;
+	Py_ssize_t datalen = 0, odatalen = 0;
 	PyObject *rv;
 	unsigned int linelen = 0;
 	static char *kwlist[] = {"data", "quotetabs", "istext",


More information about the Python-checkins mailing list