all repos — mgba @ c9ec91b75fa4cb4f1042e930d14dc43bf680df85

mGBA Game Boy Advance Emulator

Forcibly disable some currently unsupported zip operations
Jeffrey Pfau jeffrey@endrift.com
Fri, 18 Jul 2014 00:52:07 -0700
commit

c9ec91b75fa4cb4f1042e930d14dc43bf680df85

parent

2367abe67dae4076ae178a03940daefc42441e49

1 files changed, 13 insertions(+), 2 deletions(-)

jump to
M src/util/vfs-zip.csrc/util/vfs-zip.c

@@ -247,9 +247,20 @@ }

struct VFile* _vdzOpenFile(struct VDir* vd, const char* path, int mode) { UNUSED(mode); - // TODO: support truncating, appending and creating + // TODO: support truncating, appending and creating, and write + struct VDirZip* vdz = (struct VDirZip*) vd; + + if ((mode & O_RDWR) == O_RDWR) { + // libzip doesn't allow for random access, so read/write is impossible without + // reading the entire file first. This approach will be supported eventually. + return 0; + } + + if (mode & O_WRONLY) { + // Write support is not yet implemented. + return 0; + } - struct VDirZip* vdz = (struct VDirZip*) vd; struct zip_stat s; if (zip_stat(vdz->z, path, 0, &s) < 0) { return 0;