changeset 1712:2e7c9f6d9923 trunk

[svn] Use the VFS layer.
author chainsaw
date Sat, 16 Sep 2006 07:18:18 -0700
parents c7c1e346bb55
children a4d7227231e3
files ChangeLog Plugins/Input/console/abstract_file.cxx Plugins/Input/console/abstract_file.h
diffstat 3 files changed, 30 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Sep 15 21:36:31 2006 -0700
+++ b/ChangeLog	Sat Sep 16 07:18:18 2006 -0700
@@ -1,3 +1,12 @@
+2006-09-16 04:36:31 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [2359]
+  - no more busy loop if a file in playlist disappears.
+  
+
+  Changes:        Modified:
+  +6 -1           trunk/audacious/playlist.c  
+
+
 2006-09-16 03:21:35 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [2357]
   improvement of filepopup:
--- a/Plugins/Input/console/abstract_file.cxx	Fri Sep 15 21:36:31 2006 -0700
+++ b/Plugins/Input/console/abstract_file.cxx	Sat Sep 16 07:18:18 2006 -0700
@@ -143,7 +143,7 @@
 
 error_t Std_File_Reader::open( const char* path )
 {
-	file_ = fopen( path, "rb" );
+	file_ = vfs_fopen( path, "rb" );
 	if ( !file_ )
 		RAISE_ERROR( "Couldn't open file" );
 	return NULL;
@@ -152,23 +152,23 @@
 long Std_File_Reader::size() const
 {
 	long pos = tell();
-	fseek( file_, 0, SEEK_END );
+	vfs_fseek( file_, 0, SEEK_END );
 	long result = tell();
-	fseek( file_, pos, SEEK_SET );
+	vfs_fseek( file_, pos, SEEK_SET );
 	return result;
 }
 
 long Std_File_Reader::read_avail( void* p, long s ) {
-	return (long) fread( p, 1, s, file_ );
+	return (long) vfs_fread( p, 1, s, file_ );
 }
 
 long Std_File_Reader::tell() const {
-	return ftell( file_ );
+	return vfs_ftell( file_ );
 }
 
 error_t Std_File_Reader::seek( long n )
 {
-	if ( fseek( file_, n, SEEK_SET ) != 0 )
+	if ( vfs_fseek( file_, n, SEEK_SET ) != 0 )
 		RAISE_ERROR( "Error seeking in file" );
 	return NULL;
 }
@@ -176,7 +176,7 @@
 void Std_File_Reader::close()
 {
 	if ( file_ ) {
-		fclose( file_ );
+		vfs_fclose( file_ );
 		file_ = NULL;
 	}
 }
@@ -192,7 +192,7 @@
 
 error_t Std_File_Writer::open( const char* path )
 {
-	file_ = fopen( path, "wb" );
+	file_ = vfs_fopen( path, "wb" );
 	if ( !file_ )
 		RAISE_ERROR( "Couldn't open file for writing" );
 		
@@ -204,7 +204,7 @@
 
 error_t Std_File_Writer::write( const void* p, long s )
 {
-	long result = (long) fwrite( p, 1, s, file_ );
+	long result = (long) vfs_fwrite( p, 1, s, file_ );
 	if ( result != s )
 		RAISE_ERROR( "Couldn't write to file" );
 	return NULL;
@@ -213,7 +213,7 @@
 void Std_File_Writer::close()
 {
 	if ( file_ ) {
-		fclose( file_ );
+		vfs_fclose( file_ );
 		file_ = NULL;
 	}
 }
--- a/Plugins/Input/console/abstract_file.h	Fri Sep 15 21:36:31 2006 -0700
+++ b/Plugins/Input/console/abstract_file.h	Sat Sep 16 07:18:18 2006 -0700
@@ -5,6 +5,7 @@
 #define ABSTRACT_FILE_H
 
 #include <stdio.h>
+#include "libaudacious/vfs.h"
 
 // Supports reading and finding out how many bytes are remaining
 class Data_Reader {
@@ -78,22 +79,22 @@
 	error_t seek( long );
 };
 
-// File reader based on C FILE
+// File reader based on C VFSFile*
 class Std_File_Reader : public File_Reader {
-	FILE* file_;
+	VFSFile* file_;
 protected:
-	void reset( FILE* f ) { file_ = f; }
-	//FILE* owned_file;
+	void reset( VFSFile* f ) { file_ = f; }
+	//VFSFile* owned_file;
 public:
 	Std_File_Reader();
 	~Std_File_Reader();
 	
 	error_t open( const char* );
 	
-	FILE* file() const { return file_; }
+	VFSFile* file() const { return file_; }
 	
 	// Forward read requests to file. Caller must close file later.
-	//void forward( FILE* );
+	//void forward( VFSFile* );
 	
 	long size() const;
 	long read_avail( void*, long );
@@ -123,19 +124,19 @@
 };
 
 class Std_File_Writer : public Data_Writer {
-	FILE* file_;
+	VFSFile* file_;
 protected:
-	void reset( FILE* f ) { file_ = f; }
+	void reset( VFSFile* f ) { file_ = f; }
 public:
 	Std_File_Writer();
 	~Std_File_Writer();
 	
 	error_t open( const char* );
 	
-	FILE* file() const { return file_; }
+	VFSFile* file() const { return file_; }
 	
 	// Forward writes to file. Caller must close file later.
-	//void forward( FILE* );
+	//void forward( VFSFile* );
 	
 	error_t write( const void*, long );