Mercurial > audlegacy-plugins
comparison src/console/Vfs_File.cxx @ 1978:fa9f85cebade
s/vfs_/aud_vfs_/g
| author | William Pitcock <nenolod@atheme.org> |
|---|---|
| date | Sun, 07 Oct 2007 00:25:33 -0500 |
| parents | 986f098da058 |
| children |
comparison
equal
deleted
inserted
replaced
| 1977:5a6b60ceaa0f | 1978:fa9f85cebade |
|---|---|
| 11 } | 11 } |
| 12 | 12 |
| 13 Vfs_File_Reader::error_t Vfs_File_Reader::open( const char* path ) | 13 Vfs_File_Reader::error_t Vfs_File_Reader::open( const char* path ) |
| 14 { | 14 { |
| 15 close(); | 15 close(); |
| 16 file_ = owned_file_ = vfs_fopen( path, "rb" ); | 16 file_ = owned_file_ = aud_vfs_fopen( path, "rb" ); |
| 17 if ( !file_ ) | 17 if ( !file_ ) |
| 18 return "Couldn't open file"; | 18 return "Couldn't open file"; |
| 19 return 0; | 19 return 0; |
| 20 } | 20 } |
| 21 | 21 |
| 22 long Vfs_File_Reader::size() const | 22 long Vfs_File_Reader::size() const |
| 23 { | 23 { |
| 24 long pos = tell(); | 24 long pos = tell(); |
| 25 vfs_fseek( file_, 0, SEEK_END ); | 25 aud_vfs_fseek( file_, 0, SEEK_END ); |
| 26 long result = tell(); | 26 long result = tell(); |
| 27 vfs_fseek( file_, pos, SEEK_SET ); | 27 aud_vfs_fseek( file_, pos, SEEK_SET ); |
| 28 return result; | 28 return result; |
| 29 } | 29 } |
| 30 | 30 |
| 31 long Vfs_File_Reader::read_avail( void* p, long s ) | 31 long Vfs_File_Reader::read_avail( void* p, long s ) |
| 32 { | 32 { |
| 33 return (long) vfs_fread( p, 1, s, file_ ); | 33 return (long) aud_vfs_fread( p, 1, s, file_ ); |
| 34 } | 34 } |
| 35 | 35 |
| 36 long Vfs_File_Reader::tell() const | 36 long Vfs_File_Reader::tell() const |
| 37 { | 37 { |
| 38 return vfs_ftell( file_ ); | 38 return aud_vfs_ftell( file_ ); |
| 39 } | 39 } |
| 40 | 40 |
| 41 Vfs_File_Reader::error_t Vfs_File_Reader::seek( long n ) | 41 Vfs_File_Reader::error_t Vfs_File_Reader::seek( long n ) |
| 42 { | 42 { |
| 43 if ( n == 0 ) // optimization | 43 if ( n == 0 ) // optimization |
| 44 vfs_rewind( file_ ); | 44 aud_vfs_rewind( file_ ); |
| 45 else if ( vfs_fseek( file_, n, SEEK_SET ) != 0 ) | 45 else if ( aud_vfs_fseek( file_, n, SEEK_SET ) != 0 ) |
| 46 return eof_error; | 46 return eof_error; |
| 47 return 0; | 47 return 0; |
| 48 } | 48 } |
| 49 | 49 |
| 50 void Vfs_File_Reader::close() | 50 void Vfs_File_Reader::close() |
| 51 { | 51 { |
| 52 file_ = 0; | 52 file_ = 0; |
| 53 if ( owned_file_ ) | 53 if ( owned_file_ ) |
| 54 { | 54 { |
| 55 vfs_fclose( owned_file_ ); | 55 aud_vfs_fclose( owned_file_ ); |
| 56 owned_file_ = 0; | 56 owned_file_ = 0; |
| 57 } | 57 } |
| 58 } | 58 } |
