Changeset 1315:177636363c47 in roaraudio


Ignore:
Timestamp:
03/21/09 01:48:04 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

some small patches in direction of vio based roar_connection

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • doc/fixed-api

    r1206 r1315  
    11roar_connect 
     2roar_connect_fh 
    23roar_disconnect 
    34 
  • include/libroar/basic.h

    r690 r1315  
    6262 
    6363int roar_connect    (struct roar_connection * con, char * server); 
     64int roar_connect_fh (struct roar_connection * con, int fh); 
    6465int roar_disconnect (struct roar_connection * con); 
    6566 
  • include/roaraudio/error.h

    r809 r1315  
    4343#define ROAR_ERROR_MSGSIZE     11 /* Message too long */ 
    4444#define ROAR_ERROR_NOMEM       12 /* Not enough space */ 
     45#define ROAR_ERROR_INVAL       13 /* Invalid argument */ 
    4546 
    4647#endif 
  • libroar/basic.c

    r1099 r1315  
    153153 
    154154int roar_connect    (struct roar_connection * con, char * server) { 
    155  roar_errno = ROAR_ERROR_UNKNOWN; 
    156  con->fh = roar_connect_raw(server); 
    157  
    158  if ( con->fh == -1 ) 
    159   return -1; 
     155 int fh; 
     156 
     157 if ( con == NULL ) { 
     158  roar_errno = ROAR_ERROR_INVAL; 
     159  return -1; 
     160 } 
     161 
     162 roar_errno = ROAR_ERROR_UNKNOWN; 
     163 fh = roar_connect_raw(server); 
     164 
     165 if ( fh == -1 ) 
     166  return -1; 
     167 
     168 return roar_connect_fh(con, fh); 
     169} 
     170 
     171int roar_connect_fh (struct roar_connection * con, int fh) { 
     172 
     173 if ( con == NULL || fh == -1 ) { 
     174  roar_errno = ROAR_ERROR_INVAL; 
     175  return -1; 
     176 } 
     177 
     178 // specal hack to set an ilegal value used internaly in libroar: 
     179 if ( fh == -2 ) 
     180  fh = -1; 
     181 
     182 memset(con, 0, sizeof(struct roar_connection)); 
     183 
     184 con->fh = fh; 
    160185 
    161186 roar_errno = ROAR_ERROR_NONE; 
    162  
    163187 return 0; 
    164188} 
  • libroar/file.c

    r1196 r1315  
    273273 
    274274  if ( exec ) { 
    275    con->fh = -1; 
     275   // TODO: FIXME: this ma cause a memory leak in future 
     276   // OLD: con->fh = -1; 
     277   roar_connect_fh(con, -2); 
    276278  } 
    277279 
Note: See TracChangeset for help on using the changeset viewer.