git » libjio » commit 0d1bf4c

Use the appropriate data types in Python bindings

author Alberto Bertogli
2009-02-26 22:28:55 UTC
committer Alberto Bertogli
2009-03-02 00:39:59 UTC
parent 9b6ee79bc86c65a99901c1fca066856b60296761

Use the appropriate data types in Python bindings

When PyArg_ParseTuple() expects an int, it's better if we really give it
an int. Otherwise, if we use a larger data type, we might get garbage
because it will assume it's the size of an int.

We had some cases when that could happen, and this patch gets rid of them.

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

bindings/python/libjio.c +3 -3

diff --git a/bindings/python/libjio.c b/bindings/python/libjio.c
index 8ea6093..eb90e5a 100644
--- a/bindings/python/libjio.c
+++ b/bindings/python/libjio.c
@@ -166,7 +166,7 @@ static PyObject *jf_write(jfileobject *fp, PyObject *args)
 {
 	long rv;
 	unsigned char *buf;
-	long len;
+	int len;
 
 	if (!PyArg_ParseTuple(args, "s#:write", &buf, &len))
 		return NULL;
@@ -194,7 +194,7 @@ static PyObject *jf_pwrite(jfileobject *fp, PyObject *args)
 	long rv;
 	unsigned char *buf;
 	long long offset;
-	long len;
+	int len;
 
 	if (!PyArg_ParseTuple(args, "s#L:pwrite", &buf, &len, &offset))
 		return NULL;
@@ -409,7 +409,7 @@ It's a wrapper to jtrans_add().\n");
 static PyObject *jt_add(jtransobject *tp, PyObject *args)
 {
 	long rv;
-	long len;
+	int len;
 	long long offset;
 	unsigned char *buf;