Changeset 4786:c31d7735a7e6 in roaraudio


Ignore:
Timestamp:
03/11/11 02:52:29 (13 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

auto detect key file type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/authfile.c

    r4708 r4786  
    5050 struct roar_authfile * ret; 
    5151 size_t magiclen = 0; 
     52 struct stat filestat; 
     53 
     54 if ( type == ROAR_AUTHFILE_TYPE_AUTO ) { 
     55  if ( stat(filename, &filestat) != 0 ) 
     56   return NULL; 
     57 
     58  if ( filestat.st_size == 16 ) { 
     59   type = ROAR_AUTHFILE_TYPE_ESD; 
     60  } else if ( filestat.st_size == 256 ) { 
     61   type = ROAR_AUTHFILE_TYPE_PULSE; 
     62  } else { 
     63   return NULL; 
     64  } 
     65 } 
    5266 
    5367 switch (type) { 
Note: See TracChangeset for help on using the changeset viewer.