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