From 5610990beaa4550b2c42d179f1beeb8e97a68639 Mon Sep 17 00:00:00 2001
From: Alberto Bertogli <albertito@blitiri.com.ar>
Date: Sun, 4 Apr 2010 02:41:42 -0300
Subject: [PATCH 11/15] bindings/python: Use ssize_t for s# parameters

Commit 9607741 (bindings/python: Add readv()/writev() support, 2009-07-13)
defined PY_SSIZE_T_CLEAN, which made PyArg_ParseTuple()'s s# parameters use
ssize_t for the string length, instead of int (which is the default). That was
needed for writev().

However, existing instances of s# were not converted, and caused subtle but
worrying memory corruption.

This patch fixes that by using ssize_t in the appropriate places.

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

diff --git a/bindings/python/libjio.c b/bindings/python/libjio.c
index 46b257d..b75ba98 100644
--- a/bindings/python/libjio.c
+++ b/bindings/python/libjio.c
@@ -279,7 +279,7 @@ static PyObject *jf_write(jfile_object *fp, PyObject *args)
 {
 	long rv;
 	unsigned char *buf;
-	int len;
+	ssize_t len;
 
 	if (!PyArg_ParseTuple(args, "s#:write", &buf, &len))
 		return NULL;
@@ -307,7 +307,7 @@ static PyObject *jf_pwrite(jfile_object *fp, PyObject *args)
 	long rv;
 	unsigned char *buf;
 	long long offset;
-	int len;
+	ssize_t len;
 
 	if (!PyArg_ParseTuple(args, "s#L:pwrite", &buf, &len, &offset))
 		return NULL;
@@ -659,7 +659,7 @@ It's a wrapper to jtrans_add_w().\n");
 static PyObject *jt_add_w(jtrans_object *tp, PyObject *args)
 {
 	long rv;
-	int len;
+	ssize_t len;
 	long long offset;
 	unsigned char *buf;
 
-- 
1.6.2.2.646.gb214

