Changeset 4078:19d24e1dc238 in roaraudio


Ignore:
Timestamp:
07/23/10 18:01:42 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

another fix to get it working again: handle internal fh=-1 correctly

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroaross/libroaross.c

    r4077 r4078  
    364364 int p[2]; 
    365365 
     366 ROAR_DBG("_open_dummy(void) = ?"); 
     367 
    366368 if ( pipe(p) == -1 ) 
    367369  return -1; 
     
    369371 close(p[1]); 
    370372 
     373 ROAR_DBG("_open_dummy(void) = %i", p[0]); 
    371374 return p[0]; 
    372375} 
     
    490493} 
    491494 
    492 static struct pointer * _get_pointer_by_fh (int fh) { 
     495static struct pointer * _get_pointer_by_fh_or_new (int fh) { 
    493496 int i; 
    494  
    495  if ( fh == -1 ) 
    496   return NULL; 
    497497 
    498498 for (i = 0; i < _MAX_POINTER; i++) { 
     
    504504} 
    505505 
     506static struct pointer * _get_pointer_by_fh (int fh) { 
     507 int i; 
     508 
     509 if ( fh == -1 ) 
     510  return NULL; 
     511 
     512 return _get_pointer_by_fh_or_new(fh); 
     513} 
     514 
    506515static struct pointer * _open_pointer(struct handle * handle) { 
    507  struct pointer * ret = _get_pointer_by_fh(-1); 
    508  
    509  if ( ret == NULL ) 
     516 struct pointer * ret = _get_pointer_by_fh_or_new(-1); 
     517 
     518 ROAR_DBG("_open_pointer(handle=%p) = ?", handle); 
     519 
     520 if ( ret == NULL ) { 
     521  ROAR_DBG("_open_pointer(handle=%p) = NULL", handle); 
    510522  return NULL; 
    511  
    512  if ( (ret->fh = _open_dummy()) == -1 ) 
     523 } 
     524 
     525 if ( (ret->fh = _open_dummy()) == -1 ) { 
     526  ROAR_DBG("_open_pointer(handle=%p) = NULL", handle); 
    513527  return NULL; 
     528 } 
    514529 
    515530 ret->handle = handle; 
    516531 
     532 ROAR_DBG("_open_pointer(handle=%p) = %p", handle, ret); 
     533 
    517534 return ret; 
    518535} 
    519536 
    520537static struct pointer * _attach_pointer(struct handle * handle, int fh) { 
    521  struct pointer * ret = _get_pointer_by_fh(-1); 
     538 struct pointer * ret = _get_pointer_by_fh_or_new(-1); 
    522539 
    523540 if ( ret == NULL ) 
     
    724741   break; 
    725742 } 
     743 
     744 ROAR_DBG("_open_file(pathname='%s', flags=0x%x) = ?", pathname, flags); 
    726745 
    727746 if ( (pointer = _open_pointer(handle)) == NULL ) { 
Note: See TracChangeset for help on using the changeset viewer.