Changeset 1660:99bfd21f00ef in roaraudio for libroar


Ignore:
Timestamp:
05/08/09 16:56:40 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

changed name of fh in con struct to fh, this should all apps requiring the private member to fail to build, added function to get fh, change code to use them both everythere

Location:
libroar
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libroar/basic.c

    r1475 r1660  
    187187 memset(con, 0, sizeof(struct roar_connection)); 
    188188 
    189  con->fh = fh; 
     189 con->__fh = fh; 
    190190 
    191191 roar_errno = ROAR_ERROR_NONE; 
    192192 return 0; 
     193} 
     194 
     195int roar_get_connection_fh (struct roar_connection * con) { 
     196 return con->__fh; 
    193197} 
    194198 
     
    204208 
    205209#ifdef ROAR_HAVE_IO_POSIX 
    206  close(con->fh); 
    207 #endif 
    208  
    209  con->fh = -1; 
     210 close(roar_get_connection_fh(con)); 
     211#endif 
     212 
     213 roar_connect_fh(con, -2); 
    210214 
    211215 roar_errno = ROAR_ERROR_NONE; 
     
    256260 struct roar_vio_calls vio; 
    257261 
    258  if ( roar_vio_open_fh_socket(&vio, con->fh) == -1 ) 
     262 if ( roar_vio_open_fh_socket(&vio, roar_get_connection_fh(con)) == -1 ) 
    259263  return -1; 
    260264 
     
    298302 struct roar_vio_calls vio; 
    299303 
    300  if ( roar_vio_open_fh_socket(&vio, con->fh) == -1 ) 
     304 if ( roar_vio_open_fh_socket(&vio, roar_get_connection_fh(con)) == -1 ) 
    301305  return -1; 
    302306 
     
    385389 struct roar_vio_calls vio; 
    386390 
    387  if ( roar_vio_open_fh_socket(&vio, con->fh) == -1 ) 
     391 if ( roar_vio_open_fh_socket(&vio, roar_get_connection_fh(con)) == -1 ) 
    388392  return -1; 
    389393 
  • libroar/file.c

    r1474 r1660  
    203203 struct roar_stream localstream[1]; 
    204204 
     205 // FIXME: check error cases 
     206 
    205207 if ( !s ) 
    206208  s = localstream; 
     
    255257  } 
    256258 
    257   ROAR_SHUTDOWN(con->fh, SHUT_RD); 
    258  
    259   out = con->fh; 
     259  if ( (out = roar_get_connection_fh(con)) == -1 ) { 
     260   close(in); 
     261   return -1; 
     262  } 
     263 
     264  ROAR_SHUTDOWN(out, SHUT_RD); 
    260265 } else { 
    261266  if ( !(passfh && seek) ) { 
  • libroar/simple.c

    r1476 r1660  
    6565int roar_simple_stream_obj  (struct roar_stream * s, int rate, int channels, int bits, int codec, char * server, int dir, char * name) { 
    6666 struct roar_connection con; 
     67 int ret; 
    6768 
    6869 if ( roar_simple_connect(&con, server, name) == -1 ) { 
     
    8788 } 
    8889 
     90 if ( (ret = roar_get_connection_fh(&con)) == -1 ) { 
     91  roar_disconnect(&con); 
     92  return -1; 
     93 } 
     94 
    8995 if ( dir == ROAR_DIR_PLAY ) { 
    90   ROAR_SHUTDOWN(con.fh, SHUT_RD); 
     96  ROAR_SHUTDOWN(ret, SHUT_RD); 
    9197 } else if ( dir == ROAR_DIR_MONITOR || dir == ROAR_DIR_RECORD ) { 
    92   ROAR_SHUTDOWN(con.fh, SHUT_WR); 
    93  } 
    94  
    95  return con.fh; 
     98  ROAR_SHUTDOWN(ret, SHUT_WR); 
     99 } 
     100 
     101 return ret; 
    96102} 
    97103 
     
    146152 
    147153#ifdef ROAR_HAVE_BSDSOCKETS 
    148  if ( getsockname(con->fh, (struct sockaddr *)&socket_addr, &len) == -1 ) { 
     154 if ( getsockname(roar_get_connection_fh(con), (struct sockaddr *)&socket_addr, &len) == -1 ) { 
    149155  return -1; 
    150156 } 
     
    339345 struct roar_connection con; 
    340346 
    341  con.fh = fh; 
     347 if ( roar_connect_fh(&con, fh) == -1 ) 
     348  return -1; 
    342349 
    343350 return roar_get_standby(&con); 
  • libroar/stream.c

    r1475 r1660  
    203203int roar_stream_passfh  (struct roar_connection * con, struct roar_stream * s, int fh) { 
    204204 struct roar_message m; 
     205 int confh; 
    205206 
    206207 m.cmd     = ROAR_CMD_PASSFH; 
     
    210211 
    211212 ROAR_DBG("roar_stream_passfh(con={.fh=%i,...}, s={.id=%i,...}, fh=%i) = ?", con->fh, s->id, fh); 
     213 
     214 if ( (confh = roar_get_connection_fh(con)) == -1 ) 
     215  return -1; 
    212216 
    213217 if ( roar_send_message(con, &m, NULL) == -1 ) { 
     
    218222 ROAR_DBG("roar_stream_passfh(*): msg send"); 
    219223 
    220  if ( roar_socket_send_fh(con->fh, fh, NULL, 0) == -1 ) 
     224 if ( roar_socket_send_fh(confh, fh, NULL, 0) == -1 ) 
    221225  return -1; 
    222226 
Note: See TracChangeset for help on using the changeset viewer.