summaryrefslogtreecommitdiffstats
path: root/lz4.h
diff options
context:
space:
mode:
authoryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2013-10-21 08:03:40 (GMT)
committeryann.collet.73@gmail.com <yann.collet.73@gmail.com@650e7d94-2a16-8b24-b05c-7c0b3f6821cd>2013-10-21 08:03:40 (GMT)
commita78db582d321446b5167de67eec8ba3239b14bbe (patch)
tree394401dcd266164afdaf8e8462d81614c79d517d /lz4.h
parent82bf5be9b0e4e5bd3dbdae4ec2aaa9fe8fc693fb (diff)
downloadlz4-a78db582d321446b5167de67eec8ba3239b14bbe.zip
lz4-a78db582d321446b5167de67eec8ba3239b14bbe.tar.gz
lz4-a78db582d321446b5167de67eec8ba3239b14bbe.tar.bz2
Makefile : support DESTDIR for staged installs. Thanks Jorge Aparicio.
Makefile : make install installs both lz4 and lz4c (Jorge Aparicio) Makefile : removed -Wno-implicit-declaration compilation switch lz4cli.c : include <stduni.h> for isatty() (Luca Barbato) lz4.h : introduced LZ4_MAX_INPUT_SIZE constant (Shay Green) lz4.h : LZ4_compressBound() : unified macro and inline definitions (Shay Green) lz4.h : LZ4_decompressSafe_partial() : clarify comments (Shay Green) lz4.c : LZ4_compress() verify input size condition (Shay Green) bench.c : corrected a bug in free memory size evaluation cmake : install into bin/ directory (Richard Yao) cmake : check for just C compiler (Elan Ruusamae) git-svn-id: https://lz4.googlecode.com/svn/trunk@107 650e7d94-2a16-8b24-b05c-7c0b3f6821cd
Diffstat (limited to 'lz4.h')
-rw-r--r--lz4.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/lz4.h b/lz4.h
index a897bc3..9ef5886 100644
--- a/lz4.h
+++ b/lz4.h
@@ -59,7 +59,7 @@ LZ4_compress() :
Destination buffer must be already allocated,
and must be sized to handle worst cases situations (input data not compressible)
Worst case size evaluation is provided by function LZ4_compressBound()
- inputSize : Max supported value is ~1.9GB
+ inputSize : Max supported value is LZ4_MAX_INPUT_VALUE
return : the number of bytes written in buffer dest
or 0 if the compression fails
@@ -74,9 +74,9 @@ LZ4_decompress_safe() :
//****************************
// Advanced Functions
//****************************
-
-static inline int LZ4_compressBound(int isize) { return ((isize) + ((isize)/255) + 16); }
-#define LZ4_COMPRESSBOUND( isize) ((isize) + ((isize)/255) + 16)
+#define LZ4_MAX_INPUT_SIZE 0x7E000000 // 2 113 929 216 bytes
+#define LZ4_COMPRESSBOUND(isize) ((unsigned int)(isize) > (unsigned int)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
+static inline int LZ4_compressBound(int isize) { return LZ4_COMPRESSBOUND(isize); }
/*
LZ4_compressBound() :
@@ -85,9 +85,9 @@ LZ4_compressBound() :
inline function is recommended for the general case,
macro is also provided when result needs to be evaluated at compilation (such as stack memory allocation).
- isize : is the input size. Max supported value is ~1.9GB
+ isize : is the input size. Max supported value is LZ4_MAX_INPUT_SIZE
return : maximum output size in a "worst case" scenario
- note : this function is limited by "int" range (2^31-1)
+ or 0, if input size is too large ( > LZ4_MAX_INPUT_SIZE)
*/
@@ -99,7 +99,7 @@ LZ4_compress_limitedOutput() :
If it cannot achieve it, compression will stop, and result of the function will be zero.
This function never writes outside of provided output buffer.
- inputSize : Max supported value is ~1.9GB
+ inputSize : Max supported value is LZ4_MAX_INPUT_VALUE
maxOutputSize : is the size of the destination buffer (which must be already allocated)
return : the number of bytes written in buffer 'dest'
or 0 if the compression fails
@@ -125,7 +125,7 @@ int LZ4_decompress_safe_partial (const char* source, char* dest, int inputSize,
LZ4_decompress_safe_partial() :
This function decompress a compressed block of size 'inputSize' at position 'source'
into output buffer 'dest' of size 'maxOutputSize'.
- The function stops decompressing operation as soon as 'targetOutputSize' has been reached,
+ The function tries to stop decompressing operation as soon as 'targetOutputSize' has been reached,
reducing decompression time.
return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize)
Note : this number can be < 'targetOutputSize' should the compressed block to decode be smaller.