lz4-ruby 0.1.6-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
data/ext/lz4ruby/lz4.h ADDED
@@ -0,0 +1,120 @@
1
+ /*
2
+ LZ4 - Fast LZ compression algorithm
3
+ Header File
4
+ Copyright (C) 2011-2012, Yann Collet.
5
+ BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
6
+
7
+ Redistribution and use in source and binary forms, with or without
8
+ modification, are permitted provided that the following conditions are
9
+ met:
10
+
11
+ * Redistributions of source code must retain the above copyright
12
+ notice, this list of conditions and the following disclaimer.
13
+ * Redistributions in binary form must reproduce the above
14
+ copyright notice, this list of conditions and the following disclaimer
15
+ in the documentation and/or other materials provided with the
16
+ distribution.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
+
30
+ You can contact the author at :
31
+ - LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
32
+ - LZ4 source repository : http://code.google.com/p/lz4/
33
+ */
34
+ #pragma once
35
+
36
+ #if defined (__cplusplus)
37
+ extern "C" {
38
+ #endif
39
+
40
+
41
+ //****************************
42
+ // Simple Functions
43
+ //****************************
44
+
45
+ int LZ4_compress (const char* source, char* dest, int isize);
46
+ int LZ4_uncompress (const char* source, char* dest, int osize);
47
+
48
+ /*
49
+ LZ4_compress() :
50
+ isize : is the input size. Max supported value is ~1.9GB
51
+ return : the number of bytes written in buffer dest
52
+ or 0 if the compression fails (if LZ4_COMPRESSMIN is set)
53
+ note : destination buffer must be already allocated.
54
+ destination buffer must be sized to handle worst cases situations (input data not compressible)
55
+ worst case size evaluation is provided by function LZ4_compressBound()
56
+
57
+ LZ4_uncompress() :
58
+ osize : is the output size, therefore the original size
59
+ return : the number of bytes read in the source buffer
60
+ If the source stream is malformed, the function will stop decoding and return a negative result, indicating the byte position of the faulty instruction
61
+ This function never writes beyond dest + osize, and is therefore protected against malicious data packets
62
+ note : destination buffer must be already allocated
63
+ */
64
+
65
+
66
+ //****************************
67
+ // Advanced Functions
68
+ //****************************
69
+
70
+ int LZ4_compressBound(int isize);
71
+
72
+ /*
73
+ LZ4_compressBound() :
74
+ Provides the maximum size that LZ4 may output in a "worst case" scenario (input data not compressible)
75
+ primarily useful for memory allocation of output buffer.
76
+
77
+ isize : is the input size. Max supported value is ~1.9GB
78
+ return : maximum output size in a "worst case" scenario
79
+ note : this function is limited by "int" range (2^31-1)
80
+ */
81
+
82
+
83
+ int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize);
84
+
85
+ /*
86
+ LZ4_uncompress_unknownOutputSize() :
87
+ isize : is the input size, therefore the compressed size
88
+ maxOutputSize : is the size of the destination buffer (which must be already allocated)
89
+ return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize)
90
+ If the source stream is malformed, the function will stop decoding and return a negative result, indicating the byte position of the faulty instruction
91
+ This function never writes beyond dest + maxOutputSize, and is therefore protected against malicious data packets
92
+ note : Destination buffer must be already allocated.
93
+ This version is slightly slower than LZ4_uncompress()
94
+ */
95
+
96
+
97
+ int LZ4_compressCtx(void** ctx, const char* source, char* dest, int isize);
98
+ int LZ4_compress64kCtx(void** ctx, const char* source, char* dest, int isize);
99
+
100
+ /*
101
+ LZ4_compressCtx() :
102
+ This function explicitly handles the CTX memory structure.
103
+ It avoids allocating/deallocating memory between each call, improving performance when malloc is heavily invoked.
104
+ This function is only useful when memory is allocated into the heap (HASH_LOG value beyond STACK_LIMIT)
105
+ Performance difference will be noticeable only when repetitively calling the compression function over many small segments.
106
+ Note : by default, memory is allocated into the stack, therefore "malloc" is not invoked.
107
+ LZ4_compress64kCtx() :
108
+ Same as LZ4_compressCtx(), but specific to small inputs (<64KB).
109
+ isize *Must* be <64KB, otherwise the output will be corrupted.
110
+
111
+ On first call : provide a *ctx=NULL; It will be automatically allocated.
112
+ On next calls : reuse the same ctx pointer.
113
+ Use different pointers for different threads when doing multi-threading.
114
+
115
+ */
116
+
117
+
118
+ #if defined (__cplusplus)
119
+ }
120
+ #endif