summaryrefslogtreecommitdiff
path: root/vfs_stdio.c
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-09-29 22:47:50 +0200
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-09-29 22:47:50 +0200
commitfc2689bbd0af9323a366d6fe6b37f613e28fc53f (patch)
tree32cef377a22338d1bde1e26d32e0313318651550 /vfs_stdio.c
parent7ad596b7eb25cc2ab18b439d6159b0e12205c2f5 (diff)
vfs_curl WIP
Diffstat (limited to 'vfs_stdio.c')
-rw-r--r--vfs_stdio.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/vfs_stdio.c b/vfs_stdio.c
index bc0f1183..9d63c141 100644
--- a/vfs_stdio.c
+++ b/vfs_stdio.c
@@ -20,6 +20,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
+#include <string.h>
static DB_functions_t *deadbeef;
typedef struct {
@@ -29,8 +30,11 @@ typedef struct {
static DB_vfs_t plugin;
-DB_FILE *
+static DB_FILE *
stdio_open (const char *fname) {
+ if (!memcmp (fname, "file://", 7)) {
+ fname += 7;
+ }
FILE *file = fopen (fname, "rb");
if (!file) {
return NULL;
@@ -41,32 +45,33 @@ stdio_open (const char *fname) {
return (DB_FILE*)fp;
}
-void
+static void
stdio_close (DB_FILE *stream) {
assert (stream);
fclose (((STDIO_FILE *)stream)->stream);
free (stream);
}
-size_t stdio_read (void *ptr, size_t size, size_t nmemb, DB_FILE *stream) {
+static size_t
+stdio_read (void *ptr, size_t size, size_t nmemb, DB_FILE *stream) {
assert (stream);
assert (ptr);
return fread (ptr, size, nmemb, ((STDIO_FILE *)stream)->stream);
}
-int
+static int
stdio_seek (DB_FILE *stream, long offset, int whence) {
assert (stream);
return fseek (((STDIO_FILE *)stream)->stream, offset, whence);
}
-long
+static long
stdio_tell (DB_FILE *stream) {
assert (stream);
return ftell (((STDIO_FILE *)stream)->stream);
}
-void
+static void
stdio_rewind (DB_FILE *stream) {
assert (stream);
rewind (((STDIO_FILE *)stream)->stream);