source: thirdparty/blosc/internal-complibs/zstd-0.7.4/legacy/zstd_v03.h @ 8ebc79b

Revision 8ebc79b, 4.0 KB checked in by Hal Finkel <hfinkel@…>, 8 years ago (diff)

Add the other internal compression libraries from blocs

  • Property mode set to 100644
Line 
1/*
2    zstd_v03 - decoder for 0.3 format
3    Header File
4    Copyright (C) 2015, Yann Collet.
5
6    BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
7
8    Redistribution and use in source and binary forms, with or without
9    modification, are permitted provided that the following conditions are
10    met:
11    * Redistributions of source code must retain the above copyright
12    notice, this list of conditions and the following disclaimer.
13    * Redistributions in binary form must reproduce the above
14    copyright notice, this list of conditions and the following disclaimer
15    in the documentation and/or other materials provided with the
16    distribution.
17    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18    "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21    OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23    LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24    DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25    THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29    You can contact the author at :
30    - zstd source repository : https://github.com/Cyan4973/zstd
31    - ztsd public forum : https://groups.google.com/forum/#!forum/lz4c
32*/
33#pragma once
34
35#if defined (__cplusplus)
36extern "C" {
37#endif
38
39/* *************************************
40*  Includes
41***************************************/
42#include <stddef.h>   /* size_t */
43
44
45/* *************************************
46*  Simple one-step function
47***************************************/
48/**
49ZSTDv03_decompress() : decompress ZSTD frames compliant with v0.3.x format
50    compressedSize : is the exact source size
51    maxOriginalSize : is the size of the 'dst' buffer, which must be already allocated.
52                      It must be equal or larger than originalSize, otherwise decompression will fail.
53    return : the number of bytes decompressed into destination buffer (originalSize)
54             or an errorCode if it fails (which can be tested using ZSTDv01_isError())
55*/
56size_t ZSTDv03_decompress( void* dst, size_t maxOriginalSize,
57                     const void* src, size_t compressedSize);
58
59/**
60ZSTDv03_isError() : tells if the result of ZSTDv03_decompress() is an error
61*/
62unsigned ZSTDv03_isError(size_t code);
63
64
65/* *************************************
66*  Advanced functions
67***************************************/
68typedef struct ZSTDv03_Dctx_s ZSTDv03_Dctx;
69ZSTDv03_Dctx* ZSTDv03_createDCtx(void);
70size_t ZSTDv03_freeDCtx(ZSTDv03_Dctx* dctx);
71
72size_t ZSTDv03_decompressDCtx(void* ctx,
73                              void* dst, size_t maxOriginalSize,
74                        const void* src, size_t compressedSize);
75
76/* *************************************
77*  Streaming functions
78***************************************/
79size_t ZSTDv03_resetDCtx(ZSTDv03_Dctx* dctx);
80
81size_t ZSTDv03_nextSrcSizeToDecompress(ZSTDv03_Dctx* dctx);
82size_t ZSTDv03_decompressContinue(ZSTDv03_Dctx* dctx, void* dst, size_t maxDstSize, const void* src, size_t srcSize);
83/**
84  Use above functions alternatively.
85  ZSTD_nextSrcSizeToDecompress() tells how much bytes to provide as 'srcSize' to ZSTD_decompressContinue().
86  ZSTD_decompressContinue() will use previous data blocks to improve compression if they are located prior to current block.
87  Result is the number of bytes regenerated within 'dst'.
88  It can be zero, which is not an error; it just means ZSTD_decompressContinue() has decoded some header.
89*/
90
91/* *************************************
92*  Prefix - version detection
93***************************************/
94#define ZSTDv03_magicNumber 0xFD2FB523   /* v0.3 */
95
96
97#if defined (__cplusplus)
98}
99#endif
Note: See TracBrowser for help on using the repository browser.