changeset 1663:726fb8286a82 trunk

[svn] Use the VFS layer.
author chainsaw
date Sun, 10 Sep 2006 14:01:14 -0700
parents f9593a065464
children 3dc347b350ee
files ChangeLog Plugins/Input/sexypsf/Misc.c
diffstat 2 files changed, 24 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Sun Sep 10 12:19:35 2006 -0700
+++ b/ChangeLog	Sun Sep 10 14:01:14 2006 -0700
@@ -1,3 +1,12 @@
+2006-09-10 19:19:35 +0000  Tony Vroon <chainsaw@gentoo.org>
+  revision [2261]
+  Portability fix provided by Matti H?\195?\164m?\195?\164l?\195?\164inen (ccr/TNSP).
+
+  Changes:        Modified:
+  +136 -113       trunk/Plugins/Input/sid/xs_length.c  
+  +8 -9           trunk/Plugins/Input/sid/xs_length.h  
+
+
 2006-09-10 13:40:15 +0000  Tony Vroon <chainsaw@gentoo.org>
   revision [2259]
   Non-RTSP should compile too, ktnxbye.
--- a/Plugins/Input/sexypsf/Misc.c	Sun Sep 10 12:19:35 2006 -0700
+++ b/Plugins/Input/sexypsf/Misc.c	Sun Sep 10 14:01:14 2006 -0700
@@ -16,6 +16,7 @@
  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include "libaudacious/vfs.h"
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -224,7 +225,7 @@
 
 static PSFINFO *LoadPSF(char *path, int level, int type) // Type==1 for just info load.
 {
-        FILE *fp;
+        VFSFile *fp;
         EXE_HEADER tmpHead;
         unsigned char *in,*out=0;
 	u8 head[4];
@@ -235,13 +236,13 @@
 	PSFINFO *psfi;
 	PSFINFO *tmpi;
 
-        if(!(fp=fopen(path,"rb")))
+        if(!(fp=vfs_fopen(path,"rb")))
  	{
          printf("path %s failed to load\n", path);
 	 return(0);
 	}
  
-	fread(head,1,4,fp);
+	vfs_fread(head,1,4,fp);
 	if(memcmp(head,"PSF\x01",4)) return(0);
 
 	psfi=malloc(sizeof(PSFINFO));
@@ -249,22 +250,22 @@
         psfi->stop=~0;
         psfi->fade=0; 
 
-        fread(&reserved,1,4,fp);
-        fread(&complen,1,4,fp);
+        vfs_fread(&reserved,1,4,fp);
+        vfs_fread(&complen,1,4,fp);
 	complen=BFLIP32(complen);
 
-        fread(&crc32,1,4,fp);
+        vfs_fread(&crc32,1,4,fp);
 	crc32=BFLIP32(crc32);
 
-        fseek(fp,reserved,SEEK_CUR);
+        vfs_fseek(fp,reserved,SEEK_CUR);
 
         if(type)
-	 fseek(fp,complen,SEEK_CUR);
+	 vfs_fseek(fp,complen,SEEK_CUR);
         else
         {
          in=malloc(complen);
          out=malloc(1024*1024*2+0x800);
-         fread(in,1,complen,fp);
+         vfs_fread(in,1,complen,fp);
          outlen=1024*1024*2;
          uncompress(out,&outlen,in,complen);
          free(in);
@@ -283,13 +284,13 @@
 
         {
          u8 tagdata[5];
-         if(fread(tagdata,1,5,fp)==5)
+         if(vfs_fread(tagdata,1,5,fp)==5)
          {
           if(!memcmp(tagdata,"[TAG]",5))
           {
            char linebuf[1024];
 
-           while(fgets(linebuf,1024,fp))
+           while(vfs_fgets(linebuf,1024,fp))
            {
             int x;
 	    char *key=0,*value=0;
@@ -331,7 +332,7 @@
 	      free(value);
 	      free(tmpfn);
  	      if(!level) free(out);
-	      fclose(fp);
+	      vfs_fclose(fp);
 	      FreeTags(psfi->tags);
 	      free(psfi);
 	      return(0);
@@ -345,7 +346,7 @@
          }
         }  
 
-        fclose(fp);
+        vfs_fclose(fp);
 
 	/* Now, if we're at level 0(main PSF), load the main executable, and any libN stuff */
         if(!level && !type)
@@ -405,7 +406,7 @@
             //free(key);
             //free(value);
             //free(tmpfn);
-            //fclose(fp);
+            //vfs_fclose(fp);
             //return(0);
            }
            free(tmpfn);