1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 *************************************************************************/
28 /* ioapi.h -- IO base function header for compress/uncompress .zip
29 files using zlib + zip or unzip API
31 Version 1.01e, February 12th, 2005
33 Copyright (C) 1998-2005 Gilles Vollant
41 #define ZLIB_FILEFUNC_SEEK_CUR (1)
42 #define ZLIB_FILEFUNC_SEEK_END (2)
43 #define ZLIB_FILEFUNC_SEEK_SET (0)
45 #define ZLIB_FILEFUNC_MODE_READ (1)
46 #define ZLIB_FILEFUNC_MODE_WRITE (2)
47 #define ZLIB_FILEFUNC_MODE_READWRITEFILTER (3)
49 #define ZLIB_FILEFUNC_MODE_EXISTING (4)
50 #define ZLIB_FILEFUNC_MODE_CREATE (8)
61 typedef voidpf (ZCALLBACK
*open_file_func
) OF((voidpf opaque
, const char* filename
, int mode
));
62 typedef uLong (ZCALLBACK
*read_file_func
) OF((voidpf opaque
, voidpf stream
, void* buf
, uLong size
));
63 typedef uLong (ZCALLBACK
*write_file_func
) OF((voidpf opaque
, voidpf stream
, const void* buf
, uLong size
));
64 typedef long (ZCALLBACK
*tell_file_func
) OF((voidpf opaque
, voidpf stream
));
65 typedef long (ZCALLBACK
*seek_file_func
) OF((voidpf opaque
, voidpf stream
, uLong offset
, int origin
));
66 typedef int (ZCALLBACK
*close_file_func
) OF((voidpf opaque
, voidpf stream
));
67 typedef int (ZCALLBACK
*testerror_file_func
) OF((voidpf opaque
, voidpf stream
));
69 typedef struct zlib_filefunc_def_s
71 open_file_func zopen_file
;
72 read_file_func zread_file
;
73 write_file_func zwrite_file
;
74 tell_file_func ztell_file
;
75 seek_file_func zseek_file
;
76 close_file_func zclose_file
;
77 testerror_file_func zerror_file
;
83 void fill_fopen_filefunc
OF((zlib_filefunc_def
* pzlib_filefunc_def
));
85 #define ZREAD(filefunc,filestream,buf,size) ((*((filefunc).zread_file))((filefunc).opaque,filestream,buf,size))
86 #define ZWRITE(filefunc,filestream,buf,size) ((*((filefunc).zwrite_file))((filefunc).opaque,filestream,buf,size))
87 #define ZTELL(filefunc,filestream) ((*((filefunc).ztell_file))((filefunc).opaque,filestream))
88 #define ZSEEK(filefunc,filestream,pos,mode) ((*((filefunc).zseek_file))((filefunc).opaque,filestream,pos,mode))
89 #define ZCLOSE(filefunc,filestream) ((*((filefunc).zclose_file))((filefunc).opaque,filestream))
90 #define ZERROR(filefunc,filestream) ((*((filefunc).zerror_file))((filefunc).opaque,filestream))