Skip to content

Commit

Permalink
use Py_ssize_t in decompress_ptr
Browse files Browse the repository at this point in the history
Since we are using 's#' here, we don't need to check if cbytes is less than
zero, since the length of the corresponding python bytesoby can never be less
than zero.

Adresses #26
  • Loading branch information
esc committed Apr 12, 2013
1 parent 39e34ab commit bffcde4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions blosc/blosc_extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,11 @@ PyBlosc_decompress_ptr(PyObject *self, PyObject *args)
{
PyObject * pointer;
void * input, * output;
size_t cbytes, nbytes;
Py_ssize_t cbytes;
size_t nbytes;

/* require a compressed string and a pointer */
if (!PyArg_ParseTuple(args, "s#O:decompress", &input, (Py_ssize_t*)&cbytes, &pointer))
if (!PyArg_ParseTuple(args, "s#O:decompress", &input, &cbytes, &pointer))
return NULL;

/* convert the int or long Python object to a void * */
Expand All @@ -198,7 +199,7 @@ PyBlosc_decompress_ptr(PyObject *self, PyObject *args)
return NULL;

/* fetch the uncompressed size into nbytes */
if (!get_nbytes(input, cbytes, &nbytes))
if (!get_nbytes(input, (size_t)cbytes, &nbytes))
return NULL;

/* do decompression */
Expand Down

0 comments on commit bffcde4

Please sign in to comment.