rpm  5.4.15
rpmbz.h
Go to the documentation of this file.
1 #ifndef _H_RPMBZ_
2 #define _H_RPMBZ_
3 
4 #include <bzlib.h>
5 
6 #if defined(__LCLINT__)
7 /*@-incondefs =protoparammatch@*/
8 /*@-exportheader@*/
9 
10 BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) (
11  /*@out@*/
12  int* bzerror,
13  FILE* f,
14  int verbosity,
15  int small,
16  /*@out@*/
17  void* unused,
18  int nUnused
19  )
20  /*@modifies *bzerror, f @*/;
21 
22 BZ_EXTERN void BZ_API(BZ2_bzReadClose) (
23  /*@out@*/
24  int* bzerror,
25  /*@only@*/
26  BZFILE* b
27  )
28  /*@modifies *bzerror, b @*/;
29 
30 BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) (
31  /*@out@*/
32  int* bzerror,
33  BZFILE* b,
34  /*@out@*/
35  void** unused,
36  int* nUnused
37  )
38  /*@modifies *bzerror, b, *unused, *nUnused @*/;
39 
40 BZ_EXTERN int BZ_API(BZ2_bzRead) (
41  /*@out@*/
42  int* bzerror,
43  BZFILE* b,
44  /*@out@*/
45  void* buf,
46  int len
47  )
48  /*@modifies *bzerror, b, *buf @*/;
49 
50 BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) (
51  int* bzerror,
52  FILE* f,
53  int blockSize100k,
54  int verbosity,
55  int workFactor
56  )
57  /*@modifies *bzerror @*/;
58 
59 BZ_EXTERN void BZ_API(BZ2_bzWrite) (
60  /*@out@*/
61  int* bzerror,
62  BZFILE* b,
63  void* buf,
64  int len
65  )
66  /*@modifies *bzerror, b @*/;
67 
68 BZ_EXTERN void BZ_API(BZ2_bzWriteClose) (
69  /*@out@*/
70  int* bzerror,
71  /*@only@*/
72  BZFILE* b,
73  int abandon,
74  /*@out@*/
75  unsigned int* nbytes_in,
76  /*@out@*/
77  unsigned int* nbytes_out
78  )
79  /*@modifies *bzerror, b, *nbytes_in, *nbytes_out @*/;
80 
81 BZ_EXTERN int BZ_API(BZ2_bzflush) (
82  BZFILE* b
83  )
84  /*@modifies b @*/;
85 
86 BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
87  BZFILE *b,
88  /*@out@*/
89  int *errnum
90  )
91  /*@modifies *errnum @*/;
92 
93 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) (
94  char* dest,
95  unsigned int* destLen,
96  char* source,
97  unsigned int sourceLen,
98  int blockSize100k,
99  int verbosity,
100  int workFactor
101  )
102  /*@modifies *dest, *destLen @*/;
103 
104 BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) (
105  char* dest,
106  unsigned int* destLen,
107  char* source,
108  unsigned int sourceLen,
109  int small,
110  int verbosity
111  )
112  /*@modifies *dest, *destLen @*/;
113 
114 BZ_EXTERN int BZ_API(BZ2_bzCompressInit) (
115  bz_stream* strm,
116  int blockSize100k,
117  int verbosity,
118  int workFactor
119  )
120  /*@modifies strm @*/;
121 
122 BZ_EXTERN int BZ_API(BZ2_bzCompress) (
123  bz_stream* strm,
124  int action
125  )
126  /*@modifies strm @*/;
127 
128 BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) (
129  bz_stream* strm
130  )
131  /*@modifies strm @*/;
132 
133 BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) (
134  bz_stream *strm,
135  int verbosity,
136  int small
137  )
138  /*@modifies strm @*/;
139 
140 BZ_EXTERN int BZ_API(BZ2_bzDecompress) (
141  bz_stream* strm
142  )
143  /*@modifies strm @*/;
144 
145 BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) (
146  bz_stream *strm
147  )
148  /*@modifies strm @*/;
149 
150 
151 /*@=exportheader@*/
152 /*@=incondefs =protoparammatch@*/
153 #endif /* __LCLINT__ */
154 
157 typedef /*@abstract@*/ struct rpmbz_s * rpmbz;
158 
161 #if defined(_RPMBZ_INTERNAL)
162 struct rpmbz_s {
163 /*@null@*/
164  BZFILE *bzfile;
165  bz_stream strm;
166  int bzerr;
167  int omode;
168 /*@dependent@*/ /*@null@*/
169  FILE * fp;
170  int B;
171  int S;
172  int V;
173  int W;
174  unsigned int nbytes_in;
175  unsigned int nbytes_out;
176 
177  unsigned int blocksize;
179 /*@null@*/
180  void * zq;
181 /*@null@*/
182  void * zlog;
183 };
184 
185 #ifdef __cplusplus
186 GENfree(rpmbz)
187 #endif /* __cplusplus */
188 
189 /*@only@*/ /*@null@*/
190 static rpmbz rpmbzFini(/*@only@*/ rpmbz bz)
191  /*@modifies bz @*/
192 {
193  bz = _free(bz);
194  return NULL;
195 }
196 
197 /*@only@*/
198 static rpmbz rpmbzInit(int level, int small, int verbosity, mode_t omode)
199  /*@*/
200 {
201  rpmbz bz = (rpmbz) xcalloc(1, sizeof(*bz));
202  static int _bzdB = 9;
203  static int _bzdS = 0;
204  static int _bzdV = 1;
205  static int _bzdW = 30;
206 
207  bz->B = (level >= 1 && level <= 9) ? level : _bzdB;
208  bz->S = (small >= 0) ? small : _bzdS;
209  bz->V = (verbosity >= 0 && verbosity <= 4) ? verbosity : _bzdV;
210  bz->W = _bzdW;
211  bz->omode = omode;
212  return bz;
213 }
214 #endif /* _RPMBZ_INTERNAL */
215 
218 const char * rpmbzStrerror(rpmbz bz)
219  /*@*/;
220 
223 void rpmbzClose(rpmbz bz, int abort, /*@null@*/ const char ** errmsg)
224  /*@modifies bz, *errmsg @*/;
225 
228 /*@only@*/ /*@null@*/
229 rpmbz rpmbzFree(/*@only@*/ rpmbz bz, int abort)
230  /*@globals fileSystem @*/
231  /*@modifies bz, fileSystem @*/;
232 
235 /*@only@*/
236 rpmbz rpmbzNew(const char * path, const char * fmode, int fdno)
237  /*@globals fileSystem @*/
238  /*@modifies fileSystem @*/;
239 
242 ssize_t rpmbzRead(rpmbz bz, /*@out@*/ char * buf, size_t count,
243  /*@null@*/ const char ** errmsg)
244  /*@globals internalState @*/
245  /*@modifies bz, *buf, *errmsg, internalState @*/;
246 
249 ssize_t rpmbzWrite(rpmbz bz, const char * buf, size_t count,
250  /*@null@*/ const char ** errmsg)
251  /*@modifies bz, *errmsg @*/;
252 
253 #ifdef NOTYET
254 
256 int rpmbzSeek(/*@unused@*/ void * _bz, /*@unused@*/ _libio_pos_t pos,
257  /*@unused@*/ int whence)
258  /*@*/;
259 
262 /*@null@*/
263 rpmbz rpmbzOpen(const char * path, const char * fmode)
264  /*@globals fileSystem @*/
265  /*@modifies fileSystem @*/;
266 
269 /*@null@*/
270 rpmbz rpmbzFdopen(void * _fdno, const char * fmode)
271  /*@globals fileSystem @*/
272  /*@modifies fileSystem @*/;
273 
276 int rpmbzFlush(void * _bz)
277  /*@*/;
278 
281 int rpmbzCompressBlock(rpmbz bz, rpmzJob job)
282  /*@modifies job @*/;
283 
286 int rpmbzDecompressBlock(rpmbz bz, rpmzJob job)
287  /*@modifies job @*/;
288 #endif /* NOTYET */
289 
290 #endif /* _H_RPMBZ_ */
const bson * b
Definition: bson.h:280
const char * rpmbzStrerror(rpmbz bz)
const char const char size_t len
Definition: bson.h:823
struct rpmzJob_s * rpmzJob
Definition: rpmzq.h:27
ssize_t rpmbzRead(rpmbz bz, char *buf, size_t count, const char **errmsg)
off_t _libio_pos_t
Definition: rpmio.h:36
int rpmbzCompressBlock(void *_bz, rpmzJob job)
void * xcalloc(size_t nmemb, size_t size)
Definition: rpmmalloc.c:300
struct rpmbz_s * rpmbz
Definition: rpmbz.h:157
rpmbz rpmbzNew(const char *path, const char *fmode, int fdno)
void rpmbzClose(rpmbz bz, int abort, const char **errmsg)
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
Definition: rpmiotypes.h:756
ssize_t rpmbzWrite(rpmbz bz, const char *buf, size_t count, const char **errmsg)
rpmbz rpmbzFree(rpmbz bz, int abort)