em_inflate.h (1652B)
1 /* 2 * em_inflate.h - fast in-memory inflate (gzip/zlib decompressor) definitions 3 * 4 * Copyright (C) 2019 Emmanuel Marty 5 * 6 * This software is provided 'as-is', without any express or implied 7 * warranty. In no event will the authors be held liable for any damages 8 * arising from the use of this software. 9 * 10 * Permission is granted to anyone to use this software for any purpose, 11 * including commercial applications, and to alter it and redistribute it 12 * freely, subject to the following restrictions: 13 * 14 * 1. The origin of this software must not be misrepresented; you must not 15 * claim that you wrote the original software. If you use this software 16 * in a product, an acknowledgment in the product documentation would be 17 * appreciated but is not required. 18 * 2. Altered source versions must be plainly marked as such, and must not be 19 * misrepresented as being the original software. 20 * 3. This notice may not be removed or altered from any source distribution. 21 * 22 * CHANGELOG 23 * 24 * 2024-05-19 Finwo 25 * - Move source files from lib/ to src/ 26 * - Auto-formatting of source files 27 * - Using dynamic buffer as decompression target 28 */ 29 30 #ifndef _EM_INFLATE_H 31 #define _EM_INFLATE_H 32 33 #include <sys/types.h> 34 #include <stdlib.h> 35 36 #include "tidwall/buf.h" 37 38 #ifdef __cplusplus 39 extern "C" { 40 #endif 41 42 /** 43 * Inflate gzip or zlib data 44 * 45 * @param compressed pointer to a buffer containing the compressed data 46 * 47 * @return pointer to a buffer containing the decompressed data, or NULL in case of an error 48 */ 49 struct buf * em_inflate(const struct buf *compressed); 50 51 #ifdef __cplusplus 52 } 53 #endif 54 55 #endif /* _EM_INFLATE_H */