git » nmdb » commit 582a0a0

python: Properly cast the buffer arguments to PyString_FromStringAndSize()

author Alberto Bertogli
2008-12-07 13:47:24 UTC
committer Alberto Bertogli
2008-12-07 13:47:24 UTC
parent a25933b0dc80e3dc730e350537f2ec8689626131

python: Properly cast the buffer arguments to PyString_FromStringAndSize()

PyString_FromStringAndSize() expects a char *, and we're giving them an
unsigned char *, which makes the compiler complain. So we just cast it,
there's no downside because PyString_FromStringAndSize() doesn't really
care about what's in the buffer.

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

bindings/python/nmdb_ll.c +2 -2

diff --git a/bindings/python/nmdb_ll.c b/bindings/python/nmdb_ll.c
index 6bd7139..c4bdd91 100644
--- a/bindings/python/nmdb_ll.c
+++ b/bindings/python/nmdb_ll.c
@@ -136,7 +136,7 @@ static PyObject *db_cache_get(nmdbobject *db, PyObject *args)
 		/* Miss, handled in the high-level module. */
 		r = PyLong_FromLong(-1);
 	} else {
-		r = PyString_FromStringAndSize(val, rv);
+		r = PyString_FromStringAndSize((char *) val, rv);
 	}
 
 	free(val);
@@ -252,7 +252,7 @@ static PyObject *db_get(nmdbobject *db, PyObject *args)
 		/* Miss, handled in the high-level module. */
 		r = PyLong_FromLong(-1);
 	} else {
-		r = PyString_FromStringAndSize(val, rv);
+		r = PyString_FromStringAndSize((char *) val, rv);
 	}
 
 	free(val);