![]() |
|
|||
File indexing completed on 2025-05-11 08:24:16
0001 /* 0002 FastLZ - lightning-fast lossless compression library 0003 0004 Copyright (C) 2007 Ariya Hidayat (ariya@kde.org) 0005 Copyright (C) 2006 Ariya Hidayat (ariya@kde.org) 0006 Copyright (C) 2005 Ariya Hidayat (ariya@kde.org) 0007 0008 Permission is hereby granted, free of charge, to any person obtaining a copy 0009 of this software and associated documentation files (the "Software"), to deal 0010 in the Software without restriction, including without limitation the rights 0011 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 0012 copies of the Software, and to permit persons to whom the Software is 0013 furnished to do so, subject to the following conditions: 0014 0015 The above copyright notice and this permission notice shall be included in 0016 all copies or substantial portions of the Software. 0017 0018 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 0019 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 0020 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 0021 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 0022 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 0023 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 0024 THE SOFTWARE. 0025 */ 0026 0027 #ifndef FASTLZ_H 0028 #define FASTLZ_H 0029 0030 #define FASTLZ_VERSION 0x000100 0031 0032 #define FASTLZ_VERSION_MAJOR 0 0033 #define FASTLZ_VERSION_MINOR 0 0034 #define FASTLZ_VERSION_REVISION 0 0035 0036 #define FASTLZ_VERSION_STRING "0.1.0" 0037 0038 #if defined (__cplusplus) 0039 extern "C" { 0040 #endif 0041 0042 /** 0043 Compress a block of data in the input buffer and returns the size of 0044 compressed block. The size of input buffer is specified by length. The 0045 minimum input buffer size is 16. 0046 0047 The output buffer must be at least 5% larger than the input buffer 0048 and can not be smaller than 66 bytes. 0049 0050 If the input is not compressible, the return value might be larger than 0051 length (input buffer size). 0052 0053 The input buffer and the output buffer can not overlap. 0054 */ 0055 0056 int fastlz_compress(const void* input, int length, void* output); 0057 0058 /** 0059 Decompress a block of compressed data and returns the size of the 0060 decompressed block. If error occurs, e.g. the compressed data is 0061 corrupted or the output buffer is not large enough, then 0 (zero) 0062 will be returned instead. 0063 0064 The input buffer and the output buffer can not overlap. 0065 0066 Decompression is memory safe and guaranteed not to write the output buffer 0067 more than what is specified in maxout. 0068 */ 0069 0070 int fastlz_decompress(const void* input, int length, void* output, int maxout); 0071 0072 /** 0073 Compress a block of data in the input buffer and returns the size of 0074 compressed block. The size of input buffer is specified by length. The 0075 minimum input buffer size is 16. 0076 0077 The output buffer must be at least 5% larger than the input buffer 0078 and can not be smaller than 66 bytes. 0079 0080 If the input is not compressible, the return value might be larger than 0081 length (input buffer size). 0082 0083 The input buffer and the output buffer can not overlap. 0084 0085 Compression level can be specified in parameter level. At the moment, 0086 only level 1 and level 2 are supported. 0087 Level 1 is the fastest compression and generally useful for short data. 0088 Level 2 is slightly slower but it gives better compression ratio. 0089 0090 Note that the compressed data, regardless of the level, can always be 0091 decompressed using the function fastlz_decompress above. 0092 */ 0093 0094 int fastlz_compress_level(int level, const void* input, int length, void* output); 0095 0096 #if defined (__cplusplus) 0097 } 0098 #endif 0099 0100 #endif /* FASTLZ_H */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |