File: zip.h

package info (click to toggle)
exult 1.12.0-2
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 43,608 kB
  • sloc: cpp: 169,917; xml: 7,400; yacc: 2,850; makefile: 2,419; java: 1,901; ansic: 1,654; lex: 673; sh: 539; objc: 416
file content (140 lines) | stat: -rw-r--r-- 4,737 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/* zip.h -- IO for compress .zip files using zlib
   Version 0.15 alpha, Mar 19th, 1998,

   Copyright (C) 1998 Gilles Vollant

   Modified by Ryan Nunn. Nov 9th 2001
   Modified by the Exult Team. 2003-2022

   This unzip package allow creates .ZIP file, compatible with PKZip 2.04g
	 WinZip, InfoZip tools and compatible.
   Encryption and multi volume ZipFile (span) are not supported.
   Old compressions used by old PKZip 1.x are not supported

  For uncompress .zip file, look at unzip.h

   THIS IS AN ALPHA VERSION. AT THIS STAGE OF DEVELOPPEMENT, SOMES API OR
  STRUCTURE CAN CHANGE IN FUTURE VERSION !! I WAIT FEEDBACK at mail
  info@winimage.com Visit also http://www.winimage.com/zLibDll/unzip.html for
  evolution

   Condition of use and distribution are the same than zlib :

  This software is provided 'as-is', without any express or implied
  warranty.  In no event will the authors be held liable for any damages
  arising from the use of this software.

  Permission is granted to anyone to use this software for any purpose,
  including commercial applications, and to alter it and redistribute it
  freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not
	 claim that you wrote the original software. If you use this software
	 in a product, an acknowledgment in the product documentation would be
	 appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be
	 misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.


*/

/* for more info about .ZIP format, see
	  ftp://ftp.cdrom.com/pub/infozip/doc/appnote-970311-iz.zip
   PkWare has also a specification at :
	  ftp://ftp.pkware.com/probdesc.zip
*/

#ifndef _zip_H
#define _zip_H

/* Added by Ryan Nunn */
#ifdef HAVE_ZIP_SUPPORT

#	ifdef __cplusplus
extern "C" {
#	endif

#	define ZLIB_CONST
#	include <zlib.h>

struct zip_internal;
using zipFile = zip_internal*;

#	define ZIP_OK            (0)
#	define ZIP_ERRNO         (Z_ERRNO)
#	define ZIP_PARAMERROR    (-102)
#	define ZIP_INTERNALERROR (-104)

/* tm_zip contain date/time info */
struct tm_zip {
	uInt tm_sec;  /* seconds after the minute - [0,59] */
	uInt tm_min;  /* minutes after the hour - [0,59] */
	uInt tm_hour; /* hours since midnight - [0,23] */
	uInt tm_mday; /* day of the month - [1,31] */
	uInt tm_mon;  /* months since January - [0,11] */
	uInt tm_year; /* years - [1980..2044] */
};

struct zip_fileinfo {
	tm_zip tmz_date; /* date in understandable format           */
	uLong  dosDate;  /* if dos_date == 0, tmu_date is used      */
	/*    uLong       flag;        */ /* general purpose bit flag        2 bytes
									   */

	uLong internal_fa; /* internal file attributes        2 bytes */
	uLong external_fa; /* external file attributes        4 bytes */
};

extern zipFile ZEXPORT zipOpen(const char* pathname, int append);
/*
  Create a zipfile.
	 pathname contain on Windows NT a filename like "c:\\zlib\\zlib111.zip" or
  on an Unix computer "zlib/zlib111.zip". if the file pathname exist and
  append=1, the zip will be created at the end of the file. (useful if the file
  contain a self extractor code) If the zipfile cannot be opened, the return
  value is nullptr. Else, the return value is a zipFile Handle, usable with
  other function of this zip package.
*/

extern int ZEXPORT zipOpenNewFileInZip(
		zipFile file, const char* filename, const zip_fileinfo* zipfi,
		const void* extrafield_local, uInt size_extrafield_local,
		const void* extrafield_global, uInt size_extrafield_global,
		const char* comment, int method, int level);
/*
  Open a file in the ZIP for writing.
  filename : the filename in zip (if nullptr, '-' without quote will be used
  *zipfi contain supplemental information
  if extrafield_local!=nullptr and size_extrafield_local>0, extrafield_local
	contains the extrafield data the the local header
  if extrafield_global!=nullptr and size_extrafield_global>0, extrafield_global
	contains the extrafield data the the local header
  if comment != nullptr, comment contain the comment string
  method contain the compression method (0 for store, Z_DEFLATED for deflate)
  level contain the level of compression (can be Z_DEFAULT_COMPRESSION)
*/

extern int ZEXPORT zipWriteInFileInZip(zipFile file, voidpc buf, unsigned len);
/*
  Write data in the zipfile
*/

extern int ZEXPORT zipCloseFileInZip(zipFile file);
/*
  Close the current file in the zipfile
*/

extern int ZEXPORT zipClose(zipFile file, const char* global_comment);
/*
  Close the zipfile
*/

#	ifdef __cplusplus
}
#	endif

/* Added by Ryan Nunn */
#endif /*HAVE_ZIP_SUPPORT*/

#endif /* _zip_H */