gft_bzlib.h
Go to the documentation of this file.
1 
2 /*-------------------------------------------------------------*/
3 /*--- Public header file for the library. ---*/
4 /*--- bzlib.h ---*/
5 /*-------------------------------------------------------------*/
6 
7 /* ------------------------------------------------------------------
8  This file is part of bzip2/libbzip2, a program and library for
9  lossless, block-sorting data compression.
10 
11  bzip2/libbzip2 version 1.0.4 of 20 December 2006
12  Copyright (C) 1996-2006 Julian Seward <jseward@bzip.org>
13 
14  Please read the WARNING, DISCLAIMER and PATENTS sections in the
15  README file.
16 
17  This program is released under the terms of the license contained
18  in the file LICENSE.
19  ------------------------------------------------------------------ */
20 
21 
22 #ifndef _gft_BZLIB_H
23 #define _gft_BZLIB_H
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 #define gft_BZ_RUN 0
30 #define gft_BZ_FLUSH 1
31 #define gft_BZ_FINISH 2
32 
33 #define gft_BZ_OK 0
34 #define gft_BZ_RUN_OK 1
35 #define gft_BZ_FLUSH_OK 2
36 #define gft_BZ_FINISH_OK 3
37 #define gft_BZ_STREAM_END 4
38 #define gft_BZ_SEQUENCE_ERROR (-1)
39 #define gft_BZ_PARAM_ERROR (-2)
40 #define gft_BZ_MEM_ERROR (-3)
41 #define gft_BZ_DATA_ERROR (-4)
42 #define gft_BZ_DATA_ERROR_MAGIC (-5)
43 #define gft_BZ_IO_ERROR (-6)
44 #define gft_BZ_UNEXPECTED_EOF (-7)
45 #define gft_BZ_OUTBUFF_FULL (-8)
46 #define gft_BZ_CONFIG_ERROR (-9)
47 
48 typedef
49  struct {
50  char *next_in;
51  unsigned int avail_in;
52  unsigned int total_in_lo32;
53  unsigned int total_in_hi32;
54 
55  char *next_out;
56  unsigned int avail_out;
57  unsigned int total_out_lo32;
58  unsigned int total_out_hi32;
59 
60  void *state;
61 
62  void *(*bzalloc)(void *,int,int);
63  void (*bzfree)(void *,void *);
64  void *opaque;
65  }
66  bz_stream;
67 
68 
69 #ifndef gft_BZ_IMPORT
70 #define gft_BZ_EXPORT
71 #endif
72 
73 #ifndef gft_BZ_NO_STDIO
74 /* Need a definitition for FILE */
75 #include <stdio.h>
76 #endif
77 
78 //#ifdef _WIN32
79 //# include <windows.h>
80 //# ifdef small
81 // /* windows.h define small to char */
82 //# undef small
83 //# endif
84 //# ifdef gft_BZ_EXPORT
85 //# define gft_BZ_API(func) WINAPI func
86 //# define gft_BZ_EXTERN extern
87 //# else
88 // /* import windows dll dynamically */
89 //# define gft_BZ_API(func) (WINAPI * func)
90 //# define gft_BZ_EXTERN
91 //# endif
92 //#else
93 //# define gft_BZ_API(func) func
94 //# define gft_BZ_EXTERN extern
95 //#endif
96 
97 # define gft_BZ_API(func) func
98 # define gft_BZ_EXTERN extern
99 
100 
101 /*-- Core (low-level) library functions --*/
102 
104  bz_stream* strm,
105  int blockSize100k,
106  int verbosity,
107  int workFactor
108  );
109 
111  bz_stream* strm,
112  int action
113  );
114 
116  bz_stream* strm
117  );
118 
120  bz_stream *strm,
121  int verbosity,
122  int small
123  );
124 
126  bz_stream* strm
127  );
128 
130  bz_stream *strm
131  );
132 
133 
134 
135 /*-- High(er) level library functions --*/
136 
137 #ifndef gft_BZ_NO_STDIO
138 #define gft_BZ_MAX_UNUSED 5000
139 
140 typedef void gft_BZFILE;
141 
143  int* bzerror,
144  FILE* f,
145  int verbosity,
146  int small,
147  void* unused,
148  int nUnused
149  );
150 
152  int* bzerror,
153  gft_BZFILE* b
154  );
155 
157  int* bzerror,
158  gft_BZFILE* b,
159  void** unused,
160  int* nUnused
161  );
162 
164  int* bzerror,
165  gft_BZFILE* b,
166  void* buf,
167  int len
168  );
169 
171  int* bzerror,
172  FILE* f,
173  int blockSize100k,
174  int verbosity,
175  int workFactor
176  );
177 
179  int* bzerror,
180  gft_BZFILE* b,
181  void* buf,
182  int len
183  );
184 
186  int* bzerror,
187  gft_BZFILE* b,
188  int abandon,
189  unsigned int* nbytes_in,
190  unsigned int* nbytes_out
191  );
192 
194  int* bzerror,
195  gft_BZFILE* b,
196  int abandon,
197  unsigned int* nbytes_in_lo32,
198  unsigned int* nbytes_in_hi32,
199  unsigned int* nbytes_out_lo32,
200  unsigned int* nbytes_out_hi32
201  );
202 #endif
203 
204 
205 /*-- Utility functions --*/
206 
208  char* dest,
209  unsigned int* destLen,
210  char* source,
211  unsigned int sourceLen,
212  int blockSize100k,
213  int verbosity,
214  int workFactor
215  );
216 
218  char* dest,
219  unsigned int* destLen,
220  char* source,
221  unsigned int sourceLen,
222  int small,
223  int verbosity
224  );
225 
226 /*--
227  Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp)
228  to support better zlib compatibility.
229  This code is not _officially_ part of libbzip2 (yet);
230  I haven't tested it, documented it, or considered the
231  threading-safeness of it.
232  If this code breaks, please contact both Yoshioka and me.
233 --*/
234 
236  void
237  );
238 
239 #ifndef gft_BZ_NO_STDIO
241  const char *path,
242  const char *mode
243  );
244 
246  int fd,
247  const char *mode
248  );
249 
251  gft_BZFILE* b,
252  void* buf,
253  int len
254  );
255 
257  gft_BZFILE* b,
258  void* buf,
259  int len
260  );
261 
263  gft_BZFILE* b
264  );
265 
267  gft_BZFILE* b
268  );
269 
271  gft_BZFILE *b,
272  int *errnum
273  );
274 #endif
275 
276 #ifdef __cplusplus
277 }
278 #endif
279 
280 #endif
281 
282 /*-------------------------------------------------------------*/
283 /*--- end bzlib.h ---*/
284 /*-------------------------------------------------------------*/
gft_BZ_EXTERN int gft_BZ_API() gft_BZ2_bzCompressEnd(bz_stream *strm)
gft_BZ_EXTERN const char *gft_BZ_API() gft_BZ2_bzerror(gft_BZFILE *b, int *errnum)
void gft_BZFILE
Definition: gft_bzlib.h:140
unsigned int total_in_hi32
Definition: gft_bzlib.h:53
gft_BZ_EXTERN int gft_BZ_API() gft_BZ2_bzDecompressInit(bz_stream *strm, int verbosity, int small)
unsigned int avail_in
Definition: gft_bzlib.h:51
#define gft_BZ_API(func)
Definition: gft_bzlib.h:97
unsigned int total_out_hi32
Definition: gft_bzlib.h:58
gft_BZ_EXTERN int gft_BZ_API() gft_BZ2_bzCompressInit(bz_stream *strm, int blockSize100k, int verbosity, int workFactor)
#define gft_BZ_EXTERN
Definition: gft_bzlib.h:98
gft_BZ_EXTERN int gft_BZ_API() gft_BZ2_bzBuffToBuffDecompress(char *dest, unsigned int *destLen, char *source, unsigned int sourceLen, int small, int verbosity)
gft_BZ_EXTERN int gft_BZ_API() gft_BZ2_bzwrite(gft_BZFILE *b, void *buf, int len)
gft_BZ_EXTERN gft_BZFILE *gft_BZ_API() gft_BZ2_bzopen(const char *path, const char *mode)
gft_BZ_EXTERN void gft_BZ_API() gft_BZ2_bzWrite(int *bzerror, gft_BZFILE *b, void *buf, int len)
gft_BZ_EXTERN int gft_BZ_API() gft_BZ2_bzflush(gft_BZFILE *b)
gft_BZ_EXTERN int gft_BZ_API() gft_BZ2_bzDecompress(bz_stream *strm)
unsigned int total_in_lo32
Definition: gft_bzlib.h:52
unsigned int total_out_lo32
Definition: gft_bzlib.h:57
gft_BZ_EXTERN void gft_BZ_API() gft_BZ2_bzReadClose(int *bzerror, gft_BZFILE *b)
Definition: gft_bzlib.h:48
gft_BZ_EXTERN void gft_BZ_API() gft_BZ2_bzWriteClose(int *bzerror, gft_BZFILE *b, int abandon, unsigned int *nbytes_in, unsigned int *nbytes_out)
gft_BZ_EXTERN const char *gft_BZ_API() gft_BZ2_bzlibVersion(void)
gft_BZ_EXTERN void gft_BZ_API() gft_BZ2_bzclose(gft_BZFILE *b)
void * state
Definition: gft_bzlib.h:60
gft_BZ_EXTERN int gft_BZ_API() gft_BZ2_bzRead(int *bzerror, gft_BZFILE *b, void *buf, int len)
gft_BZ_EXTERN void gft_BZ_API() gft_BZ2_bzWriteClose64(int *bzerror, gft_BZFILE *b, int abandon, unsigned int *nbytes_in_lo32, unsigned int *nbytes_in_hi32, unsigned int *nbytes_out_lo32, unsigned int *nbytes_out_hi32)
gft_BZ_EXTERN gft_BZFILE *gft_BZ_API() gft_BZ2_bzReadOpen(int *bzerror, FILE *f, int verbosity, int small, void *unused, int nUnused)
double f(double t)
Definition: gft_color.cpp:15
gft_BZ_EXTERN gft_BZFILE *gft_BZ_API() gft_BZ2_bzWriteOpen(int *bzerror, FILE *f, int blockSize100k, int verbosity, int workFactor)
unsigned int avail_out
Definition: gft_bzlib.h:56
gft_BZ_EXTERN int gft_BZ_API() gft_BZ2_bzread(gft_BZFILE *b, void *buf, int len)
void * opaque
Definition: gft_bzlib.h:64
char * next_out
Definition: gft_bzlib.h:55
gft_BZ_EXTERN gft_BZFILE *gft_BZ_API() gft_BZ2_bzdopen(int fd, const char *mode)
gft_BZ_EXTERN int gft_BZ_API() gft_BZ2_bzDecompressEnd(bz_stream *strm)
gft_BZ_EXTERN void gft_BZ_API() gft_BZ2_bzReadGetUnused(int *bzerror, gft_BZFILE *b, void **unused, int *nUnused)
char * next_in
Definition: gft_bzlib.h:50
gft_BZ_EXTERN int gft_BZ_API() gft_BZ2_bzCompress(bz_stream *strm, int action)
gft_BZ_EXTERN int gft_BZ_API() gft_BZ2_bzBuffToBuffCompress(char *dest, unsigned int *destLen, char *source, unsigned int sourceLen, int blockSize100k, int verbosity, int workFactor)