History

ext/py-source.c: fix size checks

Paul Brossier committed 12 years ago

Commit 18e22f91 parent bf63c611 file · +10 −10Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/ext/py-source.c+10−10
@@ -40,21 +40,21 @@ Py_source_new (PyTypeObject * pytype, PyObject * args, PyObject * kwds) · 39 unmodified lines
4040 }
4141
4242 self->samplerate = 0;
43− if (samplerate > 0) {
43+ if ((sint_t)samplerate > 0) {
4444 self->samplerate = samplerate;
45− //} else if (samplerate < 0) {
46− // PyErr_SetString (PyExc_ValueError,
47− // "can not use negative value for samplerate");
48− // return NULL;
45+ } else if ((sint_t)samplerate < 0) {
46+ PyErr_SetString (PyExc_ValueError,
47+ "can not use negative value for samplerate");
48+ return NULL;
4949 }
5050
5151 self->hop_size = Py_default_vector_length / 2;
52− if (hop_size > 0) {
52+ if ((sint_t)hop_size > 0) {
5353 self->hop_size = hop_size;
54− //} else if (hop_size < 0) {
55− // PyErr_SetString (PyExc_ValueError,
56− // "can not use negative value for hop_size");
57− // return NULL;
54+ } else if ((sint_t)hop_size < 0) {
55+ PyErr_SetString (PyExc_ValueError,
56+ "can not use negative value for hop_size");
57+ return NULL;
5858 }
5959
6060 return (PyObject *) self;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t