26 #define BUFSIZE (256 * 1024)
47 size = (size + 0xFF) & ~0xFF;
49 if (size >
sizeof p->
buffer)
63 int readed = (size > 0) ?
MIN (count, (p->
filled - p->
at) / size) : 0;
64 memcpy (buffer, p->
buffer + p->
at, size * readed);
66 p->
at += size * readed;
86 if (whence == SEEK_END)
89 if (whence == SEEK_CUR)
92 if (offset < 0 || offset >
sizeof p->
buffer)
151 .vfs_fopen_impl =
NULL,
178 return vfs_new (filename, & probe_buffer_table, p);
static int64_t probe_buffer_ftell(VFSFile *file)
EXPORT bool_t vfs_feof(VFSFile *file)
Returns whether or not the VFS stream has reached EOF.
static int64_t probe_buffer_fread(void *buffer, int64_t size, int64_t count, VFSFile *file)
EXPORT int vfs_fclose(VFSFile *file)
Closes a VFS stream and destroys a VFSFile object.
EXPORT VFSFile * vfs_new(const char *path, VFSConstructor *vtable, void *handle)
static int probe_buffer_fseek(VFSFile *file, int64_t offset, int whence)
static int probe_buffer_fclose(VFSFile *file)
static void increase_buffer(ProbeBuffer *p, int64_t size)
static int64_t probe_buffer_fwrite(const void *data, int64_t size, int64_t count, VFSFile *file)
static void probe_buffer_rewind(VFSFile *file)
EXPORT int64_t vfs_fread(void *ptr, int64_t size, int64_t nmemb, VFSFile *file)
Reads from a VFS stream.
EXPORT void * vfs_get_handle(VFSFile *file)
static char * probe_buffer_get_metadata(VFSFile *file, const char *field)
EXPORT VFSFile * vfs_fopen(const char *path, const char *mode)
Opens a stream from a VFS transport using one of the registered VFSConstructor handlers.
VFSFile * probe_buffer_new(const char *filename)
static int probe_buffer_ftruncate(VFSFile *file, int64_t size)
EXPORT char * vfs_get_metadata(VFSFile *file, const char *field)
Returns metadata about the stream.
static int probe_buffer_ungetc(int c, VFSFile *file)
static VFSConstructor probe_buffer_table
static int64_t probe_buffer_fsize(VFSFile *file)
unsigned char buffer[BUFSIZE]
EXPORT int64_t vfs_fsize(VFSFile *file)
Returns size of the file.
static bool_t probe_buffer_feof(VFSFile *file)
static int probe_buffer_getc(VFSFile *file)