Data Structures | |
struct | cr_ContentStat |
struct | CR_FILE |
Defines | |
#define | CR_CW_ERR -1 |
#define | cr_open(FILENAME, MODE, COMTYPE, ERR) cr_sopen(FILENAME, MODE, COMTYPE, NULL, ERR) |
Enumerations | |
enum | cr_CompressionType { CR_CW_AUTO_DETECT_COMPRESSION, CR_CW_UNKNOWN_COMPRESSION, CR_CW_NO_COMPRESSION, CR_CW_GZ_COMPRESSION, CR_CW_BZ2_COMPRESSION, CR_CW_XZ_COMPRESSION, CR_CW_COMPRESSION_SENTINEL } |
enum | cr_OpenMode { CR_CW_MODE_READ, CR_CW_MODE_WRITE, CR_CW_MODE_SENTINEL } |
Functions | |
cr_ContentStat * | cr_contentstat_new (cr_ChecksumType type, GError **err) |
void | cr_contentstat_free (cr_ContentStat *cstat, GError **err) |
const char * | cr_compression_suffix (cr_CompressionType comtype) |
cr_CompressionType | cr_detect_compression (const char *filename, GError **err) |
cr_CompressionType | cr_compression_type (const char *name) |
CR_FILE * | cr_sopen (const char *filename, cr_OpenMode mode, cr_CompressionType comtype, cr_ContentStat *stat, GError **err) |
int | cr_read (CR_FILE *cr_file, void *buffer, unsigned int len, GError **err) |
int | cr_write (CR_FILE *cr_file, const void *buffer, unsigned int len, GError **err) |
int | cr_puts (CR_FILE *cr_file, const char *str, GError **err) |
int | cr_printf (GError **err, CR_FILE *cr_file, const char *format,...) |
int | cr_close (CR_FILE *cr_file, GError **err) |
#define CR_CW_ERR -1 |
Return value - Error
Definition at line 86 of file compression_wrapper.h.
#define cr_open | ( | FILENAME, | |||
MODE, | |||||
COMTYPE, | |||||
ERR | ) | cr_sopen(FILENAME, MODE, COMTYPE, NULL, ERR) |
Open/Create the specified file.
FILENAME | filename | |
MODE | open mode | |
COMTYPE | type of compression | |
ERR | GError ** |
Definition at line 114 of file compression_wrapper.h.
enum cr_CompressionType |
Compression type.
Definition at line 36 of file compression_wrapper.h.
enum cr_OpenMode |
Open modes.
CR_CW_MODE_READ |
Read mode |
CR_CW_MODE_WRITE |
Write mode |
CR_CW_MODE_SENTINEL |
Sentinel of the list |
Definition at line 48 of file compression_wrapper.h.
int cr_close | ( | CR_FILE * | cr_file, | |
GError ** | err | |||
) |
const char* cr_compression_suffix | ( | cr_CompressionType | comtype | ) |
Returns a common suffix for the specified cr_CompressionType.
comtype | compression type |
cr_CompressionType cr_compression_type | ( | const char * | name | ) |
Return compression type.
name | compression name |
void cr_contentstat_free | ( | cr_ContentStat * | cstat, | |
GError ** | err | |||
) |
Frees cr_ContentStat object.
cstat | cr_ContentStat object | |
err | GError ** |
cr_ContentStat* cr_contentstat_new | ( | cr_ChecksumType | type, | |
GError ** | err | |||
) |
Creates new cr_ContentStat object
type | Type of checksum. (if CR_CHECKSUM_UNKNOWN is used, no checksum calculation will be done) | |
err | GError ** |
cr_CompressionType cr_detect_compression | ( | const char * | filename, | |
GError ** | err | |||
) |
Detect a compression type of the specified file.
filename | filename | |
err | GError ** |
int cr_printf | ( | GError ** | err, | |
CR_FILE * | cr_file, | |||
const char * | format, | |||
... | ||||
) |
Writes a formatted string into the cr_file.
err | GError ** | |
cr_file | CR_FILE pointer | |
format | format string | |
... | list of additional arguments as specified in format |
int cr_puts | ( | CR_FILE * | cr_file, | |
const char * | str, | |||
GError ** | err | |||
) |
Writes the string pointed by str into the cr_file.
cr_file | CR_FILE pointer | |
str | null terminated ('') string | |
err | GError ** |
int cr_read | ( | CR_FILE * | cr_file, | |
void * | buffer, | |||
unsigned int | len, | |||
GError ** | err | |||
) |
CR_FILE* cr_sopen | ( | const char * | filename, | |
cr_OpenMode | mode, | |||
cr_CompressionType | comtype, | |||
cr_ContentStat * | stat, | |||
GError ** | err | |||
) |
Open/Create the specified file. If opened for writting, you can pass a cr_ContentStat object and after cr_close() get stats of an open content (stats of uncompressed content).
filename | filename | |
mode | open mode | |
comtype | type of compression | |
stat | pointer to cr_ContentStat or NULL | |
err | GError ** |
int cr_write | ( | CR_FILE * | cr_file, | |
const void * | buffer, | |||
unsigned int | len, | |||
GError ** | err | |||
) |
Writes the array of len bytes from buffer to the cr_file.
cr_file | CR_FILE pointer | |
buffer | source buffer | |
len | number of bytes to read | |
err | GError ** |