Changeset 0ff4434


Ignore:
Timestamp:
Sep 5, 2014, 2:41:07 AM (10 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:
f33ab63
Parents:
79b54ea
Message:

src/io/source_wavread.c: improve seek errors processing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/source_wavread.c

    r79b54ea r0ff4434  
    356356
    357357uint_t aubio_source_wavread_seek (aubio_source_wavread_t * s, uint_t pos) {
    358   uint_t ret = fseek(s->fid, s->seek_start + pos * s->blockalign, SEEK_SET);
     358  uint_t ret = 0;
     359  if ((sint_t)pos < 0) {
     360    return AUBIO_FAIL;
     361  }
     362  ret = fseek(s->fid, s->seek_start + pos * s->blockalign, SEEK_SET);
     363  if (ret != 0) {
     364    AUBIO_ERR("source_wavread: could not seek %s at %d (%s)\n", s->path, pos, strerror(errno));
     365    return AUBIO_FAIL;
     366  }
     367  // reset some values
    359368  s->eof = 0;
    360369  s->read_index = 0;
    361   return ret;
     370  return AUBIO_OK;
    362371}
    363372
Note: See TracChangeset for help on using the changeset viewer.