Mercurial > libpst
comparison src/lzfu.c @ 172:6954d315aaa8
move version-info into main configure.in, and set it properly.
prefix all external symbols in the shared library with pst_ to avoid symbol clashes with other shared libraries.
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Sat, 04 Apr 2009 16:00:48 -0700 |
parents | e35fd42bac05 |
children | cf3df962f1e5 |
comparison
equal
deleted
inserted
replaced
171:6c1e75bc4cac | 172:6954d315aaa8 |
---|---|
33 uint32_t dwMagic; | 33 uint32_t dwMagic; |
34 uint32_t dwCRC; | 34 uint32_t dwCRC; |
35 } lzfuheader; | 35 } lzfuheader; |
36 | 36 |
37 | 37 |
38 char* lzfu_decompress(char* rtfcomp, uint32_t compsize, size_t *size) { | 38 char* pst_lzfu_decompress(char* rtfcomp, uint32_t compsize, size_t *size) { |
39 unsigned char dict[4096]; // the dictionary buffer | 39 unsigned char dict[4096]; // the dictionary buffer |
40 unsigned int dict_length = 0; // the dictionary pointer | 40 unsigned int dict_length = 0; // the dictionary pointer |
41 lzfuheader lzfuhdr; // the header of the lzfu block | 41 lzfuheader lzfuhdr; // the header of the lzfu block |
42 unsigned char flags; // 8 bits of flags (1=2byte block pointer into the dict, 0=1 byte literal) | 42 unsigned char flags; // 8 bits of flags (1=2byte block pointer into the dict, 0=1 byte literal) |
43 unsigned char flag_mask; // look at one flag bit each time thru the loop | 43 unsigned char flag_mask; // look at one flag bit each time thru the loop |
61 //printf("raw size : %d\n", lzfuhdr.cbRawSize); | 61 //printf("raw size : %d\n", lzfuhdr.cbRawSize); |
62 //printf("compressed: %s\n", (lzfuhdr.dwMagic == LZFU_COMPRESSED ? "yes" : "no")); | 62 //printf("compressed: %s\n", (lzfuhdr.dwMagic == LZFU_COMPRESSED ? "yes" : "no")); |
63 //printf("CRC : %#x\n", lzfuhdr.dwCRC); | 63 //printf("CRC : %#x\n", lzfuhdr.dwCRC); |
64 //printf("\n"); | 64 //printf("\n"); |
65 out_size = lzfuhdr.cbRawSize; | 65 out_size = lzfuhdr.cbRawSize; |
66 out_buf = (char*)xmalloc(out_size); | 66 out_buf = (char*)pst_malloc(out_size); |
67 in_ptr = sizeof(lzfuhdr); | 67 in_ptr = sizeof(lzfuhdr); |
68 // Make sure to correct lzfuhdr.cbSize with 4 bytes before comparing | 68 // Make sure to correct lzfuhdr.cbSize with 4 bytes before comparing |
69 // to compsize | 69 // to compsize |
70 in_size = (lzfuhdr.cbSize + 4 < compsize) ? lzfuhdr.cbSize + 4 : compsize; | 70 in_size = (lzfuhdr.cbSize + 4 < compsize) ? lzfuhdr.cbSize + 4 : compsize; |
71 while (in_ptr < in_size) { | 71 while (in_ptr < in_size) { |