diff options
author | alk3pInjection <webmaster@raspii.tech> | 2021-08-30 16:43:38 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2021-08-30 16:43:38 +0800 |
commit | cbe033a53bfe49d980774e59025e3b2af91778b7 (patch) | |
tree | 558535f91276162e0be70d07b34ed2e6577e38ad /programs/lz4io.h | |
parent | fdd43c66dd9e77283aa8f7e52a881be44d622441 (diff) | |
parent | d44371841a2f1728a3f36839fd4b7e872d0927d3 (diff) |
Merge tag 'v1.9.3' into lineage-18.1HEADlineage-18.1
Change-Id: Iad56c1b17a32f9f356a4c1ff9557f0e79addf481
Diffstat (limited to 'programs/lz4io.h')
-rw-r--r-- | programs/lz4io.h | 64 |
1 files changed, 45 insertions, 19 deletions
diff --git a/programs/lz4io.h b/programs/lz4io.h index 22c5e3e..d6d7eee 100644 --- a/programs/lz4io.h +++ b/programs/lz4io.h @@ -39,70 +39,96 @@ /* ************************************************** */ /* Special input/output values */ /* ************************************************** */ +#define stdinmark "stdin" +#define stdoutmark "stdout" #define NULL_OUTPUT "null" -static const char stdinmark[] = "stdin"; -static const char stdoutmark[] = "stdout"; #ifdef _WIN32 -static const char nulmark[] = "nul"; +#define nulmark "nul" #else -static const char nulmark[] = "/dev/null"; +#define nulmark "/dev/null" #endif +/* ************************************************** */ +/* ****************** Type Definitions ************** */ +/* ************************************************** */ + +typedef struct LZ4IO_prefs_s LZ4IO_prefs_t; + +LZ4IO_prefs_t* LZ4IO_defaultPreferences(void); +void LZ4IO_freePreferences(LZ4IO_prefs_t* prefs); + +/* Size in bytes of a legacy block header in little-endian format */ +#define LZIO_LEGACY_BLOCK_HEADER_SIZE 4 /* ************************************************** */ /* ****************** Functions ********************* */ /* ************************************************** */ -int LZ4IO_compressFilename (const char* input_filename, const char* output_filename, int compressionlevel); -int LZ4IO_decompressFilename(const char* input_filename, const char* output_filename); +/* if output_filename == stdoutmark, writes to stdout */ +int LZ4IO_compressFilename(const char* input_filename, const char* output_filename, int compressionlevel, const LZ4IO_prefs_t* prefs); +int LZ4IO_decompressFilename(const char* input_filename, const char* output_filename, const LZ4IO_prefs_t* prefs); -int LZ4IO_compressMultipleFilenames(const char** inFileNamesTable, int ifntSize, const char* suffix, int compressionlevel); -int LZ4IO_decompressMultipleFilenames(const char** inFileNamesTable, int ifntSize, const char* suffix); +/* if suffix == stdoutmark, writes to stdout */ +int LZ4IO_compressMultipleFilenames(const char** inFileNamesTable, int ifntSize, const char* suffix, int compressionlevel, const LZ4IO_prefs_t* prefs); +int LZ4IO_decompressMultipleFilenames(const char** inFileNamesTable, int ifntSize, const char* suffix, const LZ4IO_prefs_t* prefs); /* ************************************************** */ /* ****************** Parameters ******************** */ /* ************************************************** */ -int LZ4IO_setDictionaryFilename(const char* dictionaryFilename); +int LZ4IO_setDictionaryFilename(LZ4IO_prefs_t* const prefs, const char* dictionaryFilename); + +/* Default setting : passThrough = 0; + return : passThrough mode (0/1) */ +int LZ4IO_setPassThrough(LZ4IO_prefs_t* const prefs, int yes); /* Default setting : overwrite = 1; return : overwrite mode (0/1) */ -int LZ4IO_setOverwrite(int yes); +int LZ4IO_setOverwrite(LZ4IO_prefs_t* const prefs, int yes); /* Default setting : testMode = 0; return : testMode (0/1) */ -int LZ4IO_setTestMode(int yes); +int LZ4IO_setTestMode(LZ4IO_prefs_t* const prefs, int yes); /* blockSizeID : valid values : 4-5-6-7 return : 0 if error, blockSize if OK */ -size_t LZ4IO_setBlockSizeID(unsigned blockSizeID); +size_t LZ4IO_setBlockSizeID(LZ4IO_prefs_t* const prefs, unsigned blockSizeID); + +/* blockSize : valid values : 32 -> 4MB + return : 0 if error, actual blocksize if OK */ +size_t LZ4IO_setBlockSize(LZ4IO_prefs_t* const prefs, size_t blockSize); /* Default setting : independent blocks */ typedef enum { LZ4IO_blockLinked=0, LZ4IO_blockIndependent} LZ4IO_blockMode_t; -int LZ4IO_setBlockMode(LZ4IO_blockMode_t blockMode); +int LZ4IO_setBlockMode(LZ4IO_prefs_t* const prefs, LZ4IO_blockMode_t blockMode); /* Default setting : no block checksum */ -int LZ4IO_setBlockChecksumMode(int xxhash); +int LZ4IO_setBlockChecksumMode(LZ4IO_prefs_t* const prefs, int xxhash); /* Default setting : stream checksum enabled */ -int LZ4IO_setStreamChecksumMode(int xxhash); +int LZ4IO_setStreamChecksumMode(LZ4IO_prefs_t* const prefs, int xxhash); /* Default setting : 0 (no notification) */ int LZ4IO_setNotificationLevel(int level); /* Default setting : 0 (disabled) */ -int LZ4IO_setSparseFile(int enable); +int LZ4IO_setSparseFile(LZ4IO_prefs_t* const prefs, int enable); /* Default setting : 0 == no content size present in frame header */ -int LZ4IO_setContentSize(int enable); +int LZ4IO_setContentSize(LZ4IO_prefs_t* const prefs, int enable); /* Default setting : 0 == src file preserved */ -void LZ4IO_setRemoveSrcFile(unsigned flag); +void LZ4IO_setRemoveSrcFile(LZ4IO_prefs_t* const prefs, unsigned flag); /* Default setting : 0 == favor compression ratio * Note : 1 only works for high compression levels (10+) */ -void LZ4IO_favorDecSpeed(int favor); +void LZ4IO_favorDecSpeed(LZ4IO_prefs_t* const prefs, int favor); + + +/* implement --list + * @return 0 on success, 1 on error */ +int LZ4IO_displayCompressedFilesInfo(const char** inFileNames, size_t ifnIdx); #endif /* LZ4IO_H_237902873 */ |