/[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 684 by n-ki, Tue Apr 27 13:05:32 2004 UTC revision 687 by n-ki, Fri Apr 30 06:18:08 2004 UTC
# Line 3  Line 3 
3    
4  #include "rdesktop.h"  #include "rdesktop.h"
5    
6  /* mppc-like??? decompression               */  /* mppc decompression                       */
7  /* http://www.faqs.org/rfcs/rfc2118.html    */  /* http://www.faqs.org/rfcs/rfc2118.html    */
8    
9  /* TODO: research the below statements      */  /* TODO: research the below statements      */
# Line 18  Line 18 
18  /* already paying royalties                 */  /* already paying royalties                 */
19  /* through the CAL licenses?                */  /* through the CAL licenses?                */
20    
21  /* the dictionary is empty when init. like  */  /* as the rfc states the algorithm seems to */
22  /* LZ78,  which is not patented             */  /* be LZ77 with a sliding buffer            */
23    /* that is empty at init.                   */
24    
25    /* as of my limited knowledge these patents */
26    /* has expired.                             */
27    
28  RDPCOMP mppc_dict;  
29    RDPCOMP g_mppc_dict;
30    
31  int  int
32  mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen)  mppc_expand(uint8 * data, uint32 clen, uint8 ctype, uint32 * roff, uint32 * rlen)
# Line 33  mppc_expand(uint8 * data, uint32 clen, u Line 37  mppc_expand(uint8 * data, uint32 clen, u
37          int match_len;          int match_len;
38          int old_offset, match_bits;          int old_offset, match_bits;
39    
40          signed char *dict = &(mppc_dict.hist);          signed char *dict = &(g_mppc_dict.hist);
41    
42          if ((ctype & RDP_MPPC_COMPRESSED) == 0)          if ((ctype & RDP_MPPC_COMPRESSED) == 0)
43          {          {
# Line 44  mppc_expand(uint8 * data, uint32 clen, u Line 48  mppc_expand(uint8 * data, uint32 clen, u
48    
49          if ((ctype & RDP_MPPC_RESET) != 0)          if ((ctype & RDP_MPPC_RESET) != 0)
50          {          {
51                  mppc_dict.roff = 0;                  g_mppc_dict.roff = 0;
52          }          }
53    
54          if ((ctype & RDP_MPPC_FLUSH) != 0)          if ((ctype & RDP_MPPC_FLUSH) != 0)
55          {          {
56                  memset(dict, 0, RDP_MPPC_DICT_SIZE);                  memset(dict, 0, RDP_MPPC_DICT_SIZE);
57                  mppc_dict.roff = 0;                  g_mppc_dict.roff = 0;
58          }          }
59    
60          *roff = 0;          *roff = 0;
61          *rlen = 0;          *rlen = 0;
62    
63          walker = mppc_dict.roff;          walker = g_mppc_dict.roff;
64    
65          next_offset = walker;          next_offset = walker;
66          old_offset = next_offset;          old_offset = next_offset;
# Line 267  mppc_expand(uint8 * data, uint32 clen, u Line 271  mppc_expand(uint8 * data, uint32 clen, u
271          while (1);          while (1);
272    
273          /* store history offset */          /* store history offset */
274          mppc_dict.roff = next_offset;          g_mppc_dict.roff = next_offset;
275    
276          *roff = old_offset;          *roff = old_offset;
277          *rlen = next_offset - old_offset;          *rlen = next_offset - old_offset;

Legend:
Removed from v.684  
changed lines
  Added in v.687

  ViewVC Help
Powered by ViewVC 1.1.26