changeset 234:88465b96e4b3 trunk

[svn] - VFS support
author nenolod
date Tue, 07 Nov 2006 01:55:13 -0800
parents 7b7660c9f31c
children 964ad0acc33f
files ChangeLog src/modplug/archive/Makefile src/modplug/archive/arch_raw.cxx src/modplug/archive/arch_raw.h
diffstat 4 files changed, 22 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Nov 07 00:35:18 2006 -0800
+++ b/ChangeLog	Tue Nov 07 01:55:13 2006 -0800
@@ -1,3 +1,12 @@
+2006-11-07 08:35:18 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [480]
+  - rewrite to take advantage of already existant object-oriented framework
+  - add VFS support
+  
+  trunk/src/wavpack/libwavpack.cxx |  101 ++++++++++++++++++++++++++++++++-------
+  1 file changed, 83 insertions(+), 18 deletions(-)
+
+
 2006-11-07 08:07:11 +0000  William Pitcock <nenolod@nenolod.net>
   revision [476]
   - put musepack support back
--- a/src/modplug/archive/Makefile	Tue Nov 07 00:35:18 2006 -0800
+++ b/src/modplug/archive/Makefile	Tue Nov 07 01:55:13 2006 -0800
@@ -1,7 +1,7 @@
 include ../../../mk/rules.mk
 include ../../../mk/init.mk
 
-CXXFLAGS += $(PICFLAGS) -I../../..
+CXXFLAGS += $(PICFLAGS) -I../../.. $(GTK_CFLAGS) $(AUDACIOUS_CFLAGS)
 
 OBJECTIVE_LIBS_NOINST = libarchive.a
 
--- a/src/modplug/archive/arch_raw.cxx	Tue Nov 07 00:35:18 2006 -0800
+++ b/src/modplug/archive/arch_raw.cxx	Tue Nov 07 01:55:13 2006 -0800
@@ -16,36 +16,26 @@
 
 arch_Raw::arch_Raw(const string& aFileName)
 {
-	mFileDesc = open(aFileName.c_str(), O_RDONLY);
-
-	struct stat lStat;
+	mFileDesc = vfs_fopen(aFileName.c_str(), "rb");
 
 	//open and mmap the file
-	if(mFileDesc == -1)
+	if(mFileDesc == NULL)
 	{
 		mSize = 0;
 		return;
 	}
-	fstat(mFileDesc, &lStat);
-	mSize = lStat.st_size;
+	mSize = vfs_ftell(mFileDesc);
 
-	mMap =
-		(uchar*)mmap(0, mSize, PROT_READ,
-		MAP_PRIVATE, mFileDesc, 0);
-	if(!mMap)
-	{
-		close(mFileDesc);
-		mSize = 0;
-		return;
-	}
+	mMap = malloc(mSize);
+	vfs_fread(mMap, 0, mSize, mFileDesc);
 }
 
 arch_Raw::~arch_Raw()
 {
 	if(mSize != 0)
 	{
-		munmap(mMap, mSize);
-		close(mFileDesc);
+		free(mMap);
+		vfs_fclose(mFileDesc);
 	}
 }
 
--- a/src/modplug/archive/arch_raw.h	Tue Nov 07 00:35:18 2006 -0800
+++ b/src/modplug/archive/arch_raw.h	Tue Nov 07 01:55:13 2006 -0800
@@ -10,9 +10,13 @@
 #include "archive.h"
 #include <string>
 
+extern "C" {
+#include <audacious/vfs.h>
+};
+
 class arch_Raw: public Archive
 {
-	int mFileDesc;
+	VFSFile *mFileDesc;
 
 public:
 	arch_Raw(const string& aFileName);