/[rdesktop]/sourceforge.net/trunk/rdesktop/mppc.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/mppc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 889 by jdmeijer, Sun Apr 17 23:14:20 2005 UTC revision 899 by jdmeijer, Sat Apr 30 20:48:05 2005 UTC
# Line 63  mppc_expand(uint8 * data, uint32 clen, u Line 63  mppc_expand(uint8 * data, uint32 clen, u
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    
# Line 155  mppc_expand(uint8 * data, uint32 clen, u Line 156  mppc_expand(uint8 * data, uint32 clen, u
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;
# Line 163  mppc_expand(uint8 * data, uint32 clen, u Line 164  mppc_expand(uint8 * data, uint32 clen, u
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
# Line 315  mppc_expand(uint8 * data, uint32 clen, u Line 316  mppc_expand(uint8 * data, uint32 clen, u
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;
# Line 334  mppc_expand(uint8 * data, uint32 clen, u Line 335  mppc_expand(uint8 * data, uint32 clen, u
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                          {                          {
# Line 360  mppc_expand(uint8 * data, uint32 clen, u Line 361  mppc_expand(uint8 * data, uint32 clen, u
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++];

Legend:
Removed from v.889  
changed lines
  Added in v.899

  ViewVC Help
Powered by ViewVC 1.1.26