Changeset 18e22f9 for python


Ignore:
Timestamp:
Dec 10, 2013, 11:57:30 PM (11 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
906c0a2
Parents:
bf63c61
Message:

ext/py-source.c: fix size checks

Signed-off-by: Paul Brossier <piem@piem.org>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/ext/py-source.c

    rbf63c61 r18e22f9  
    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
Note: See TracChangeset for help on using the changeset viewer.