git » pytipc » commit b823c3a

Fix some signed/unsigned conversion issues with PyArg_ParseTuple().

author Alberto Bertogli
2008-01-12 20:47:31 UTC
committer Alberto Bertogli
2008-01-12 20:47:31 UTC
parent 42a03de2793bffb4bc7b60a518e109eb0b438bbb

Fix some signed/unsigned conversion issues with PyArg_ParseTuple().

These are hardly a problem in real life because the size of the strings
involved is usually too low, but it's better to be safe than sorry.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

tipc_ll.c +3 -3

diff --git a/tipc_ll.c b/tipc_ll.c
index a6206fd..6712d77 100644
--- a/tipc_ll.c
+++ b/tipc_ll.c
@@ -180,7 +180,7 @@ static PyObject *tipc_sendto(PyObject *self, PyObject *args)
 {
 	int fd, rv;
 	char *buf;
-	size_t len = 0;
+	ssize_t len = 0;
 	struct sockaddr_tipc sa;
 	PyObject *addr;
 
@@ -210,7 +210,7 @@ static PyObject *tipc_recvfrom(PyObject *self, PyObject *args)
 	int rv;
 	PyObject *str;
 
-	if (!PyArg_ParseTuple(args, "ii:tipc_recvfrom", &fd, &maxlen)) {
+	if (!PyArg_ParseTuple(args, "iI:tipc_recvfrom", &fd, &maxlen)) {
 		return NULL;
 	}
 
@@ -256,7 +256,7 @@ static PyObject *tipc_build_subscr(PyObject *self, PyObject *args)
 static PyObject *tipc_parse_event(PyObject *self, PyObject *args)
 {
 	unsigned char *buf;
-	size_t len = 0;
+	ssize_t len = 0;
 	struct tipc_event *event;
 
 	if (!PyArg_ParseTuple(args, "s#:tipc_parse_event",