3
* Guido Draheim <guidod@gmx.de>
4
* Mike Nordell <tamlin@algonet.se>
6
* Copyright (c) 2002 Guido Draheim
8
* use under the restrictions of the
9
* Lesser GNU General Public License
10
* note the additional license information
11
* that can be found in COPYING.ZZIP
15
#include "clamav-config.h"
22
#include <sys/types.h> /* njh@bandsman.co.uk: for icc7.0 */
30
#include <zzip-file.h>
31
#include <zzipformat.h>
38
if (fstat(fd, &st) < 0)
42
if (! st.st_size && st.st_blocks > 1) /* seen on some darwin 10.1 machines */
43
fprintf(stderr, "broken fstat(2) ?? st_size=%ld st_blocks=%ld\n",
44
(long) st.st_size, (long) st.st_blocks);
50
#if defined ZZIP_WRAPWRAP
51
int zzip_wrap_read(int fd, void* p, unsigned int len)
52
{ return _zzip_read (fd, p, len); }
53
zzip_off_t zzip_wrap_lseek(int fd, zzip_off_t offset, int whence)
54
{ return _zzip_lseek (fd, offset, whence); }
56
#define zzip_wrap_read _zzip_read
57
#define zzip_wrap_lseek _zzip_lseek
60
static const struct zzip_plugin_io default_io =
64
(int (*)(int, void*, unsigned)) &zzip_wrap_read,
65
(zzip_off_t (*)(int, zzip_off_t, int)) &zzip_wrap_lseek,
66
(zzip_off_t (*)(int)) &zzip_filesize,
71
* This function returns a zzip_plugin_io_t handle to static defaults
72
* wrapping the posix io file functions for actual file access.
81
* This function initializes the users handler struct to default values
82
* being the posix io functions in default configured environments.
84
int zzip_init_io(struct zzip_plugin_io* io, int flags)
89
memcpy(io, &default_io, sizeof(default_io));
96
* c-file-style: "stroustrup"