Get the LZX module building under VC 9.0.

This commit is contained in:
Marshall T. Vandegrift 2008-12-18 16:12:44 -05:00
parent 722f79c31c
commit 93d3eedfdd
4 changed files with 31 additions and 31 deletions

View File

@ -74,7 +74,7 @@ void lz_init(lz_info *lzi, int wsize, int max_dist,
lzi->user_data = user_data;
lzi->frame_size = frame_size;
lzi->lentab = calloc(lzi->block_buf_size + 1, sizeof(int));
lzi->prevtab = calloc(lzi->block_buf_size + 1, sizeof(u_char *));
lzi->prevtab = calloc(lzi->block_buf_size + 1, sizeof(unsigned char *));
lzi->analysis_valid = 0;
}
@ -102,7 +102,7 @@ typedef struct lz_user_data
int R0, R1, R2;
} lz_user_data;
int tmp_get_chars(lz_info *lzi, int n, u_char *buf)
int tmp_get_chars(lz_info *lzi, int n, unsigned char *buf)
{
lz_user_data *lzud = (lz_user_data *)lzi->user_data;
return fread(buf, 1, n, lzud->infile);
@ -119,7 +119,7 @@ int tmp_output_match(lz_info *lzi, int match_pos, int match_len)
return 0;
}
void tmp_output_literal(lz_info *lzi, u_char ch)
void tmp_output_literal(lz_info *lzi, unsigned char ch)
{
lz_user_data *lzud = (lz_user_data *)lzi->user_data;
fprintf(lzud->outfile, "'%c'", ch);
@ -137,7 +137,7 @@ int main(int argc, char *argv[])
}
#endif
__inline__ int lz_left_to_process(lz_info *lzi)
int lz_left_to_process(lz_info *lzi)
{
return lzi->chars_in_buf - lzi->block_loc;
}
@ -146,7 +146,7 @@ static void
fill_blockbuf(lz_info *lzi, int maxchars)
{
int toread;
u_char *readhere;
unsigned char *readhere;
int nread;
if (lzi->eofcount) return;
@ -163,10 +163,10 @@ fill_blockbuf(lz_info *lzi, int maxchars)
static void lz_analyze_block(lz_info *lzi)
{
int *lentab, *lenp;
u_char **prevtab, **prevp;
u_char *bbp, *bbe;
u_char *chartab[256];
u_char *cursor;
unsigned char **prevtab, **prevp;
unsigned char *bbp, *bbe;
unsigned char *chartab[256];
unsigned char *cursor;
int prevlen;
int ch;
int maxlen;
@ -287,9 +287,9 @@ void lz_stop_compressing(lz_info *lzi)
int lz_compress(lz_info *lzi, int nchars)
{
u_char *bbp, *bbe;
unsigned char *bbp, *bbe;
int *lentab, *lenp;
u_char **prevtab, **prevp;
unsigned char **prevtab, **prevp;
int len;
int holdback;
short trimmed;

View File

@ -16,24 +16,24 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
typedef struct lz_info lz_info;
typedef int (*get_chars_t)(lz_info *lzi, int n, u_char *buf);
typedef int (*get_chars_t)(lz_info *lzi, int n, unsigned char *buf);
typedef int (*output_match_t)(lz_info *lzi, int match_pos, int match_len);
typedef void (*output_literal_t)(lz_info *lzi, u_char ch);
typedef void (*output_literal_t)(lz_info *lzi, unsigned char ch);
struct lz_info
{
int wsize; /* window size in bytes */
int max_match; /* size of longest match in bytes */
int min_match;
u_char *block_buf;
u_char *block_bufe;
unsigned char *block_buf;
unsigned char *block_bufe;
int block_buf_size;
int chars_in_buf;
int cur_loc; /* location within stream */
int block_loc;
int frame_size;
int max_dist;
u_char **prevtab;
unsigned char **prevtab;
int *lentab;
short eofcount;
short stop;

View File

@ -79,7 +79,7 @@
/* as corrected by Caie */
short num_position_slots[] = {30, 32, 34, 36, 38, 42, 50};
unsigned long position_base[51];
u_char extra_bits[52];
unsigned char extra_bits[52];
double rloge2;
typedef struct ih_elem {
@ -459,7 +459,7 @@ struct lzxc_data
};
static int
lzx_get_chars(lz_info *lzi, int n, u_char *buf)
lzx_get_chars(lz_info *lzi, int n, unsigned char *buf)
{
/* force lz compression to stop after every block */
int chars_read;
@ -504,9 +504,9 @@ lzx_get_chars(lz_info *lzi, int n, u_char *buf)
#ifdef NONSLIDE
static int find_match_at(lz_info *lzi, int loc, int match_len, int *match_locp)
{
u_char *matchb;
u_char *nmatchb;
u_char *c1, *c2;
unsigned char *matchb;
unsigned char *nmatchb;
unsigned char *c1, *c2;
int j;
if (-*match_locp == loc) return -1;
@ -531,9 +531,9 @@ static int find_match_at(lz_info *lzi, int loc, int match_len, int *match_locp)
#else
static int find_match_at(lz_info *lzi, int loc, int match_len, int *match_locp)
{
u_char *matchb;
u_char *nmatchb;
u_char *c1, *c2;
unsigned char *matchb;
unsigned char *nmatchb;
unsigned char *c1, *c2;
int j;
if (-*match_locp == loc) return -1;
@ -798,7 +798,7 @@ lzx_output_match(lz_info *lzi, int match_pos, int match_len)
}
static void
lzx_output_literal(lz_info *lzi, u_char ch)
lzx_output_literal(lz_info *lzi, unsigned char ch)
{
lzxc_data *lzud = (lzxc_data *)lzi->user_data;
@ -961,15 +961,15 @@ lzx_write_compressed_tree(struct lzxc_data *lzxd,
struct huff_entry *tree, uint8_t *prevlengths,
int treesize)
{
u_char *codes;
u_char *runs;
unsigned char *codes;
unsigned char *runs;
int freqs[LZX_PRETREE_SIZE];
int cur_run;
int last_len;
huff_entry pretree[20];
u_char *codep;
u_char *codee;
u_char *runp;
unsigned char *codep;
unsigned char *codee;
unsigned char *runp;
int excess;
int i;
int cur_code;

View File

@ -17,7 +17,7 @@
*/
#ifdef _MSC_VER
#include "stdint.h"
#include "msstdint.h"
#endif
typedef struct lzxc_data lzxc_data;