From 18e22f9553c239cfbe915cce1998025784e87ed8 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Tue, 10 Dec 2013 17:57:30 -0500 Subject: [PATCH] ext/py-source.c: fix size checks Signed-off-by: Paul Brossier --- python/ext/py-source.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/python/ext/py-source.c b/python/ext/py-source.c index d35f3d9b..82cab06d 100644 --- a/python/ext/py-source.c +++ b/python/ext/py-source.c @@ -40,21 +40,21 @@ Py_source_new (PyTypeObject * pytype, PyObject * args, PyObject * kwds) } self->samplerate = 0; - if (samplerate > 0) { + if ((sint_t)samplerate > 0) { self->samplerate = samplerate; - //} else if (samplerate < 0) { - // PyErr_SetString (PyExc_ValueError, - // "can not use negative value for samplerate"); - // return NULL; + } else if ((sint_t)samplerate < 0) { + PyErr_SetString (PyExc_ValueError, + "can not use negative value for samplerate"); + return NULL; } self->hop_size = Py_default_vector_length / 2; - if (hop_size > 0) { + if ((sint_t)hop_size > 0) { self->hop_size = hop_size; - //} else if (hop_size < 0) { - // PyErr_SetString (PyExc_ValueError, - // "can not use negative value for hop_size"); - // return NULL; + } else if ((sint_t)hop_size < 0) { + PyErr_SetString (PyExc_ValueError, + "can not use negative value for hop_size"); + return NULL; } return (PyObject *) self; -- 2.11.0