Fix off by one error
[TortoiseGit.git] / ext / hunspell / hunzip.hxx
blobb58e3ab1dc505bdff55d9810c1426bf03edaa7f9
1 /* hunzip: file decompression for sorted dictionaries with optional encryption,
2 * algorithm: prefix-suffix encoding and 16-bit Huffman encoding */
4 #ifndef _HUNZIP_HXX_
5 #define _HUNZIP_HXX_
7 #include "hunvisapi.h"
9 #include <stdio.h>
11 #define BUFSIZE 65536
12 #define HZIP_EXTENSION ".hz"
14 #define MSG_OPEN "error: %s: cannot open\n"
15 #define MSG_FORMAT "error: %s: not in hzip format\n"
16 #define MSG_MEMORY "error: %s: missing memory\n"
17 #define MSG_KEY "error: %s: missing or bad password\n"
19 struct bit {
20 unsigned char c[2];
21 int v[2];
24 class LIBHUNSPELL_DLL_EXPORTED Hunzip
27 protected:
28 char * filename;
29 FILE * fin;
30 int bufsiz, lastbit, inc, inbits, outc;
31 struct bit * dec; // code table
32 char in[BUFSIZE]; // input buffer
33 char out[BUFSIZE + 1]; // Huffman-decoded buffer
34 char line[BUFSIZE + 50]; // decoded line
35 int getcode(const char * key);
36 int getbuf();
37 int fail(const char * err, const char * par);
39 public:
40 Hunzip(const char * filename, const char * key = NULL);
41 ~Hunzip();
42 const char * getline();
45 #endif