Changeset 5300:190af1adf91c in roaraudio


Ignore:
Timestamp:
11/25/11 10:05:31 (8 years ago)
Author:
phi
Branch:
default
Message:

first commit to move away from old roar_buffer_add() to roar_buffer_moveinto() (See: #126)

Files:
7 edited

Legend:

Unmodified
Added
Removed
  • libroar/buffer.c

    r5299 r5300  
    582582  memcpy(nd, od, cur->user_len); 
    583583 
    584   _LIBROAR_IGNORE_RET(roar_buffer_add(*copy, new)); 
     584  _LIBROAR_IGNORE_RET(roar_buffer_moveinto(*copy, &new)); 
    585585 
    586586  cur = cur->next; 
  • libroar/vio_buffer_store.c

    r5278 r5300  
    123123  self->in = nbuf; 
    124124 } else { 
    125   if ( roar_buffer_add(self->in, nbuf) == -1 ) { 
     125  if ( roar_buffer_moveinto(self->in, &nbuf) == -1 ) { 
    126126   roar_buffer_free(nbuf); 
    127127   return -1; 
  • libroar/vio_pipe.c

    r5278 r5300  
    348348     self->b.b[idx] = next; 
    349349    } else { 
    350      if ( roar_buffer_add(self->b.b[idx], next) == -1 ) { 
     350     if ( roar_buffer_moveinto(self->b.b[idx], &next) == -1 ) { 
    351351      roar_buffer_free(next); 
    352352      return -1; 
  • libroar/vio_zlib.c

    r5278 r5300  
    299299   self->inbuf = leftbuf; 
    300300  } else { 
    301    if ( roar_buffer_add(self->inbuf, leftbuf) == -1 ) { 
     301   if ( roar_buffer_moveinto(self->inbuf, &leftbuf) == -1 ) { 
    302302    roar_buffer_free(leftbuf); 
    303303    roar_err_set((self->decompressor_error = ROAR_ERROR_LOSTSYNC)); 
     
    402402     self->outbuf = leftbuf; 
    403403    } else { 
    404      if ( roar_buffer_add(self->outbuf, leftbuf) == -1 ) { 
     404     if ( roar_buffer_moveinto(self->outbuf, &leftbuf) == -1 ) { 
    405405      roar_buffer_free(leftbuf); 
    406406      roar_err_set((self->compressor_error = ROAR_ERROR_LOSTSYNC)); 
  • libroardsp/transcode.c

    r5270 r5300  
    206206  } 
    207207 
    208   if ( roar_buffer_new(&bufbuf, curlen) == -1 ) 
     208  if ( roar_buffer_new_data(&bufbuf, curlen, &bufdata) == -1 ) 
    209209   return -1; 
    210  
    211   if ( roar_buffer_get_data(bufbuf, &bufdata) == -1 ) { 
    212    roar_buffer_free(bufbuf); 
    213    return -1; 
    214   } 
    215210 
    216211  if ( state->encode ) { 
     
    238233 } else { 
    239234  if ( state->encode ) { 
    240    if ( roar_buffer_new(&bufbuf, len) == -1 ) 
    241     return -1; 
    242  
    243    if ( roar_buffer_get_data(bufbuf, &bufdata) == -1 ) { 
     235   if ( roar_buffer_new_data(&bufbuf, len, &bufdata) == -1 ) 
     236    return -1; 
     237 
     238   memcpy(bufdata, buf, len); 
     239 
     240   if ( roar_buffer_moveinto(state->iobuffer, &bufbuf) == -1 ) { 
    244241    roar_buffer_free(bufbuf); 
    245242    return -1; 
    246243   } 
    247244 
    248    memcpy(bufdata, buf, len); 
    249  
    250    if ( roar_buffer_add(state->iobuffer, bufbuf) == -1 ) { 
    251     roar_buffer_free(bufbuf); 
    252     return -1; 
    253    } 
    254  
    255245   if ( roar_buffer_ring_stats(state->iobuffer, &ringstats) == -1 ) 
    256246    return -1; 
    257247 
    258    if ( roar_buffer_new(&bufbuf, state->packet_len) == -1 ) 
    259     return -1; 
    260  
    261    if ( roar_buffer_get_data(bufbuf, &bufdata) == -1 ) { 
    262     roar_buffer_free(bufbuf); 
    263     return -1; 
    264    } 
     248   if ( roar_buffer_new_data(&bufbuf, state->packet_len, &bufdata) == -1 ) 
     249    return -1; 
    265250 
    266251   while ( (ssize_t)ringstats.bytes > state->packet_len ) { 
  • libroarpulse/stream.c

    r5289 r5300  
    256256     s->iobuffer = buf; 
    257257    } else { 
    258      if ( roar_buffer_add(s->iobuffer, buf) == -1 ) { 
     258     if ( roar_buffer_moveinto(s->iobuffer, &buf) == -1 ) { 
    259259      roar_buffer_free(buf); 
    260260      return; 
     
    463463  p->iobuffer = buf; 
    464464 } else { 
    465   if ( roar_buffer_add(p->iobuffer, buf) == -1 ) 
     465  if ( roar_buffer_moveinto(p->iobuffer, &buf) == -1 ) 
    466466   return -1; 
    467467 } 
  • roarclients/roarmonhttp.c

    r5249 r5300  
    101101  } else { 
    102102   if ( vios[0].eventsa & ROAR_VIO_SELECT_READ ) { // we can read! 
    103     if ( roar_buffer_new(&cur, BUFSIZE) == -1 ) 
    104      return -1; 
    105  
    106     if ( roar_buffer_get_data(cur, &data) == -1 ) 
     103    if ( roar_buffer_new_data(&cur, BUFSIZE, &data) == -1 ) 
    107104     return -1; 
    108105 
     
    131128      ring = cur; 
    132129     } else { 
    133       if ( roar_buffer_add(ring, cur) == -1 ) { 
     130      if ( roar_buffer_moveinto(ring, &cur) == -1 ) { 
    134131       ROAR_ERR("stream(dest=%p, src=%p): Can not append buffer to ring: %s", 
    135132                dest, src, roar_error2str(roar_error)); 
Note: See TracChangeset for help on using the changeset viewer.