GDAL

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