* Guido Draheim <guidod@gmx.de>
* Tomi Ollila <Tomi.Ollila@iki.fi>
*
- * Copyright (c) 1999,2000,2001,2002,2003 Guido Draheim
- * All rights reserved,
- * use under the restrictions of the
- * Lesser GNU General Public License
- * or alternatively the restrictions
- * of the Mozilla Public License 1.1
+ * Copyright (c) Guido Draheim, use under copyleft (LGPL,MPL)
*/
#include <zzip/lib.h> /* exported... */
*
* This function returns a new zzip-handle (use => zzip_close to return
* it). On error this function will return null setting => errno(3).
+ *
+ * If any ext_io handlers were used then the referenced structure
+ * should be static as the allocated ZZIP_FILE does not copy them.
*/
ZZIP_FILE *
zzip_open_ext_io(zzip_char_t * filename, int o_flags, int o_modes,
{
zzip_plugin_io_t os = (o_modes & ZZIP_ALLOWREAL)
? zzip_get_default_io() : io;
- int fd = os->fd.open(filename, o_flags); /* io->fd.open */
+ int fd = (os->fd.open)(filename, o_flags); /* io->fd.open */
if (fd != -1)
{
return (fp->usize - fp->restlen);
}
+#ifndef EOVERFLOW
+#define EOVERFLOW EFBIG
+#endif
+
+/** => zzip_tell
+ * This function is provided for users who can not use any largefile-mode.
+ */
+long
+zzip_tell32(ZZIP_FILE * fp)
+{
+ if (sizeof(zzip_off_t) == sizeof(long))
+ {
+ return zzip_tell(fp);
+ } else
+ {
+ off_t off = zzip_tell(fp);
+ if (off >= 0) {
+ register long off32 = off;
+ if (off32 == off) return off32;
+ errno = EOVERFLOW;
+ }
+ return -1;
+ }
+}
+
+/** => zzip_seek
+ * This function is provided for users who can not use any largefile-mode.
+ */
+long
+zzip_seek32(ZZIP_FILE * fp, long offset, int whence)
+{
+ if (sizeof(zzip_off_t) == sizeof(long))
+ {
+ return zzip_seek(fp, offset, whence);
+ } else
+ {
+ off_t off = zzip_seek(fp, offset, whence);
+ if (off >= 0) {
+ register long off32 = off;
+ if (off32 == off) return off32;
+ errno = EOVERFLOW;
+ }
+ return -1;
+ }
+}
+
/*
* Local variables:
* c-file-style: "stroustrup"