Ignore:
Timestamp:
Mar 15, 2017, 7:07:06 PM (7 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
sampler
Children:
bff692e
Parents:
388c2e7
Message:

src/synt/sampler.c: take a copy of uri

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/synth/sampler.c

    r388c2e7 rebed7e6  
    6969  // reading from a source
    7070  aubio_source_t *source;
    71   const char_t *uri;
     71  char_t *uri;
    7272  uint_t playing;
    7373  uint_t opened;
     
    9494  pthread_mutex_t open_mutex;
    9595  uint_t waited;                // number of frames skipped while opening
    96   const char_t *next_uri;
     96  char_t *next_uri;
    9797  uint_t open_thread_running;
    9898  sint_t available;             // number of samples currently available
     
    263263      o->samplerate = aubio_source_get_samplerate(o->source);
    264264    }
    265     o->uri = uri;
     265    if (o->uri) AUBIO_FREE(o->uri);
     266    o->uri = AUBIO_ARRAY(char_t, strnlen(uri, PATH_MAX) + 1);
     267    strncpy(o->uri, uri, strnlen(uri, PATH_MAX) + 1);
    266268    o->finished = 0;
    267269    o->eof = 0;
     
    344346  o->started = 0;
    345347  o->available = 0;
    346   o->next_uri = uri;
     348  if (o->next_uri) AUBIO_FREE(o->next_uri);
     349  o->next_uri = AUBIO_ARRAY(char_t, strnlen(uri, PATH_MAX) + 1);
     350  strncpy(o->next_uri, uri, strnlen(uri, PATH_MAX) + 1);
    347351  o->waited = 0;
    348352  if (pthread_create(&o->open_thread, 0, aubio_sampler_openfn, o) != 0) {
Note: See TracChangeset for help on using the changeset viewer.