From ef0170cb127b976f00d6606d7e1b5c414cc26f7a Mon Sep 17 00:00:00 2001 From: Guido Draheim Date: Fri, 12 Dec 2003 04:16:31 +0000 Subject: [PATCH] This commit was generated by cvs2svn to compensate for changes in r132, which included commits to RCS files with non-trunk default branches. --- SDL/zzip-sdl-rwops.pc | 2 +- zzip/stat.c | 43 +++++++++++++++++++++++++++++++++++++++++++ zzipwrap/zzipwrap.pc | 2 +- 3 files changed, 45 insertions(+), 2 deletions(-) diff --git a/SDL/zzip-sdl-rwops.pc b/SDL/zzip-sdl-rwops.pc index 23a9b3f..6a4b1d0 100644 --- a/SDL/zzip-sdl-rwops.pc +++ b/SDL/zzip-sdl-rwops.pc @@ -2,7 +2,7 @@ zzipdatadir=/usr/local/share/zziplib zzipsdlrwops=${zzipdatadir}/SDL Name: zzip-sdl-rwops -Version: 0.13.23 +Version: 0.13.24 Description: SDL_rwops for ZZipLib Requires: zzip-sdl-config, zziplib Cflags: -I${zzipsdlrwops} diff --git a/zzip/stat.c b/zzip/stat.c index 43b4bfc..0395c67 100644 --- a/zzip/stat.c +++ b/zzip/stat.c @@ -18,7 +18,12 @@ */ #include /* exported...*/ +#include #include +#include + +#define ZZIP_USE_INTERNAL +#include /** * obtain information about a filename in an opened zip-archive without @@ -69,6 +74,44 @@ zzip_dir_stat(ZZIP_DIR * dir, zzip_char_t* name, ZZIP_STAT * zs, int flags) return 0; } +/** => zzip_dir_stat + * This function will obtain information about a opened file _within_ a + * zip-archive. The file is supposed to be open (otherwise -1 is returned). + * The st_size stat-member contains the uncompressed size. The optional + * d_name is never set here. + */ +int zzip_file_stat (ZZIP_FILE* file, ZZIP_STAT* zs) +{ + if (! file) return -1; + zs->d_compr = file->method; + zs->d_csize = file->csize; + zs->st_size = file->usize; + zs->d_name = 0; + return 0; +} + +/** => zzip_dir_stat + * This function will obtain information about a opened file which may be + * either real/zipped. The file is supposed to be open (otherwise -1 is + * returned). The st_size stat-member contains the uncompressed size. + * The optional d_name is never set here. For a real file, we do set the + * d_csize := st_size and d_compr := 0 for meaningful defaults. + */ +int zzip_fstat (ZZIP_FILE* file, ZZIP_STAT* zs) +{ + if (ZZIP_file_real(file)) + { + struct stat st; + if (fstat (file->fd, &st) < 0) return -1; + zs->st_size = st.st_size; + zs->d_csize = st.st_size; + zs->d_compr = 0; + return 0; + }else{ + return zzip_file_stat (file, zs); + } +} + /* * Local variables: * c-file-style: "stroustrup" diff --git a/zzipwrap/zzipwrap.pc b/zzipwrap/zzipwrap.pc index 9702135..2811886 100644 --- a/zzipwrap/zzipwrap.pc +++ b/zzipwrap/zzipwrap.pc @@ -3,7 +3,7 @@ libdir=/usr/local/lib includedir=/usr/local/include Name: zzipwrap -Version: 0.13.23 +Version: 0.13.24 Description: Callback Wrappers for ZZipLib Requires: zziplib Libs: -L${libdir} -lzzipwrap -- 2.40.0