sources/huffman/huffman.h

changeset 76
6de6d9a64ebd
parent 75
5f8a03274d75
child 77
32ef969adeed
equal deleted inserted replaced
75:5f8a03274d75 76:6de6d9a64ebd
1 /*
2 * Replacement for older Skulltag Launcher Protocol's huffman.cpp
3 *
4 * Copyright 2009 Timothy Landers
5 * email: code.vortexcortex@gmail.com
6 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23 * THE SOFTWARE.
24 */
25
26 //Macro name kept for backwards compatibility.
27 #ifndef __HUFFMAN_H__
28 #define __HUFFMAN_H__
29
30 #include "huffcodec.h"
31
32 /** Creates and intitializes a HuffmanCodec Object. <br>
33 * Also arranges for HUFFMAN_Destruct() to be called upon termination. */
34 void HUFFMAN_Construct();
35
36 /** Releases resources allocated by the HuffmanCodec. */
37 void HUFFMAN_Destruct();
38
39 /** Applies Huffman encoding to a block of data. */
40 void HUFFMAN_Encode(
41 unsigned char const * const inputBuffer, /**< in: Pointer to start of data that is to be encoded. */
42 unsigned char * const outputBuffer, /**< out: Pointer to destination buffer where encoded data will be stored. */
43 int const &inputBufferSize, /**< in: Number of chars to read from inputBuffer. */
44 int *outputBufferSize /**< in+out: Max chars to write into outputBuffer. Upon return holds the number of chars stored or 0 if an error occurs. */
45 );
46
47 /** Decodes a block of data that is Huffman encoded. */
48 void HUFFMAN_Decode(
49 unsigned char const * const inputBuffer, /**< in: Pointer to start of data that is to be decoded. */
50 unsigned char * const outputBuffer, /**< out: Pointer to destination buffer where decoded data will be stored. */
51 int const &inputBufferSize, /**< in: Number of chars to read from inputBuffer. */
52 int *outputBufferSize /**< in+out: Max chars to write into outputBuffer. Upon return holds the number of chars stored or 0 if an error occurs. */
53 );
54
55 #endif // __HUFFMAN_H__

mercurial