comparison src/lzfu.c @ 43:f6db1f060a95

start on outlook 2003 64 bit format
author carl
date Sun, 06 Jan 2008 14:47:06 -0800
parents 183ae993b9ad
children f66078abed38
comparison
equal deleted inserted replaced
42:7a97f50c39c5 43:f6db1f060a95
30 // initial length of dictionary 30 // initial length of dictionary
31 #define LZFU_INITLENGTH 207 31 #define LZFU_INITLENGTH 207
32 32
33 // header for compressed rtf 33 // header for compressed rtf
34 typedef struct _lzfuheader { 34 typedef struct _lzfuheader {
35 u_int32_t cbSize; 35 uint32_t cbSize;
36 u_int32_t cbRawSize; 36 uint32_t cbRawSize;
37 u_int32_t dwMagic; 37 uint32_t dwMagic;
38 u_int32_t dwCRC; 38 uint32_t dwCRC;
39 } lzfuheader; 39 } lzfuheader;
40 40
41 41
42 unsigned char* lzfu_decompress (unsigned char* rtfcomp, u_int32_t compsize, size_t *size) { 42 unsigned char* lzfu_decompress (unsigned char* rtfcomp, uint32_t compsize, size_t *size) {
43 // the dictionary buffer 43 // the dictionary buffer
44 unsigned char dict[4096]; 44 unsigned char dict[4096];
45 // the dictionary pointer 45 // the dictionary pointer
46 unsigned int dict_length=0; 46 unsigned int dict_length=0;
47 // the header of the lzfu block 47 // the header of the lzfu block
48 lzfuheader lzfuhdr; 48 lzfuheader lzfuhdr;
49 // container for the data blocks 49 // container for the data blocks
50 unsigned char flags; 50 unsigned char flags;
51 // temp value for determining the bits in the flag 51 // temp value for determining the bits in the flag
52 unsigned char flag_mask; 52 unsigned char flag_mask;
53 u_int32_t i; 53 uint32_t i;
54 unsigned char *out_buf; 54 unsigned char *out_buf;
55 u_int32_t out_ptr = 0; 55 uint32_t out_ptr = 0;
56 u_int32_t out_size; 56 uint32_t out_size;
57 u_int32_t in_ptr; 57 uint32_t in_ptr;
58 u_int32_t in_size; 58 uint32_t in_size;
59 59
60 memcpy(dict, LZFU_INITDICT, LZFU_INITLENGTH); 60 memcpy(dict, LZFU_INITDICT, LZFU_INITLENGTH);
61 dict_length = LZFU_INITLENGTH; 61 dict_length = LZFU_INITLENGTH;
62 memcpy(&lzfuhdr, rtfcomp, sizeof(lzfuhdr)); 62 memcpy(&lzfuhdr, rtfcomp, sizeof(lzfuhdr));
63 LE32_CPU(lzfuhdr.cbSize); 63 LE32_CPU(lzfuhdr.cbSize);