Changeset b03f1bf


Ignore:
Timestamp:
Dec 23, 2018, 12:09:31 AM (6 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/timestretch, fix/ffmpeg5, master
Children:
0a1ad90
Parents:
26bd5e0
Message:

[sink_wavwrite] use STRERR macro

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/io/sink_wavwrite.c

    r26bd5e0 rb03f1bf  
    2828#include "io/sink_wavwrite.h"
    2929#include "io/ioutils.h"
    30 
    31 #include <errno.h>
    3230
    3331#define MAX_SIZE 4096
     
    168166  s->fid = fopen((const char *)s->path, "wb");
    169167  if (!s->fid) {
    170     char errorstr[256];
    171     AUBIO_STRERROR(errno, errorstr, sizeof(errorstr));
    172     AUBIO_ERR("sink_wavwrite: could not open %s (%s)\n", s->path, errorstr);
     168    AUBIO_STRERR("sink_wavwrite: could not open %s (%s)\n", s->path, errorstr);
    173169    goto beach;
    174170  }
     
    217213  // fwrite(*, *, 1, s->fid) was called 13 times, check success
    218214  if (written != 13) {
    219     char errorstr[256];
    220     AUBIO_STRERROR(errno, errorstr, sizeof(errorstr));
    221     AUBIO_WRN("sink_wavwrite: writing header to %s failed, expected %d"
     215    AUBIO_STRERR("sink_wavwrite: writing header to %s failed, expected %d"
    222216        " write but got only %d (%s)\n", s->path, 13, written, errorstr);
    223217    return AUBIO_FAIL;
     
    247241
    248242  if (written_frames != write) {
    249     char errorstr[256];
    250     AUBIO_STRERROR(errno, errorstr, sizeof(errorstr));
    251     AUBIO_WRN("sink_wavwrite: trying to write %d frames to %s, but only %d"
     243    AUBIO_STRERR("sink_wavwrite: trying to write %d frames to %s, but only %d"
    252244        " could be written (%s)\n", write, s->path, written_frames, errorstr);
    253245  }
     
    298290  written += fwrite(write_little_endian(data_size, buf, 4), 4, 1, s->fid);
    299291  if (written != 2 || err != 0) {
    300     char errorstr[256];
    301     AUBIO_STRERROR(errno, errorstr, sizeof(errorstr));
    302     AUBIO_WRN("sink_wavwrite: updating header of %s failed, expected %d"
     292    AUBIO_STRERR("sink_wavwrite: updating header of %s failed, expected %d"
    303293        " write but got only %d (%s)\n", s->path, 2, written, errorstr);
    304294  }
    305295  // close file
    306296  if (fclose(s->fid)) {
    307     char errorstr[256];
    308     AUBIO_STRERROR(errno, errorstr, sizeof(errorstr));
    309     AUBIO_ERR("sink_wavwrite: Error closing file %s (%s)\n", s->path, errorstr);
     297    AUBIO_STRERR("sink_wavwrite: Error closing file %s (%s)\n", s->path, errorstr);
    310298  }
    311299  s->fid = NULL;
Note: See TracChangeset for help on using the changeset viewer.