|
1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // GZIO.H |
|
15 // |
|
16 // |
|
17 |
|
18 // This header guard define is used subsequently in zutil.h to allow standard libarary functions |
|
19 // (in stdlib.h and string.h) to be included for libz.dll and excluded for libzcore.dll. |
|
20 #ifndef LIBZGZIO_H |
|
21 #define LIBZGZIO_H |
|
22 |
|
23 #if (defined(__TOOLS2__) || defined(__TOOLS__)) |
|
24 #include "zconf.h" |
|
25 #else |
|
26 #include <zconf.h> |
|
27 #endif |
|
28 |
|
29 #include <stdarg.h> |
|
30 |
|
31 |
|
32 #ifdef SYMBIAN_EZLIB_DEVICE |
|
33 #include <e32def.h> |
|
34 #endif |
|
35 |
|
36 #ifdef __cplusplus |
|
37 extern "C" { |
|
38 #endif |
|
39 |
|
40 typedef voidp gzFile; |
|
41 |
|
42 /* |
|
43 * Flushes all pending output if necessary, closes the compressed file |
|
44 * and deallocates all the (de)compression state. |
|
45 */ |
|
46 int gzclose_r (gzFile file); |
|
47 |
|
48 |
|
49 /* |
|
50 * Clears the error and end-of-file flags for file.This is analogous to the |
|
51 * clearerr() function in stdio. |
|
52 */ |
|
53 void gzclearerr_r (gzFile file); |
|
54 |
|
55 |
|
56 /* |
|
57 * gzdopen() associates a gzFile with the file descriptor fd. File |
|
58 * descriptors are obtained from calls like open, dup, creat, pipe or |
|
59 * fileno (in the file has been previously opened with fopen). |
|
60 * The mode parameter is as in gzopen. |
|
61 */ |
|
62 gzFile gzdopen_r (int fd, const char *mode); |
|
63 |
|
64 |
|
65 /* |
|
66 * Returns 1 if file is being read directly without decompression, otherwise |
|
67 * zero. |
|
68 */ |
|
69 int gzdirect_r (gzFile file); |
|
70 |
|
71 |
|
72 /* |
|
73 * Returns 1 when EOF has previously been detected reading the given |
|
74 * input stream, otherwise zero. |
|
75 */ |
|
76 int gzeof_r (gzFile file); |
|
77 |
|
78 |
|
79 /* |
|
80 * Returns the error message for the last error which occurred on the |
|
81 * given compressed file. errnum is set to zlib error number. If an |
|
82 * error occurred in the file system and not in the compression library, |
|
83 * errnum is set to Z_ERRNO and the application may consult errno |
|
84 * to get the exact error code. |
|
85 */ |
|
86 const char* gzerror_r (gzFile file, int *errnum); |
|
87 |
|
88 |
|
89 /* |
|
90 * Flushes all pending output into the compressed file.gzflush should |
|
91 * be called only when strictly necessary because it can degrade compression. |
|
92 */ |
|
93 int gzflush_r (gzFile file, int flush); |
|
94 |
|
95 |
|
96 /* |
|
97 * Reads one byte from the compressed file. gzgetc returns this byte |
|
98 * or -1 in case of end of file or error. |
|
99 */ |
|
100 int gzgetc_r (gzFile file); |
|
101 |
|
102 |
|
103 /* |
|
104 * Reads bytes from the compressed file until len-1 characters are read, or |
|
105 * a newline character is read and transferred to buf, or an end-of-file |
|
106 * condition is encountered. The string is then terminated with a null |
|
107 * character. |
|
108 */ |
|
109 char* gzgets_r (gzFile file, char *buf, int len); |
|
110 |
|
111 /* |
|
112 * Opens a gzip (.gz) file for reading or writing. The mode parameter |
|
113 * is as in fopen ("rb" or "wb") but can also include a compression level |
|
114 * ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for |
|
115 * Huffman only compression as in "wb1h", or 'R' for run-length encoding |
|
116 * as in "wb1R". |
|
117 */ |
|
118 gzFile gzopen_r (const char *path, const char *mode); |
|
119 |
|
120 |
|
121 /* |
|
122 * Converts, formats, and writes the args to the compressed file under |
|
123 * control of the format string, as in fprintf. gzprintf returns the number of |
|
124 * uncompressed bytes actually written (0 in case of error). |
|
125 */ |
|
126 int gzprintf_r (gzFile file, const char *format, va_list va); |
|
127 |
|
128 |
|
129 /* |
|
130 * Writes c, converted to an unsigned char, into the compressed file. |
|
131 * gzputc returns the value that was written, or -1 in case of error. |
|
132 */ |
|
133 int gzputc_r (gzFile file, int c); |
|
134 |
|
135 |
|
136 /* |
|
137 * Writes the given null-terminated string to the compressed file, excluding |
|
138 * the terminating null character. gzputs returns the number of characters |
|
139 * written, or -1 in case of error. |
|
140 */ |
|
141 int gzputs_r (gzFile file, const char *s); |
|
142 |
|
143 |
|
144 /* |
|
145 * Reads the given number of uncompressed bytes from the compressed file. |
|
146 * gzread returns the number of uncompressed bytes actually read (0 for |
|
147 * end of file, -1 for error). |
|
148 */ |
|
149 int gzread_r (gzFile file, voidp buf, unsigned len); |
|
150 |
|
151 |
|
152 /* |
|
153 * Rewinds the given file. This function is supported only for reading. |
|
154 * gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) |
|
155 */ |
|
156 |
|
157 int gzrewind_r (gzFile file); |
|
158 |
|
159 |
|
160 /* |
|
161 * Sets the starting position for the next gzread or gzwrite on the |
|
162 * given compressed file. If the file is opened for writing, only |
|
163 * forward seeks are supported. |
|
164 */ |
|
165 z_off_t gzseek_r (gzFile file, z_off_t offset, int whence); |
|
166 |
|
167 |
|
168 /* |
|
169 * Dynamically update the compression level or strategy. See the description |
|
170 * of deflateInit2 for the meaning of these parameters. |
|
171 */ |
|
172 int gzsetparams_r (gzFile file, int level, int strategy); |
|
173 |
|
174 |
|
175 /* |
|
176 * Returns the starting position for the next gzread or gzwrite on the |
|
177 * given compressed file. This position represents a number of bytes in the |
|
178 * uncompressed data stream. |
|
179 */ |
|
180 z_off_t gztell_r (gzFile file); |
|
181 |
|
182 |
|
183 /* |
|
184 * Push one character back onto the stream to be read again later. |
|
185 * Only one character of push-back is allowed. |
|
186 */ |
|
187 int gzungetc_r (int c, gzFile file); |
|
188 |
|
189 |
|
190 /* |
|
191 * Writes the given number of uncompressed bytes into the compressed file. |
|
192 * gzwrite returns the number of uncompressed bytes actually written |
|
193 * (0 in case of error). |
|
194 */ |
|
195 int gzwrite_r (gzFile file, voidpc buf, unsigned len); |
|
196 |
|
197 |
|
198 #ifdef __cplusplus |
|
199 } |
|
200 #endif |
|
201 |
|
202 #endif /* LIBZGZIO_H */ |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |