/src/zziplib/zzip/fseeko.h
C++ Header | 129 lines | 95 code | 19 blank | 15 comment | 0 complexity | 825d301e9e11cfdb8afc98d605a7ef1c MD5 | raw file
1#ifndef _ZZIP_FSEEKO_H_ 2#define _ZZIP_FSEEKO_H_ 3/* 4 * NOTE: this is part of libzzipfseeko (i.e. it is not libzzip). 5 * 6 * simplified zip disk access using fseeko on a stdio FILE handle 7 * 8 * Author: 9 * Guido Draheim <guidod@gmx.de> 10 * 11 * Copyright (c) 2003,2004 Guido Draheim 12 * All rights reserved, 13 * use under the restrictions of the 14 * Lesser GNU General Public License 15 * or alternatively the restrictions 16 * of the Mozilla Public License 1.1 17 */ 18 19 20#include <zzip/types.h> 21#include <stdio.h> 22 23#ifdef _ZZIP_ENTRY_STRUCT 24#include <zlib.h> 25#include <zzip/format.h> 26#endif 27 28#ifdef __cplusplus 29extern "C" { 30#endif 31 32typedef struct zzip_entry ZZIP_ENTRY; 33typedef struct zzip_entry_file ZZIP_ENTRY_FILE; 34 35typedef int (*zzip_strcmp_fn_t)(char*, char*); 36typedef int (*zzip_fnmatch_fn_t)(char*, char*, int); 37 38#ifndef zzip_entry_extern 39#define zzip_entry_extern extern 40#endif 41 42zzip_entry_extern zzip_off_t 43zzip_entry_data_offset(ZZIP_ENTRY* entry); 44 45zzip__new__ 46zzip_entry_extern ZZIP_ENTRY* 47zzip_entry_findfirst(FILE* file); 48 49zzip__new__ 50zzip_entry_extern ZZIP_ENTRY* 51zzip_entry_findnext(ZZIP_ENTRY* _zzip_restrict entry); 52 53#define zzip_entry_findlast zzip_entry_free 54#define zzip_entry_findlastfile zzip_entry_free 55#define zzip_entry_findlastmatch zzip_entry_free 56 57zzip_entry_extern int 58zzip_entry_free(ZZIP_ENTRY* entry); 59 60zzip__new__ 61zzip_entry_extern char* 62zzip_entry_strdup_name(ZZIP_ENTRY* entry); 63zzip_entry_extern char* 64zzip_entry_to_data(ZZIP_ENTRY* entry); 65 66zzip__new__ 67zzip_entry_extern ZZIP_ENTRY* 68zzip_entry_findfile(FILE* disk, char* filename, 69 ZZIP_ENTRY* _zzip_restrict old, 70 zzip_strcmp_fn_t compare); 71zzip__new__ 72zzip_entry_extern ZZIP_ENTRY* 73zzip_entry_findmatch(FILE* disk, char* filespec, 74 ZZIP_ENTRY* _zzip_restrict old, 75 zzip_fnmatch_fn_t compare, int flags); 76zzip__new__ 77zzip_entry_extern ZZIP_ENTRY_FILE* 78zzip_entry_fopen (ZZIP_ENTRY* entry, int takeover); 79 80zzip__new__ 81zzip_entry_extern ZZIP_ENTRY_FILE* 82zzip_entry_ffile (FILE* disk, char* filename); 83 84zzip_entry_extern _zzip_size_t 85zzip_entry_fread (void* ptr, _zzip_size_t size, _zzip_size_t nmemb, 86 ZZIP_ENTRY_FILE* file); 87zzip_entry_extern int 88zzip_entry_fclose (ZZIP_ENTRY_FILE* file); 89int 90zzip_entry_feof (ZZIP_ENTRY_FILE* file); 91 92# ifdef _ZZIP_ENTRY_STRUCT 93# ifdef __cplusplus 94# define __zzip_entry_extends_zzip_disk_entry 95struct zzip_entry : public struct zzip_disk_entry 96{ 97 char* _zzip_restrict tail; 98 zzip_off_t tailalloc; /* the allocated size of tail */ 99 FILE* diskfile; /* a file reference */ 100 zzip_off_t disksize; /* the size of the file */ 101 zzip_off_t headseek; /* the offset within the file */ 102 zzip_off_t zz_usize; 103 zzip_off_t zz_csize; /* items scanned from header */ 104 zzip_off_t zz_offset; /* or zip64 extension block */ 105 int zz_diskstart; 106}; 107# else 108struct zzip_entry /* : struct zzip_disk_entry */ 109{ 110 struct zzip_disk_entry head; 111 char* _zzip_restrict tail; 112 zzip_off_t tailalloc; /* the allocated size of tail */ 113 FILE* diskfile; /* a file reference */ 114 zzip_off_t disksize; /* the size of the file */ 115 zzip_off_t headseek; /* the offset within the file */ 116 zzip_off_t zz_usize; 117 zzip_off_t zz_csize; /* items scanned from header */ 118 zzip_off_t zz_offset; /* or zip64 extension block */ 119 int zz_diskstart; 120}; 121# endif /* __cplusplus */ 122# endif /* _ZZIP_MEM_ENTRY_PRIVATE */ 123 124#ifdef __cplusplus 125extern "C" { 126} 127#endif 128#endif 129