Changeset 1315:177636363c47 in roaraudio for libroar/basic.c


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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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} 
Note: See TracChangeset for help on using the changeset viewer.