Debian Codegraph @

lzfse/lzfse.h

raw symbols SCIP
1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /*
3 * Copyright (c) 2015-2016, Apple Inc. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
6 *
7 * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
8 *
9 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
10 * in the documentation and/or other materials provided with the distribution.
11 *
12 * 3. Neither the name of the copyright holder(s) nor the names of any contributors may be used to endorse or promote products derived
13 * from this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
17 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
20 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 */
22
23 #ifndef LZFSE_H
24 #define LZFSE_H
25
26 #include <linux/stddef.h>
27 #include <linux/types.h>
28
29 /*! @abstract Get the required scratch buffer size to decompress using LZFSE. */
30 size_t lzfse_decode_scratch_size(void);
31
32 /*! @abstract Decompress a buffer using LZFSE.
33 *
34 * @param dst_buffer
35 * Pointer to the first byte of the destination buffer.
36 *
37 * @param dst_size
38 * Size of the destination buffer in bytes.
39 *
40 * @param src_buffer
41 * Pointer to the first byte of the source buffer.
42 *
43 * @param src_size
44 * Size of the source buffer in bytes.
45 *
46 * @param scratch_buffer
47 * If non-NULL, a pointer to scratch space for the routine to use as workspace;
48 * the routine may use up to lzfse_decode_scratch_size( ) bytes of workspace
49 * during its operation, and will not perform any internal allocations. If
50 * NULL, the routine may allocate its own memory to use during operation via
51 * a single call to malloc( ), and will release it by calling free( ) prior
52 * to returning. For most use, passing NULL is perfectly satisfactory, but if
53 * you require strict control over allocation, you will want to pass an
54 * explicit scratch buffer.
55 *
56 * @return
57 * The number of bytes written to the destination buffer if the input is
58 * successfully decompressed. If there is not enough space in the destination
59 * buffer to hold the entire expanded output, only the first dst_size bytes
60 * will be written to the buffer and dst_size is returned. Note that this
61 * behavior differs from that of lzfse_encode_buffer.
62 */
63 size_t lzfse_decode_buffer(uint8_t *__restrict dst_buffer, size_t dst_size,
64 const uint8_t *__restrict src_buffer, size_t src_size,
65 void *__restrict scratch_buffer);
66
67 #endif /* LZFSE_H */