summaryrefslogtreecommitdiff
path: root/plugins/ao/main.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-05-07 11:22:41 +0200
committerGravatar waker <wakeroid@gmail.com>2011-05-07 11:22:41 +0200
commitda5345e0386a9f6fa182545a4334b03cf8ccc33c (patch)
tree57d9a2cc78ea6eb24f00f4c179bc70890aec9c6f /plugins/ao/main.c
parente773e777343ce971d80c55522b293d83cddae478 (diff)
ao: fixed reading aux psf libs from archives
Diffstat (limited to 'plugins/ao/main.c')
-rw-r--r--plugins/ao/main.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/plugins/ao/main.c b/plugins/ao/main.c
index a3c7bdc4..18067410 100644
--- a/plugins/ao/main.c
+++ b/plugins/ao/main.c
@@ -27,12 +27,14 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <deadbeef/deadbeef.h>
#include "ao.h"
#include "eng_protos.h"
//#define trace(...) { fprintf(stderr, __VA_ARGS__); }
#define trace(fmt,...)
+extern DB_functions_t *deadbeef;
/* file types */
static uint32 type;
@@ -63,30 +65,30 @@ int ao_get_lib(char *filename, uint8 **buffer, uint64 *length)
{
uint8 *filebuf;
uint32 size;
- FILE *auxfile;
+ DB_FILE *auxfile;
- auxfile = fopen(filename, "rb");
+ auxfile = deadbeef->fopen(filename);
if (!auxfile)
{
fprintf(stderr, "Unable to find auxiliary file %s\n", filename);
return AO_FAIL;
}
- fseek(auxfile, 0, SEEK_END);
- size = ftell(auxfile);
- fseek(auxfile, 0, SEEK_SET);
+ deadbeef->fseek(auxfile, 0, SEEK_END);
+ size = deadbeef->ftell(auxfile);
+ deadbeef->fseek(auxfile, 0, SEEK_SET);
filebuf = malloc(size);
if (!filebuf)
{
- fclose(auxfile);
+ deadbeef->fclose(auxfile);
printf("ERROR: could not allocate %d bytes of memory\n", size);
return AO_FAIL;
}
- fread(filebuf, size, 1, auxfile);
- fclose(auxfile);
+ deadbeef->fread(filebuf, size, 1, auxfile);
+ deadbeef->fclose(auxfile);
*buffer = filebuf;
*length = (uint64)size;