| 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 |
|
| 23 |
#ifndef _EM_INFLATE_H |
| 24 |
#define _EM_INFLATE_H |
| 25 |
|
| 26 |
#include <sys/types.h> |
| 27 |
#include <stdlib.h> |
| 28 |
|
| 29 |
#ifdef __cplusplus |
| 30 |
extern "C" { |
| 31 |
#endif |
| 32 |
|
| 33 |
/** |
| 34 |
* Inflate gzip or zlib data |
| 35 |
* |
| 36 |
* @param pCompressedData pointer to start of zlib data |
| 37 |
* @param nCompressedDataSize size of zlib data, in bytes |
| 38 |
* @param pOutData pointer to start of decompression buffer |
| 39 |
* @param nMaxOutDataSize maximum size of decompression buffer, in bytes |
| 40 |
* |
| 41 |
* @return number of bytes decompressed, or -1 in case of an error |
| 42 |
*/ |
| 43 |
size_t em_inflate(const void *pCompressedData, size_t nCompressedDataSize, unsigned char *pOutData, size_t nMaxOutDataSize); |
| 44 |
|
| 45 |
#ifdef __cplusplus |
| 46 |
} |
| 47 |
#endif |
| 48 |
|
| 49 |
#endif /* _EM_INFLATE_H */ |