Mercurial > audlegacy
changeset 480:c1dfb4b13be8 trunk
[svn] Use the VFS layer.
author | chainsaw |
---|---|
date | Sat, 21 Jan 2006 07:12:02 -0800 |
parents | 0b9507985f0d |
children | bb3698dfd455 |
files | Plugins/Input/timidity/libtimidity/Makefile.am Plugins/Input/timidity/libtimidity/common.c Plugins/Input/timidity/libtimidity/common.h Plugins/Input/timidity/libtimidity/instrum.c Plugins/Input/timidity/libtimidity/mix.c Plugins/Input/timidity/libtimidity/playmidi.c Plugins/Input/timidity/libtimidity/readmidi.c Plugins/Input/timidity/libtimidity/resample.c Plugins/Input/timidity/libtimidity/stream.c Plugins/Input/timidity/libtimidity/tables.c Plugins/Input/timidity/libtimidity/timidity.c Plugins/Input/timidity/libtimidity/timidity.h |
diffstat | 12 files changed, 39 insertions(+), 37 deletions(-) [+] |
line wrap: on
line diff
--- a/Plugins/Input/timidity/libtimidity/Makefile.am Sat Jan 21 06:32:50 2006 -0800 +++ b/Plugins/Input/timidity/libtimidity/Makefile.am Sat Jan 21 07:12:02 2006 -0800 @@ -26,3 +26,5 @@ timidity.c \ timidity.h \ timidity_internal.h + +INCLUDES = $(GTK_CFLAGS) -I$(top_builddir)/intl -I$(top_srcdir)
--- a/Plugins/Input/timidity/libtimidity/common.c Sat Jan 21 06:32:50 2006 -0800 +++ b/Plugins/Input/timidity/libtimidity/common.c Sat Jan 21 07:12:02 2006 -0800 @@ -25,7 +25,7 @@ # include <config.h> #endif -#include <stdio.h> +#include "libaudacious/vfs.h" #include <stdlib.h> #include <string.h> @@ -41,9 +41,9 @@ static PathList *pathlist = NULL; /* This is a linked list */ /* This is meant to find and open files for reading */ -FILE *open_file(char *name) +VFSFile *open_file(char *name) { - FILE *fp; + VFSFile *fp; if (!name || !(*name)) { @@ -54,7 +54,7 @@ /* First try the given name */ DEBUG_MSG("Trying to open %s\n", name); - if ((fp = fopen(name, OPEN_MODE))) + if ((fp = vfs_fopen(name, OPEN_MODE))) return fp; if (name[0] != PATH_SEP) @@ -78,7 +78,7 @@ } strcat(current_filename, name); DEBUG_MSG("Trying to open %s\n", current_filename); - if ((fp = fopen(current_filename, OPEN_MODE))) + if ((fp = vfs_fopen(current_filename, OPEN_MODE))) return fp; plp = plp->next; }
--- a/Plugins/Input/timidity/libtimidity/common.h Sat Jan 21 06:32:50 2006 -0800 +++ b/Plugins/Input/timidity/libtimidity/common.h Sat Jan 21 07:12:02 2006 -0800 @@ -26,7 +26,7 @@ void *next; } PathList; -extern FILE *open_file(char *name); +extern VFSFile *open_file(char *name); extern void add_to_pathlist(char *s); extern void *safe_malloc(size_t count); extern void free_pathlist(void);
--- a/Plugins/Input/timidity/libtimidity/instrum.c Sat Jan 21 06:32:50 2006 -0800 +++ b/Plugins/Input/timidity/libtimidity/instrum.c Sat Jan 21 07:12:02 2006 -0800 @@ -27,7 +27,7 @@ # include <config.h> #endif -#include <stdio.h> +#include "libaudacious/vfs.h" #include <string.h> #include <stdlib.h> @@ -167,7 +167,7 @@ { MidInstrument *ip; MidSample *sp; - FILE *fp; + VFSFile *fp; char tmp[1024]; int i,j,noluck=0; static char *patch_ext[] = PATCH_EXT_LIST; @@ -205,7 +205,7 @@ /* Read some headers and do cursory sanity checks. There are loads of magic offsets. This could be rewritten... */ - if ((239 != fread(tmp, 1, 239, fp)) || + if ((239 != vfs_fread(tmp, 1, 239, fp)) || (memcmp(tmp, "GF1PATCH110\0ID#000002", 22) && memcmp(tmp, "GF1PATCH100\0ID#000002", 22))) /* don't know what the differences are */ @@ -239,18 +239,18 @@ uint8 tmpchar; #define READ_CHAR(thing) \ - if (1 != fread(&tmpchar, 1, 1, fp)) goto fail; \ + if (1 != vfs_fread(&tmpchar, 1, 1, fp)) goto fail; \ thing = tmpchar; #define READ_SHORT(thing) \ - if (1 != fread(&tmpshort, 2, 1, fp)) goto fail; \ + if (1 != vfs_fread(&tmpshort, 2, 1, fp)) goto fail; \ thing = SWAPLE16(tmpshort); #define READ_LONG(thing) \ - if (1 != fread(&tmplong, 4, 1, fp)) goto fail; \ + if (1 != vfs_fread(&tmplong, 4, 1, fp)) goto fail; \ thing = SWAPLE32(tmplong); - fseek(fp, 7, SEEK_CUR); /* Skip the wave name */ + vfs_fseek(fp, 7, SEEK_CUR); /* Skip the wave name */ - if (1 != fread(&fractions, 1, 1, fp)) + if (1 != vfs_fread(&fractions, 1, 1, fp)) { fail: DEBUG_MSG("Error reading sample %d\n", i); @@ -272,7 +272,7 @@ READ_LONG(sp->root_freq); sp->low_vel = 0; sp->high_vel = 127; - fseek(fp, 2, SEEK_CUR); /* Why have a "root frequency" and then + vfs_fseek(fp, 2, SEEK_CUR); /* Why have a "root frequency" and then * "tuning"?? */ READ_CHAR(tmp[0]); @@ -283,7 +283,7 @@ sp->panning=(uint8)(panning & 0x7F); /* envelope, tremolo, and vibrato */ - if (18 != fread(tmp, 1, 18, fp)) goto fail; + if (18 != vfs_fread(tmp, 1, 18, fp)) goto fail; if (!tmp[13] || !tmp[14]) { @@ -321,7 +321,7 @@ READ_CHAR(sp->modes); - fseek(fp, 40, SEEK_CUR); /* skip the useless scale frequency, scale + vfs_fseek(fp, 40, SEEK_CUR); /* skip the useless scale frequency, scale factor (what's it mean?), and reserved space */ @@ -393,7 +393,7 @@ /* Then read the sample data */ sp->data = safe_malloc(sp->data_length); - if (1 != fread(sp->data, sp->data_length, 1, fp)) + if (1 != vfs_fread(sp->data, sp->data_length, 1, fp)) goto fail; if (!(sp->modes & MODES_16BIT)) /* convert to 16-bit data */ @@ -508,7 +508,7 @@ } } - fclose(fp); + vfs_fclose(fp); return ip; }
--- a/Plugins/Input/timidity/libtimidity/mix.c Sat Jan 21 06:32:50 2006 -0800 +++ b/Plugins/Input/timidity/libtimidity/mix.c Sat Jan 21 07:12:02 2006 -0800 @@ -25,8 +25,8 @@ # include <config.h> #endif +#include "libaudacious/vfs.h" #include <math.h> -#include <stdio.h> #include <stdlib.h> #include "timidity.h"
--- a/Plugins/Input/timidity/libtimidity/playmidi.c Sat Jan 21 06:32:50 2006 -0800 +++ b/Plugins/Input/timidity/libtimidity/playmidi.c Sat Jan 21 07:12:02 2006 -0800 @@ -25,7 +25,7 @@ # include <config.h> #endif -#include <stdio.h> +#include "libaudacious/vfs.h" #include <stdlib.h> #include <string.h>
--- a/Plugins/Input/timidity/libtimidity/readmidi.c Sat Jan 21 06:32:50 2006 -0800 +++ b/Plugins/Input/timidity/libtimidity/readmidi.c Sat Jan 21 07:12:02 2006 -0800 @@ -23,7 +23,7 @@ # include <config.h> #endif -#include <stdio.h> +#include "libaudacious/vfs.h" #include <stdlib.h> #include <string.h>
--- a/Plugins/Input/timidity/libtimidity/resample.c Sat Jan 21 06:32:50 2006 -0800 +++ b/Plugins/Input/timidity/libtimidity/resample.c Sat Jan 21 07:12:02 2006 -0800 @@ -24,8 +24,8 @@ # include <config.h> #endif +#include "libaudacious/vfs.h" #include <math.h> -#include <stdio.h> #include <stdlib.h> #include "timidity.h"
--- a/Plugins/Input/timidity/libtimidity/stream.c Sat Jan 21 06:32:50 2006 -0800 +++ b/Plugins/Input/timidity/libtimidity/stream.c Sat Jan 21 07:12:02 2006 -0800 @@ -17,14 +17,14 @@ typedef struct StdIOContext { - FILE *fp; + VFSFile *fp; int autoclose; } StdIOContext; size_t stdio_istream_read (void *ctx, void *ptr, size_t size, size_t nmemb) { - return fread (ptr, size, nmemb, ((StdIOContext *) ctx)->fp); + return vfs_fread (ptr, size, nmemb, ((StdIOContext *) ctx)->fp); } int @@ -32,7 +32,7 @@ { int ret = 0; if (((StdIOContext *) ctx)->autoclose) - ret = fclose (((StdIOContext *) ctx)->fp); + ret = vfs_fclose (((StdIOContext *) ctx)->fp); free (ctx); return ret; } @@ -73,7 +73,7 @@ } MidIStream * -mid_istream_open_fp (FILE * fp, int autoclose) +mid_istream_open_fp (VFSFile * fp, int autoclose) { StdIOContext *ctx; MidIStream *stream; @@ -101,9 +101,9 @@ MidIStream * mid_istream_open_file (const char *file) { - FILE *fp; + VFSFile *fp; - fp = fopen (file, "rb"); + fp = vfs_fopen (file, "rb"); if (fp == NULL) return NULL;
--- a/Plugins/Input/timidity/libtimidity/tables.c Sat Jan 21 06:32:50 2006 -0800 +++ b/Plugins/Input/timidity/libtimidity/tables.c Sat Jan 21 07:12:02 2006 -0800 @@ -23,7 +23,7 @@ # include <config.h> #endif -#include <stdio.h> +#include "libaudacious/vfs.h" #include "timidity.h" #include "tables.h"
--- a/Plugins/Input/timidity/libtimidity/timidity.c Sat Jan 21 06:32:50 2006 -0800 +++ b/Plugins/Input/timidity/libtimidity/timidity.c Sat Jan 21 07:12:02 2006 -0800 @@ -23,7 +23,7 @@ # include <config.h> #endif -#include <stdio.h> +#include "libaudacious/vfs.h" #include <stdlib.h> #include <string.h> @@ -47,14 +47,14 @@ /* Quick-and-dirty fgets() replacement. */ -static char *__fgets(char *s, int size, FILE *fp) +static char *__fgets(char *s, int size, VFSFile *fp) { int num_read = 0; int newline = 0; while (num_read < size && !newline) { - if (fread(&s[num_read], 1, 1, fp) != 1) + if (vfs_fread(&s[num_read], 1, 1, fp) != 1) break; /* Unlike fgets(), don't store newline. Under Windows/DOS we'll @@ -77,7 +77,7 @@ static int read_config_file(char *name) { - FILE *fp; + VFSFile *fp; char tmp[1024], *w[MAXWORDS], *cp; MidToneBank *bank=0; int i, j, k, line=0, words; @@ -390,7 +390,7 @@ } } } - fclose(fp); + vfs_fclose(fp); return 0; }
--- a/Plugins/Input/timidity/libtimidity/timidity.h Sat Jan 21 06:32:50 2006 -0800 +++ b/Plugins/Input/timidity/libtimidity/timidity.h Sat Jan 21 07:12:02 2006 -0800 @@ -23,7 +23,7 @@ #ifndef TIMIDITY_H #define TIMIDITY_H -#include <stdio.h> +#include "libaudacious/vfs.h" #include <stdlib.h> #ifdef __cplusplus @@ -113,7 +113,7 @@ /* Create input stream from a file pointer */ - extern MidIStream *mid_istream_open_fp (FILE * fp, int autoclose); + extern MidIStream *mid_istream_open_fp (VFSFile *fp, int autoclose); /* Create input stream from memory */