From c7d31f215f7f248fa62f35322c8afddfd114da66 Mon Sep 17 00:00:00 2001
From: Alberto Bertogli <albertito@blitiri.com.ar>
Date: Wed, 26 May 2010 00:22:45 -0300
Subject: [PATCH 01/24] python: Fix int/long argument parsing mismatch

Some PyArg_ParseTuple() invocations were told to parse to an int, but a long
was given to it instead.

On 64-bit platforms that mismatch caused trouble, but luckily nothing that
could cause corruption, since the resulting values were given to malloc(),
which would fail.

This issue came up when running the behaviour tests in Fedora 13.

The patch fixes this by telling PyArg_ParseTuple() we are giving it a long
instead of an int.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
---
 bindings/python/libjio.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bindings/python/libjio.c b/bindings/python/libjio.c
index b75ba98..e0c8c68 100644
--- a/bindings/python/libjio.c
+++ b/bindings/python/libjio.c
@@ -101,7 +101,7 @@ static PyObject *jf_read(jfile_object *fp, PyObject *args)
 	unsigned char *buf;
 	PyObject *r;
 
-	if (!PyArg_ParseTuple(args, "i:read", &len))
+	if (!PyArg_ParseTuple(args, "l:read", &len))
 		return NULL;
 
 	buf = malloc(len);
@@ -142,7 +142,7 @@ static PyObject *jf_pread(jfile_object *fp, PyObject *args)
 	unsigned char *buf;
 	PyObject *r;
 
-	if (!PyArg_ParseTuple(args, "iL:pread", &len, &offset))
+	if (!PyArg_ParseTuple(args, "lL:pread", &len, &offset))
 		return NULL;
 
 	buf = malloc(len);
-- 
1.6.2.2.646.gb214

