Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

misc/internal/lzf.h

00001 /*
00002  * Copyright (c) 2000 Marc Alexander Lehmann <pcg@goof.com>
00003  * 
00004  * Redistribution and use in source and binary forms, with or without modifica-
00005  * tion, are permitted provided that the following conditions are met:
00006  * 
00007  *   1.  Redistributions of source code must retain the above copyright notice,
00008  *       this list of conditions and the following disclaimer.
00009  * 
00010  *   2.  Redistributions in binary form must reproduce the above copyright
00011  *       notice, this list of conditions and the following disclaimer in the
00012  *       documentation and/or other materials provided with the distribution.
00013  * 
00014  *   3.  The name of the author may not be used to endorse or promote products
00015  *       derived from this software without specific prior written permission.
00016  * 
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
00018  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MER-
00019  * CHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
00020  * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPE-
00021  * CIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00022  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00023  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00024  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTH-
00025  * ERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
00026  * OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00029 #ifndef LZF_H
00030 #define LZF_H
00031 
00032 /***********************************************************************
00033 **
00034 **  lzf -- an extremely fast/free compression/decompression-method
00035 **  http://liblzf.plan9.de/
00036 **
00037 **  Based on ideas by Hermann Vogt, but liblzf is a total
00038 **  re-implementation of LZV that is not compatible to the
00039 **  original lzv code.
00040 **
00041 **  This algorithm is believed to be patent-free.
00042 **
00043 ***********************************************************************/
00044 
00045 /*
00046  * Compress in_len bytes stored at the memory block starting at
00047  * in_data and write the result to out_data, up to a maximum length
00048  * of out_len bytes.
00049  *
00050  * If the output buffer is not large enough or any error occurs
00051  * return 0, otherwise return the number of bytes used (which might
00052  * be considerably larger than in_len, so it makes sense to always
00053  * use out_len == in_len).
00054  *
00055  * lzf_compress might use different algorithms on different systems and
00056  * thus might result in different compressed strings depending on the
00057  * phase of the moon or similar factors. However, all these strings are
00058  * architecture-independent and will result in the original data when
00059  * decompressed using lzf_decompress.
00060  *
00061  * The buffers must not be overlapping.
00062  *
00063  */
00064 unsigned int 
00065 lzf_compress (const void *const in_data,  unsigned int in_len,
00066               void             *out_data, unsigned int out_len);
00067 
00068 /*
00069  * Decompress data compressed with some version of the lzf_compress
00070  * function and stored at location in_data and length in_len. The result
00071  * will be stored at out_data up to a maximum of out_len characters.
00072  *
00073  * If * the output buffer is not large enough to hold the decompressed
00074  * data, a 0 is returned and errno is set to E2BIG. Otherwise the number
00075  * of decompressed bytes (i.e. the original length of the data) is
00076  * returned.
00077  *
00078  * If an error in the compressed data is detected, a zero is returned and
00079  * errno is set to EINVAL.
00080  *
00081  * This function is very fast, about as fats as a copying loop.
00082  */
00083 unsigned int 
00084 lzf_decompress (const void *const in_data,  unsigned int in_len,
00085                 void             *out_data, unsigned int out_len);
00086 
00087 #endif
00088 

Generated on Tue Nov 5 11:11:05 2002 for GLT by doxygen1.2.18