GDAL
cpl_minizip_ioapi.h
1
2/* Modified version by Even Rouault. :
3 - change fill_fopen_filefunc to cpl_fill_fopen_filefunc
4 - Add support for ZIP64
5
6 * Copyright (c) 2008-2012, Even Rouault <even dot rouault at spatialys.com>
7
8 Original licence available in port/LICENCE_minizip
9*/
10
11/* ioapi.h -- IO base function header for compress/uncompress .zip
12 files using zlib + zip or unzip API
13
14 Version 1.01e, February 12th, 2005
15
16 Copyright (C) 1998-2005 Gilles Vollant
17*/
18
19#ifndef CPL_MINIZIP_IOAPI_H_INCLUDED
20#define CPL_MINIZIP_IOAPI_H_INCLUDED
21
22#ifndef DOXYGEN_SKIP
23
24#include "cpl_vsi.h"
25#include "zlib.h"
26
27#define uLong64 vsi_l_offset
28
29#define ZLIB_FILEFUNC_SEEK_CUR (1)
30#define ZLIB_FILEFUNC_SEEK_END (2)
31#define ZLIB_FILEFUNC_SEEK_SET (0)
32
33#define ZLIB_FILEFUNC_MODE_READ (1)
34#define ZLIB_FILEFUNC_MODE_WRITE (2)
35#define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
36
37#define ZLIB_FILEFUNC_MODE_EXISTING (4)
38#define ZLIB_FILEFUNC_MODE_CREATE (8)
39
40#ifndef ZCALLBACK
41
42#if (defined(_WIN32) || defined(WINDOWS) || defined(_WINDOWS)) && \
43 defined(CALLBACK) && defined(USEWINDOWS_CALLBACK)
44#define ZCALLBACK CALLBACK
45#else
46#define ZCALLBACK
47#endif
48#endif
49
50#ifdef __cplusplus
51extern "C"
52{
53#endif
54
55 typedef voidpf(ZCALLBACK *open_file_func)(voidpf opaque,
56 const char *filename, int mode);
57 typedef uLong(ZCALLBACK *read_file_func)(voidpf opaque, voidpf stream,
58 void *buf, uLong size);
59 typedef uLong(ZCALLBACK *write_file_func)(voidpf opaque, voidpf stream,
60 const void *buf, uLong size);
61 typedef uLong64(ZCALLBACK *tell_file_func)(voidpf opaque, voidpf stream);
62 typedef long(ZCALLBACK *seek_file_func)(voidpf opaque, voidpf stream,
63 uLong64 offset, int origin);
64 typedef int(ZCALLBACK *close_file_func)(voidpf opaque, voidpf stream);
65 typedef int(ZCALLBACK *testerror_file_func)(voidpf opaque, voidpf stream);
66
67 typedef struct zlib_filefunc_def_s
68 {
69 open_file_func zopen_file;
70 read_file_func zread_file;
71 write_file_func zwrite_file;
72 tell_file_func ztell_file;
73 seek_file_func zseek_file;
74 close_file_func zclose_file;
75 testerror_file_func zerror_file;
76 voidpf opaque;
77 } zlib_filefunc_def;
78
79 void cpl_fill_fopen_filefunc(zlib_filefunc_def *pzlib_filefunc_def);
80
81#define ZREAD(filefunc, filestream, buf, size) \
82 ((*((filefunc).zread_file))((filefunc).opaque, filestream, buf, size))
83#define ZWRITE(filefunc, filestream, buf, size) \
84 ((*((filefunc).zwrite_file))((filefunc).opaque, filestream, buf, size))
85#define ZTELL(filefunc, filestream) \
86 ((*((filefunc).ztell_file))((filefunc).opaque, filestream))
87#define ZSEEK(filefunc, filestream, pos, mode) \
88 ((*((filefunc).zseek_file))((filefunc).opaque, filestream, pos, mode))
89#define ZCLOSE(filefunc, filestream) \
90 ((*((filefunc).zclose_file))((filefunc).opaque, filestream))
91#define ZERROR(filefunc, filestream) \
92 ((*((filefunc).zerror_file))((filefunc).opaque, filestream))
93
94#define ZREAD64 ZREAD
95#define ZWRITE64 ZWRITE
96#define ZTELL64 ZTELL
97#define ZSEEK64 ZSEEK
98#define ZCLOSE64 ZCLOSE
99#define ZERROR64 ZERROR
100
101#ifdef __cplusplus
102}
103#endif
104
105#endif /* #ifndef DOXYGEN_SKIP */
106
107#endif /* CPL_MINIZIP_IOAPI_H_INCLUDED */
Standard C Covers.