GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> ZFS / V0-0-2 > zlib_file_compress / rad750
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <ZLIB/zlib.h>
#include <ZFS/ZLIB_msg.h>
#include <ZFS/ZLIB_file_compress.h>
#include <PBS/BSWP.h>
#include <PBS/MBA.h>
#include <MSG/MSG_pubdefs.h>
Functions | |
static unsigned int | ZLIB_fileCompressError (int errCode, const char *func, const char *msg) |
static void * | ZLIB_fileCompressAlloc (void *opaque, unsigned int numItems, unsigned int size) |
static void | ZLIB_fileCompressFree (void *opaque, void *address) |
unsigned int | ZLIB_fileCompressFromFile (int in, int out, unsigned int bufSize) |
Compress a file into an output file. | |
unsigned int | ZLIB_fileCompressFromMem (void *inBuf, int out, unsigned int inSize, unsigned int bufSize) |
Compress a memory region into an output file. |
static void * ZLIB_fileCompressAlloc | ( | void * | opaque, | |
unsigned int | numItems, | |||
unsigned int | size | |||
) | [static] |
Memory allocation callback for ZLIB stream.
opaque | Ignored. | |
numItems | The number of items to allocate. | |
size | The size in bytes of each item. |
Referenced by ZLIB_fileCompressFromFile(), and ZLIB_fileCompressFromMem().
static unsigned int ZLIB_fileCompressError | ( | int | errCode, | |
const char * | func, | |||
const char * | msg | |||
) | [static] |
This function translates ZLIB native error codes into local error codes.
errCode | The ZLIB error code. | |
func | The name of the function in which the error occurred. | |
msg | A message to print out in the MSG output. |
Referenced by ZLIB_fileCompressFromFile(), and ZLIB_fileCompressFromMem().
static void ZLIB_fileCompressFree | ( | void * | opaque, | |
void * | address | |||
) | [static] |
Memory release callback for ZLIB stream.
opaque | Ignored. | |
address | Pointer to memory to free. |
Referenced by ZLIB_fileCompressFromFile(), and ZLIB_fileCompressFromMem().
unsigned int ZLIB_fileCompressFromFile | ( | int | in, | |
int | out, | |||
unsigned int | bufSize | |||
) |
Compress a file into an output file.
This function uses the ZLIB memory to memory inflation library to compress an input file to an output file. Temporary buffer storage of the streams is minimized. The in and out file handles must already have been opened. This function will not close the file handles, and may leave the file pointers at an offset within the file. The out file offset should point to the place where the compression record starts within the output file.
in | The input file handle. | |
out | The compressed output file handle. | |
bufSize | The size in bytes to allocate for stream buffering. |
References ZLIB_fileCompressAlloc(), ZLIB_fileCompressError(), and ZLIB_fileCompressFree().
unsigned int ZLIB_fileCompressFromMem | ( | void * | inBuf, | |
int | out, | |||
unsigned int | inSize, | |||
unsigned int | bufSize | |||
) |
Compress a memory region into an output file.
This function uses the ZLIB memory to memory inflation library to compress an input memory buffer to an output file. Temporary buffer storage of the streams is minimized. The in and out file handles must already have been opened. This function will not close the file handles, and may leave the file pointers at an offset within the file. The out file offset should point to the place where the compression record starts within the output file.
inBuf | The input data memory buffer. | |
out | The compressed output file handle. | |
inSize | The number of bytes in the input buffer to compress. | |
bufSize | The size in bytes to allocate for stream buffering. |
References ZLIB_fileCompressAlloc(), ZLIB_fileCompressError(), and ZLIB_fileCompressFree().