createrepo_c library
C library for metadata manipulation
 Vše Třídy Funkce Proměnné Definice typů Výčty Hodnoty výčtu Skupiny Stránky
Wrapper for compressed file.

Datové struktry

struct  CR_FILE

Definice maker

#define CR_CW_OK   0
#define CR_CW_ERR   -1

Výčty

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
}
enum  cr_OpenMode { CR_CW_MODE_READ, CR_CW_MODE_WRITE }

Funkce

const char * cr_compression_suffix (cr_CompressionType comtype)
cr_CompressionType cr_detect_compression (const char *filename)
CR_FILEcr_open (const char *filename, cr_OpenMode mode, cr_CompressionType comtype)
int cr_read (CR_FILE *cr_file, void *buffer, unsigned int len)
int cr_write (CR_FILE *cr_file, const void *buffer, unsigned int len)
int cr_puts (CR_FILE *cr_file, const char *str)
int cr_printf (CR_FILE *cr_file, const char *format,...)
int cr_close (CR_FILE *cr_file)

Detailní popis

Dokumentace k definicím maker

#define CR_CW_ERR   -1

Return value - Error

Definice je uvedena na řádku 62 v souboru compression_wrapper.h.

#define CR_CW_OK   0

Return value - Everything all right

Definice je uvedena na řádku 61 v souboru compression_wrapper.h.

Dokumentace výčtových typů

Compression type.

Hodnoty výčtu:
CR_CW_AUTO_DETECT_COMPRESSION 

Autodetection

CR_CW_UNKNOWN_COMPRESSION 

Unknown compression

CR_CW_NO_COMPRESSION 

No compression

CR_CW_GZ_COMPRESSION 

Gzip compression

CR_CW_BZ2_COMPRESSION 

BZip2 compression

CR_CW_XZ_COMPRESSION 

XZ compression

Definice je uvedena na řádku 33 v souboru compression_wrapper.h.

Open modes.

Hodnoty výčtu:
CR_CW_MODE_READ 

Read mode

CR_CW_MODE_WRITE 

Write mode

Definice je uvedena na řádku 45 v souboru compression_wrapper.h.

Dokumentace funkcí

int cr_close ( CR_FILE cr_file)

Closes the CR_FILE.

Parametry
cr_fileCR_FILE pointer
Návratová hodnota
CR_CW_OK or CR_CW_ERR
const char* cr_compression_suffix ( cr_CompressionType  comtype)

Returns a common suffix for the specified cr_CompressionType.

Parametry
comtypecompression type
Návratová hodnota
common file suffix
cr_CompressionType cr_detect_compression ( const char *  filename)

Detect a compression type of the specified file.

Parametry
filenamefilename
Návratová hodnota
detected type of compression
CR_FILE* cr_open ( const char *  filename,
cr_OpenMode  mode,
cr_CompressionType  comtype 
)

Open/Create the specified file.

Parametry
filenamefilename
modeopen mode
comtypetype of compression
Návratová hodnota
pointer to a CR_FILE or NULL
int cr_printf ( CR_FILE cr_file,
const char *  format,
  ... 
)

Writes a formatted string into the cr_file.

Parametry
cr_fileCR_FILE pointer
formatformat string
...list of additional arguments as specified in format
Návratová hodnota
CR_CW_OK or CR_CW_ERR
int cr_puts ( CR_FILE cr_file,
const char *  str 
)

Writes the string pointed by str into the cr_file.

Parametry
cr_fileCR_FILE pointer
strnull terminated ('\0') string
Návratová hodnota
number of uncompressed bytes writed or CR_CW_ERR
int cr_read ( CR_FILE cr_file,
void *  buffer,
unsigned int  len 
)

Reads an array of len bytes from the CR_FILE.

Parametry
cr_fileCR_FILE pointer
buffertarget buffer
lennumber of bytes to read
Návratová hodnota
CR_CW_OK or CR_CW_ERR
int cr_write ( CR_FILE cr_file,
const void *  buffer,
unsigned int  len 
)

Writes the array of len bytes from buffer to the cr_file.

Parametry
cr_fileCR_FILE pointer
buffersource buffer
lennumber of bytes to read
Návratová hodnota
number of uncompressed bytes readed (0 = EOF) or CR_CW_ERR