|
Packit Service |
d40955 |
/*
|
|
Packit Service |
d40955 |
* Copyright (c) 2020 Red Hat, Inc.
|
|
Packit Service |
d40955 |
*
|
|
Packit Service |
d40955 |
* This program is free software; you can redistribute it and/or
|
|
Packit Service |
d40955 |
* modify it under the terms of the GNU General Public License
|
|
Packit Service |
d40955 |
* as published by the Free Software Foundation; either version 2
|
|
Packit Service |
d40955 |
* of the License, or (at your option) any later version.
|
|
Packit Service |
d40955 |
*
|
|
Packit Service |
d40955 |
* This program is distributed in the hope that it will be useful,
|
|
Packit Service |
d40955 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
d40955 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
d40955 |
* GNU General Public License for more details.
|
|
Packit Service |
d40955 |
*
|
|
Packit Service |
d40955 |
* You should have received a copy of the GNU General Public License
|
|
Packit Service |
d40955 |
* along with this program; if not, write to the Free Software
|
|
Packit Service |
d40955 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
d40955 |
* 02110-1301, USA.
|
|
Packit Service |
d40955 |
*
|
|
Packit Service |
d40955 |
* $Id: //eng/vdo-releases/aluminum/src/c++/vdo/base/lz4.h#1 $
|
|
Packit Service |
d40955 |
*/
|
|
Packit Service |
d40955 |
|
|
Packit Service |
d40955 |
#ifndef LZ4_H
|
|
Packit Service |
d40955 |
#define LZ4_H
|
|
Packit Service |
d40955 |
|
|
Packit Service |
d40955 |
/*
|
|
Packit Service |
d40955 |
LZ4 - Fast LZ compression algorithm
|
|
Packit Service |
d40955 |
Header File
|
|
Packit Service |
d40955 |
Copyright (C) 2011-2013, Yann Collet.
|
|
Packit Service |
d40955 |
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
|
|
Packit Service |
d40955 |
|
|
Packit Service |
d40955 |
Redistribution and use in source and binary forms, with or without
|
|
Packit Service |
d40955 |
modification, are permitted provided that the following conditions are
|
|
Packit Service |
d40955 |
met:
|
|
Packit Service |
d40955 |
|
|
Packit Service |
d40955 |
* Redistributions of source code must retain the above copyright
|
|
Packit Service |
d40955 |
notice, this list of conditions and the following disclaimer.
|
|
Packit Service |
d40955 |
* Redistributions in binary form must reproduce the above
|
|
Packit Service |
d40955 |
copyright notice, this list of conditions and the following disclaimer
|
|
Packit Service |
d40955 |
in the documentation and/or other materials provided with the
|
|
Packit Service |
d40955 |
distribution.
|
|
Packit Service |
d40955 |
|
|
Packit Service |
d40955 |
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
Packit Service |
d40955 |
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
Packit Service |
d40955 |
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
Packit Service |
d40955 |
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
Packit Service |
d40955 |
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
Packit Service |
d40955 |
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
Packit Service |
d40955 |
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Packit Service |
d40955 |
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Packit Service |
d40955 |
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Packit Service |
d40955 |
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
Packit Service |
d40955 |
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit Service |
d40955 |
|
|
Packit Service |
d40955 |
You can contact the author at :
|
|
Packit Service |
d40955 |
- LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
|
|
Packit Service |
d40955 |
- LZ4 source repository : http://code.google.com/p/lz4/
|
|
Packit Service |
d40955 |
*/
|
|
Packit Service |
d40955 |
|
|
Packit Service |
d40955 |
/*
|
|
Packit Service |
d40955 |
* With authors permission dual licensed as BSD/GPL for linux kernel
|
|
Packit Service |
d40955 |
*
|
|
Packit Service |
d40955 |
* Origin: http://lz4.googlecode.com/svn/trunk
|
|
Packit Service |
d40955 |
* Revision: 88
|
|
Packit Service |
d40955 |
*/
|
|
Packit Service |
d40955 |
|
|
Packit Service |
d40955 |
/**
|
|
Packit Service |
d40955 |
* Compress 'isize' bytes from 'source' into an output buffer 'dest' of
|
|
Packit Service |
d40955 |
* maximum size 'maxOutputSize'. If it cannot achieve it, compression will
|
|
Packit Service |
d40955 |
* stop, and result of the function will be zero. This function never
|
|
Packit Service |
d40955 |
* writes outside of provided output buffer.
|
|
Packit Service |
d40955 |
*
|
|
Packit Service |
d40955 |
* @param ctx Scratch space that will not fit on the stack
|
|
Packit Service |
d40955 |
* @param source Input data
|
|
Packit Service |
d40955 |
* @param dest Output data
|
|
Packit Service |
d40955 |
* @param isize Input size. Max supported value is ~1.9GB
|
|
Packit Service |
d40955 |
* @param maxOutputSize Size of the destination buffer
|
|
Packit Service |
d40955 |
*
|
|
Packit Service |
d40955 |
* @return the number of bytes written in buffer 'dest' or 0 if the
|
|
Packit Service |
d40955 |
* compression fails
|
|
Packit Service |
d40955 |
**/
|
|
Packit Service |
d40955 |
int LZ4_compress_ctx_limitedOutput(void *ctx,
|
|
Packit Service |
d40955 |
const char *source,
|
|
Packit Service |
d40955 |
char *dest,
|
|
Packit Service |
d40955 |
int isize,
|
|
Packit Service |
d40955 |
int maxOutputSize);
|
|
Packit Service |
d40955 |
|
|
Packit Service |
d40955 |
/**
|
|
Packit Service |
d40955 |
* Return the size of the "ctx" block needed by the compression method.
|
|
Packit Service |
d40955 |
*
|
|
Packit Service |
d40955 |
* @return the number of bytes needed in the "ctx" argument to
|
|
Packit Service |
d40955 |
* Z4_compress_ctx_limitedOutput
|
|
Packit Service |
d40955 |
**/
|
|
Packit Service |
d40955 |
int LZ4_context_size(void);
|
|
Packit Service |
d40955 |
|
|
Packit Service |
d40955 |
/**
|
|
Packit Service |
d40955 |
* Uncompress 'isize' bytes from 'source' into an output buffer 'dest' of
|
|
Packit Service |
d40955 |
* maximum size 'maxOutputSize'. This function never writes beyond dest +
|
|
Packit Service |
d40955 |
* maxOutputSize, and is therefore protected against malicious data packets
|
|
Packit Service |
d40955 |
*
|
|
Packit Service |
d40955 |
* @param source Input data
|
|
Packit Service |
d40955 |
* @param dest Output data
|
|
Packit Service |
d40955 |
* @param isize Input size, therefore the compressed size
|
|
Packit Service |
d40955 |
* @param maxOutputSize Size of the destination buffer
|
|
Packit Service |
d40955 |
*
|
|
Packit Service |
d40955 |
* @return the number of bytes decoded in the destination buffer
|
|
Packit Service |
d40955 |
* (necessarily <= maxOutputSize). If the source stream is
|
|
Packit Service |
d40955 |
* malformed, the function will stop decoding and return a negative
|
|
Packit Service |
d40955 |
* result, indicating the byte position of the faulty instruction
|
|
Packit Service |
d40955 |
**/
|
|
Packit Service |
d40955 |
int LZ4_uncompress_unknownOutputSize(const char *source,
|
|
Packit Service |
d40955 |
char *dest,
|
|
Packit Service |
d40955 |
int isize,
|
|
Packit Service |
d40955 |
int maxOutputSize);
|
|
Packit Service |
d40955 |
|
|
Packit Service |
d40955 |
#endif // LZ4_H
|