Changeset 3764:2a2b1eb426c4 in roaraudio for roard/midi.c


Ignore:
Timestamp:
05/03/10 14:30:48 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added new buffer function roar_buffer_new_data() to make common alloc case more easy

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/midi.c

    r3594 r3764  
    157157 } 
    158158 
    159  if ( roar_buffer_new(&b, MIDI_READ_SIZE) == -1 ) { 
     159 if ( roar_buffer_new_data(&b, MIDI_READ_SIZE, (void**)&buf) == -1 ) { 
    160160  ROAR_ERR("midi_check_stream(*): Can not alloc buffer space!"); 
    161161  ROAR_DBG("midi_check_stream(*) = -1"); 
    162162  return -1; 
    163163 } 
    164  
    165  roar_buffer_get_data(b, (void **)&buf); 
    166164 
    167165 if ( (len = stream_vio_s_read(ss, buf, MIDI_READ_SIZE)) < 1 ) { 
     
    480478 *buf = (void*)(*mes = NULL); 
    481479 
    482  if ( roar_buffer_new(buf, sizeof(struct midi_message)) == -1 ) 
    483   return -1; 
    484  
    485  if ( roar_buffer_get_data(*buf, (void**)mes) == -1 ) { 
    486   roar_buffer_free(*buf); 
     480 if ( roar_buffer_new_data(buf, sizeof(struct midi_message), (void**)mes) == -1 ) { 
    487481  *buf = (void*)(*mes = NULL); 
    488482  return -1; 
Note: See TracChangeset for help on using the changeset viewer.