libfst 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/fastlz.h ADDED
@@ -0,0 +1,109 @@
1
+ /*
2
+ FastLZ - lightning-fast lossless compression library
3
+
4
+ Copyright (C) 2007 Ariya Hidayat (ariya@kde.org)
5
+ Copyright (C) 2006 Ariya Hidayat (ariya@kde.org)
6
+ Copyright (C) 2005 Ariya Hidayat (ariya@kde.org)
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ SPDX-License-Identifier: MIT
27
+ */
28
+
29
+ #ifndef FASTLZ_H
30
+ #define FASTLZ_H
31
+
32
+ #include <inttypes.h>
33
+
34
+ #define flzuint8 uint8_t
35
+ #define flzuint16 uint16_t
36
+ #define flzuint32 uint32_t
37
+
38
+
39
+ #define FASTLZ_VERSION 0x000100
40
+
41
+ #define FASTLZ_VERSION_MAJOR 0
42
+ #define FASTLZ_VERSION_MINOR 0
43
+ #define FASTLZ_VERSION_REVISION 0
44
+
45
+ #define FASTLZ_VERSION_STRING "0.1.0"
46
+
47
+ #if defined (__cplusplus)
48
+ extern "C" {
49
+ #endif
50
+
51
+ /**
52
+ Compress a block of data in the input buffer and returns the size of
53
+ compressed block. The size of input buffer is specified by length. The
54
+ minimum input buffer size is 16.
55
+
56
+ The output buffer must be at least 5% larger than the input buffer
57
+ and can not be smaller than 66 bytes.
58
+
59
+ If the input is not compressible, the return value might be larger than
60
+ length (input buffer size).
61
+
62
+ The input buffer and the output buffer can not overlap.
63
+ */
64
+
65
+ int fastlz_compress(const void* input, int length, void* output);
66
+
67
+ /**
68
+ Decompress a block of compressed data and returns the size of the
69
+ decompressed block. If error occurs, e.g. the compressed data is
70
+ corrupted or the output buffer is not large enough, then 0 (zero)
71
+ will be returned instead.
72
+
73
+ The input buffer and the output buffer can not overlap.
74
+
75
+ Decompression is memory safe and guaranteed not to write the output buffer
76
+ more than what is specified in maxout.
77
+ */
78
+
79
+ int fastlz_decompress(const void* input, int length, void* output, int maxout);
80
+
81
+ /**
82
+ Compress a block of data in the input buffer and returns the size of
83
+ compressed block. The size of input buffer is specified by length. The
84
+ minimum input buffer size is 16.
85
+
86
+ The output buffer must be at least 5% larger than the input buffer
87
+ and can not be smaller than 66 bytes.
88
+
89
+ If the input is not compressible, the return value might be larger than
90
+ length (input buffer size).
91
+
92
+ The input buffer and the output buffer can not overlap.
93
+
94
+ Compression level can be specified in parameter level. At the moment,
95
+ only level 1 and level 2 are supported.
96
+ Level 1 is the fastest compression and generally useful for short data.
97
+ Level 2 is slightly slower but it gives better compression ratio.
98
+
99
+ Note that the compressed data, regardless of the level, can always be
100
+ decompressed using the function fastlz_decompress above.
101
+ */
102
+
103
+ int fastlz_compress_level(int level, const void* input, int length, void* output);
104
+
105
+ #if defined (__cplusplus)
106
+ }
107
+ #endif
108
+
109
+ #endif /* FASTLZ_H */
data/ext/fst_config.h ADDED
@@ -0,0 +1,11 @@
1
+ /* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix). */
2
+ #if !defined(__MINGW32__) && !defined(__FreeBSD__)
3
+ # define HAVE_ALLOCA_H 1
4
+ #endif
5
+
6
+ /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
7
+ #define HAVE_FSEEKO 1
8
+
9
+ #define _POSIX_C_SOURCE 200809L
10
+ #define HAVE_LIBPTHREAD
11
+
@@ -0,0 +1,52 @@
1
+ /*
2
+ * Copyright (c) 2009-2018 Tony Bybell.
3
+ *
4
+ * Permission is hereby granted, free of charge, to any person obtaining a
5
+ * copy of this software and associated documentation files (the "Software"),
6
+ * to deal in the Software without restriction, including without limitation
7
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
+ * and/or sell copies of the Software, and to permit persons to whom the
9
+ * Software is furnished to do so, subject to the following conditions:
10
+ *
11
+ * The above copyright notice and this permission notice shall be included in
12
+ * all copies or substantial portions of the Software.
13
+ *
14
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20
+ * DEALINGS IN THE SOFTWARE.
21
+ *
22
+ * SPDX-License-Identifier: MIT
23
+ */
24
+
25
+ #ifndef WIN_UNISTD_H
26
+ #define WIN_UNISTD_H
27
+
28
+ #include <stdlib.h>
29
+ #ifdef _WIN64
30
+ #include <io.h>
31
+ #else
32
+ #include <sys/io.h>
33
+ #endif
34
+
35
+ #include <process.h>
36
+
37
+ #define ftruncate _chsize_s
38
+ #define unlink _unlink
39
+ #define fileno _fileno
40
+ #define lseek _lseeki64
41
+
42
+ #ifdef _WIN64
43
+ #define ssize_t __int64
44
+ #define SSIZE_MAX 9223372036854775807i64
45
+ #else
46
+ #define ssize_t long
47
+ #define SSIZE_MAX 2147483647L
48
+ #endif
49
+
50
+ #include "stdint.h"
51
+
52
+ #endif //WIN_UNISTD_H