33
33
(zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format).
36
#ifndef PLUGIN_ARCHIVE_AZIO_H
37
#define PLUGIN_ARCHIVE_AZIO_H
39
39
/* We currently allow this on all platforms */
42
#include <drizzled/common.h>
43
#include "drizzled/internal/my_sys.h"
42
#include <drizzled/global.h>
43
#include <mysys/my_sys.h>
57
57
#define WATCHPOINT_ERRNO(A) fprintf(stderr, "\nWATCHPOINT %s:%d (%s) %s\n", __FILE__, __LINE__,__func__, strerror(A));A= 0;fflush(stderr);
60
uint64_t + uint64_t + uint64_t + uint64_t + unsigned char
60
uint64_t + uint64_t + uint64_t + uint64_t + uchar
62
62
#define AZMETA_BUFFER_SIZE sizeof(uint64_t) \
63
63
+ sizeof(uint64_t) + sizeof(uint64_t) + sizeof(uint64_t) \
236
235
pthread_mutex_t thresh_mutex;
237
236
pthread_cond_t threshhold;
238
237
pthread_t mainthread; /* Thread descriptor */
251
typedef class azio_stream {
241
typedef struct azio_stream {
254
int z_err; /* error code for last stream operation */
255
int z_eof; /* set if end of input file */
256
int file; /* .gz file */
257
Byte *inbuf; /* input buffer */
258
Byte buffer1[AZ_BUFSIZE_READ]; /* input buffer */
259
Byte buffer2[AZ_BUFSIZE_READ]; /* input buffer */
260
Byte outbuf[AZ_BUFSIZE_WRITE]; /* output buffer */
261
int aio_inited; /* Are we good to go */
262
uLong crc; /* crc32 of uncompressed data */
263
char *msg; /* error message */
264
char mode; /* 'w' or 'r' */
265
size_t start; /* start of compressed data in file (header skipped) */
266
size_t in; /* bytes into deflate or inflate */
267
size_t out; /* bytes out of deflate or inflate */
268
size_t pos; /* bytes out of deflate or inflate */
269
int back; /* one character push-back */
270
int last; /* true if push-back is last character */
243
int z_err; /* error code for last stream operation */
244
int z_eof; /* set if end of input file */
245
File file; /* .gz file */
246
Byte *inbuf; /* input buffer */
247
Byte buffer1[AZ_BUFSIZE_READ]; /* input buffer */
248
Byte buffer2[AZ_BUFSIZE_READ]; /* input buffer */
249
Byte outbuf[AZ_BUFSIZE_WRITE]; /* output buffer */
250
int aio_inited; /* Are we good to go */
251
uLong crc; /* crc32 of uncompressed data */
252
char *msg; /* error message */
253
char mode; /* 'w' or 'r' */
254
size_t start; /* start of compressed data in file (header skipped) */
255
size_t in; /* bytes into deflate or inflate */
256
size_t out; /* bytes out of deflate or inflate */
257
size_t pos; /* bytes out of deflate or inflate */
258
int back; /* one character push-back */
259
int last; /* true if push-back is last character */
271
260
unsigned char version; /* Version */
272
261
unsigned char minor_version; /* Version */
273
262
unsigned int block_size; /* Block Size */
282
271
unsigned int frm_length; /* Position for start of FRM */
283
272
unsigned int comment_start_pos; /* Position for start of comment */
284
273
unsigned int comment_length; /* Position for start of comment */
287
azio_container container;
275
azio_container_st container;
289
277
az_method method;
319
comment_start_pos(0),
323
memset(buffer1, 0, AZ_BUFSIZE_READ);
324
memset(buffer2, 0, AZ_BUFSIZE_READ);
325
memset(outbuf, 0, AZ_BUFSIZE_WRITE);
330
281
/* basic functions */
346
297
can be checked to distinguish the two cases (if errno is zero, the
347
298
zlib error is Z_MEM_ERROR). */
349
int azdopen(azio_stream *s,int fd, int Flags);
300
int azdopen(azio_stream *s,File fd, int Flags);
351
302
azdopen() associates a azio_stream with the file descriptor fd. File
352
303
descriptors are obtained from calls like open, dup, creat, pipe or
359
310
the (de)compression state.
314
unsigned int azread_internal( azio_stream *s, voidp buf, unsigned int len, int *error);
316
This function is legacy, do not use.
318
Reads the given number of uncompressed bytes from the compressed file.
319
If the input file was not in gzip format, gzread copies the given number
320
of bytes into the buffer.
321
gzread returns the number of uncompressed bytes actually read (0 for
322
end of file, -1 for error). */
362
324
extern int azflush(azio_stream *file, int flush);
364
326
Flushes all pending output into the compressed file. The parameter
407
369
size_t azwrite_row(azio_stream *s, void *buf, unsigned int len);
408
370
size_t azread_row(azio_stream *s, int *error);
410
extern int azwrite_frm (azio_stream *s, const char *blob, unsigned int length);
372
extern int azwrite_frm (azio_stream *s, char *blob, unsigned int length);
411
373
extern int azread_frm (azio_stream *s, char *blob);
412
extern int azwrite_comment (azio_stream *s, const char *blob, unsigned int length);
374
extern int azwrite_comment (azio_stream *s, char *blob, unsigned int length);
413
375
extern int azread_comment (azio_stream *s, char *blob);
415
377
#ifdef __cplusplus
419
#endif /* PLUGIN_ARCHIVE_AZIO_H */