63 |
int next_offset, match_off; |
int next_offset, match_off; |
64 |
int match_len; |
int match_len; |
65 |
int old_offset, match_bits; |
int old_offset, match_bits; |
66 |
|
BOOL big = ctype & RDP_MPPC_BIG ? True : False; |
67 |
|
|
68 |
uint8 *dict = g_mppc_dict.hist; |
uint8 *dict = g_mppc_dict.hist; |
69 |
|
|
156 |
/* decode offset */ |
/* decode offset */ |
157 |
/* length pair */ |
/* length pair */ |
158 |
walker <<= 1; |
walker <<= 1; |
159 |
if (--walker_len < (ctype & RDP_MPPC_BIG ? 3 : 2)) |
if (--walker_len < (big ? 3 : 2)) |
160 |
{ |
{ |
161 |
if (i >= clen) |
if (i >= clen) |
162 |
return -1; |
return -1; |
164 |
walker_len += 8; |
walker_len += 8; |
165 |
} |
} |
166 |
|
|
167 |
if (ctype & RDP_MPPC_BIG) |
if (big) |
168 |
{ |
{ |
169 |
/* offset decoding where offset len is: |
/* offset decoding where offset len is: |
170 |
-63: 11111 followed by the lower 6 bits of the value |
-63: 11111 followed by the lower 6 bits of the value |
316 |
i.e. 4097 is encoded as: 111111111110 000000000001 |
i.e. 4097 is encoded as: 111111111110 000000000001 |
317 |
meaning 4096 + 1... |
meaning 4096 + 1... |
318 |
*/ |
*/ |
319 |
match_bits = 11; /* 11 bits of value at most */ |
match_bits = big ? 14 : 11; /* 11 or 14 bits of value at most */ |
320 |
do |
do |
321 |
{ |
{ |
322 |
walker <<= 1; |
walker <<= 1; |
335 |
} |
} |
336 |
} |
} |
337 |
while (1); |
while (1); |
338 |
match_len = 13 - match_bits; |
match_len = (big ? 16 : 13) - match_bits; |
339 |
walker <<= 1; |
walker <<= 1; |
340 |
if (--walker_len < match_len) |
if (--walker_len < match_len) |
341 |
{ |
{ |
361 |
return -1; |
return -1; |
362 |
} |
} |
363 |
/* memory areas can overlap - meaning we can't use memXXX functions */ |
/* memory areas can overlap - meaning we can't use memXXX functions */ |
364 |
k = (next_offset - match_off) & (ctype & RDP_MPPC_BIG ? 65535 : 8191); |
k = (next_offset - match_off) & (big ? 65535 : 8191); |
365 |
do |
do |
366 |
{ |
{ |
367 |
dict[next_offset++] = dict[k++]; |
dict[next_offset++] = dict[k++]; |