34 #include "os/file_access.h" 35 #include "os/copymem.h" 38 static void* zipio_open(
void* data,
const char* p_fname,
int mode) {
43 fname.parse_utf8(p_fname);
45 if (mode & ZLIB_FILEFUNC_MODE_WRITE) {
46 f = FileAccess::open(fname,FileAccess::WRITE);
49 f = FileAccess::open(fname,FileAccess::READ);
59 static uLong zipio_read(
void* data,
void* fdata,
void* buf, uLong size) {
66 static uLong zipio_write(voidpf opaque, voidpf stream,
const void* buf, uLong size) {
74 static long zipio_tell (voidpf opaque, voidpf stream) {
80 static long zipio_seek(voidpf opaque, voidpf stream, uLong offset,
int origin) {
87 case ZLIB_FILEFUNC_SEEK_CUR:
90 case ZLIB_FILEFUNC_SEEK_END:
101 static int zipio_close(voidpf opaque, voidpf stream) {
111 static int zipio_testerror(voidpf opaque, voidpf stream) {
119 static voidpf zipio_alloc(voidpf opaque, uInt items, uInt size) {
121 voidpf ptr =memalloc(items*size);
122 zeromem(ptr,items*size);
127 static void zipio_free(voidpf opaque, voidpf address) {
137 io.zopen_file = zipio_open;
138 io.zread_file = zipio_read;
139 io.zwrite_file = zipio_write;
140 io.ztell_file = zipio_tell;
141 io.zseek_file = zipio_seek;
142 io.zclose_file = zipio_close;
143 io.zerror_file = zipio_testerror;
144 io.alloc_mem=zipio_alloc;
145 io.free_mem=zipio_free;
virtual size_t get_len() const =0
get size of the file
virtual size_t get_pos() const =0
get position in the file
virtual void store_buffer(const uint8_t *p_src, int p_length)
store an array of bytes
Definition: file_access.cpp:465
virtual void seek(size_t p_position)=0
seek to a given position
Definition: file_access.h:40
virtual int get_buffer(uint8_t *p_dst, int p_length) const
get an array of bytes
Definition: file_access.cpp:335
virtual void close()=0
close a file
virtual Error get_error() const =0
get last error