#include "ioutils.h"
#include "source_wavread.h"
-#include <errno.h>
-
#define AUBIO_WAVREAD_BUFSIZE 1024
#define SHORT_TO_FLOAT(x) (smpl_t)(x * 3.0517578125e-05)
s->fid = fopen((const char *)path, "rb");
if (!s->fid) {
- AUBIO_ERR("source_wavread: Failed opening %s (System error: %s)\n", s->path, strerror(errno));
+ AUBIO_STRERR("source_wavread: Failed opening %s (%s)\n", s->path, errorstr);
goto beach;
}
buf[4] = '\0';
bytes_junk += read_little_endian(buf, 4);
if (fseek(s->fid, bytes_read + bytes_junk, SEEK_SET) != 0) {
- AUBIO_ERR("source_wavread: Failed opening %s (could not seek past JUNK Chunk: %s)\n",
- s->path, strerror(errno));
+ AUBIO_STRERR("source_wavread: Failed opening %s (could not seek past JUNK Chunk: %s)\n",
+ s->path, errorstr);
goto beach;
}
bytes_read += bytes_junk;
buf[4] = '\0';
bytes_junk += read_little_endian(buf, 4);
if (fseek(s->fid, bytes_read + bytes_junk, SEEK_SET) != 0) {
- AUBIO_ERR("source_wavread: could not seek past unknown chunk in %s (%s)\n",
- s->path, strerror(errno));
+ AUBIO_STRERR("source_wavread: could not seek past unknown chunk in %s (%s)\n",
+ s->path, errorstr);
goto beach;
}
bytes_read += bytes_junk;
}
ret = fseek(s->fid, s->seek_start + pos * s->blockalign, SEEK_SET);
if (ret != 0) {
- AUBIO_ERR("source_wavread: could not seek %s at %d (%s)\n", s->path, pos, strerror(errno));
+ AUBIO_STRERR("source_wavread: could not seek %s at %d (%s)\n", s->path, pos, errorstr);
return AUBIO_FAIL;
}
// reset some values
return AUBIO_OK;
}
if (fclose(s->fid)) {
- AUBIO_ERR("source_wavread: could not close %s (%s)\n", s->path, strerror(errno));
+ AUBIO_STRERR("source_wavread: could not close %s (%s)\n", s->path, errorstr);
return AUBIO_FAIL;
}
s->fid = NULL;