diff options
| author | Joel Bodenmann <joel@unormal.org> | 2014-04-20 10:41:53 +0200 |
|---|---|---|
| committer | Joel Bodenmann <joel@unormal.org> | 2014-04-20 10:41:53 +0200 |
| commit | c88e25b84fa8d18942df56592cec68f8371a8d41 (patch) | |
| tree | 0c13a89e07560b79ea0092a25f75b7cf630a903f /src/gfile/inc_romfs.c | |
| parent | ad1d70d2957d95161c831e764c6f81c84c332458 (diff) | |
| parent | 33babb4c1a5b749faac6969681e8deff481c4344 (diff) | |
| download | uGFX-c88e25b84fa8d18942df56592cec68f8371a8d41.tar.gz uGFX-c88e25b84fa8d18942df56592cec68f8371a8d41.tar.bz2 uGFX-c88e25b84fa8d18942df56592cec68f8371a8d41.zip | |
Merge branch 'master' of https://bitbucket.org/Tectu/ugfx into gwin
Diffstat (limited to 'src/gfile/inc_romfs.c')
| -rw-r--r-- | src/gfile/inc_romfs.c | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/src/gfile/inc_romfs.c b/src/gfile/inc_romfs.c index 49c1b173..3510a261 100644 --- a/src/gfile/inc_romfs.c +++ b/src/gfile/inc_romfs.c @@ -56,7 +56,8 @@ static const GFILEVMT FsROMVMT = { #undef GFILE_CHAINHEAD #define GFILE_CHAINHEAD &FsROMVMT -static const ROMFS_DIRENTRY *ROMFindFile(const char *fname) { +static const ROMFS_DIRENTRY *ROMFindFile(const char *fname) +{ const ROMFS_DIRENTRY *p; for(p = FsROMHead; p; p = p->next) { @@ -65,22 +66,36 @@ static const ROMFS_DIRENTRY *ROMFindFile(const char *fname) { } return p; } -static bool_t ROMExists(const char *fname) { return ROMFindFile(fname) != 0; } -static long int ROMFilesize(const char *fname) { + +static bool_t ROMExists(const char *fname) +{ + return ROMFindFile(fname) != 0; +} + +static long int ROMFilesize(const char *fname) +{ const ROMFS_DIRENTRY *p; if (!(p = ROMFindFile(fname))) return -1; return p->size; } -static bool_t ROMOpen(GFILE *f, const char *fname) { + +static bool_t ROMOpen(GFILE *f, const char *fname) +{ const ROMFS_DIRENTRY *p; if (!(p = ROMFindFile(fname))) return FALSE; f->obj = (void *)p; return TRUE; } -static void ROMClose(GFILE *f) { (void)f; } -static int ROMRead(GFILE *f, void *buf, int size) { + +static void ROMClose(GFILE *f) +{ + (void)f; +} + +static int ROMRead(GFILE *f, void *buf, int size) +{ const ROMFS_DIRENTRY *p; p = (const ROMFS_DIRENTRY *)f->obj; @@ -90,6 +105,18 @@ static int ROMRead(GFILE *f, void *buf, int size) { memcpy(buf, p->file+f->pos, size); return size; } -static bool_t ROMSetpos(GFILE *f, long int pos) { return pos <= ((const ROMFS_DIRENTRY *)f->obj)->size; } -static long int ROMGetsize(GFILE *f) { return ((const ROMFS_DIRENTRY *)f->obj)->size; } -static bool_t ROMEof(GFILE *f) { return f->pos >= ((const ROMFS_DIRENTRY *)f->obj)->size; } + +static bool_t ROMSetpos(GFILE *f, long int pos) +{ + return pos <= ((const ROMFS_DIRENTRY *)f->obj)->size; +} + +static long int ROMGetsize(GFILE *f) +{ + return ((const ROMFS_DIRENTRY *)f->obj)->size; +} + +static bool_t ROMEof(GFILE *f) +{ + return f->pos >= ((const ROMFS_DIRENTRY *)f->obj)->size; +} |
