summaryrefslogtreecommitdiff
path: root/thirdparty/misc/fastlz.h
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/misc/fastlz.h')
-rw-r--r--thirdparty/misc/fastlz.h60
1 files changed, 29 insertions, 31 deletions
diff --git a/thirdparty/misc/fastlz.h b/thirdparty/misc/fastlz.h
index e5ca8dfc02..e53dbfbb56 100644
--- a/thirdparty/misc/fastlz.h
+++ b/thirdparty/misc/fastlz.h
@@ -1,9 +1,6 @@
/*
- FastLZ - lightning-fast lossless compression library
-
- Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
- Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
- Copyright (C) 2005 Ariya Hidayat (ariya@kde.org)
+ FastLZ - Byte-aligned LZ77 compression library
+ Copyright (C) 2005-2020 Ariya Hidayat <ariya.hidayat@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -27,15 +24,15 @@
#ifndef FASTLZ_H
#define FASTLZ_H
-#define FASTLZ_VERSION 0x000100
+#define FASTLZ_VERSION 0x000500
-#define FASTLZ_VERSION_MAJOR 0
-#define FASTLZ_VERSION_MINOR 0
-#define FASTLZ_VERSION_REVISION 0
+#define FASTLZ_VERSION_MAJOR 0
+#define FASTLZ_VERSION_MINOR 5
+#define FASTLZ_VERSION_REVISION 0
-#define FASTLZ_VERSION_STRING "0.1.0"
+#define FASTLZ_VERSION_STRING "0.5.0"
-#if defined (__cplusplus)
+#if defined(__cplusplus)
extern "C" {
#endif
@@ -51,9 +48,18 @@ extern "C" {
length (input buffer size).
The input buffer and the output buffer can not overlap.
+
+ Compression level can be specified in parameter level. At the moment,
+ only level 1 and level 2 are supported.
+ Level 1 is the fastest compression and generally useful for short data.
+ Level 2 is slightly slower but it gives better compression ratio.
+
+ Note that the compressed data, regardless of the level, can always be
+ decompressed using the function fastlz_decompress below.
*/
-int fastlz_compress(const void* input, int length, void* output);
+int fastlz_compress_level(int level, const void* input, int length,
+ void* output);
/**
Decompress a block of compressed data and returns the size of the
@@ -65,35 +71,27 @@ int fastlz_compress(const void* input, int length, void* output);
Decompression is memory safe and guaranteed not to write the output buffer
more than what is specified in maxout.
+
+ Note that the decompression will always work, regardless of the
+ compression level specified in fastlz_compress_level above (when
+ producing the compressed block).
*/
int fastlz_decompress(const void* input, int length, void* output, int maxout);
/**
- Compress a block of data in the input buffer and returns the size of
- compressed block. The size of input buffer is specified by length. The
- minimum input buffer size is 16.
+ DEPRECATED.
- The output buffer must be at least 5% larger than the input buffer
- and can not be smaller than 66 bytes.
-
- If the input is not compressible, the return value might be larger than
- length (input buffer size).
+ This is similar to fastlz_compress_level above, but with the level
+ automatically chosen.
- The input buffer and the output buffer can not overlap.
-
- Compression level can be specified in parameter level. At the moment,
- only level 1 and level 2 are supported.
- Level 1 is the fastest compression and generally useful for short data.
- Level 2 is slightly slower but it gives better compression ratio.
-
- Note that the compressed data, regardless of the level, can always be
- decompressed using the function fastlz_decompress above.
+ This function is deprecated and it will be completely removed in some future
+ version.
*/
-int fastlz_compress_level(int level, const void* input, int length, void* output);
+int fastlz_compress(const void* input, int length, void* output);
-#if defined (__cplusplus)
+#if defined(__cplusplus)
}
#endif