home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume06 / u16.pc2 < prev    next >
Encoding:
Internet Message Format  |  1991-08-27  |  3.5 KB

  1. From decwrl!labrea!rutgers!mailrus!tut.cis.ohio-state.edu!ucbvax!unisoft!uunet!allbery Sat Feb  4 10:49:58 PST 1989
  2. Article 810 of comp.sources.misc:
  3. Path: granite!decwrl!labrea!rutgers!mailrus!tut.cis.ohio-state.edu!ucbvax!unisoft!uunet!allbery
  4. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v06i035: u16 patch 2
  7. Message-ID: <48164@uunet.UU.NET>
  8. Date: 4 Feb 89 03:16:20 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Reply-To: tom@M.UUCP (Tom Horsley)
  11. Lines: 95
  12. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  13.  
  14. Posting-number: Volume 6, Issue 35
  15. Submitted-by: tom@M.UUCP (Tom Horsley)
  16. Archive-name: u16.patch2
  17.  
  18. This is patch #2 to the u16 16-bit LZW uncompress for IBM PCs.
  19. It fixes some bugs with multiple file decompression. I keep
  20. hoping I have gotten the last bug. :-).
  21. -------------------------cut here----------------------------------
  22. *** u16.c.v1.1    Tue Jan  3 15:34:28 1989
  23. --- u16.c    Mon Jan 30 10:27:14 1989
  24. ***************
  25. *** 18,23 ****
  26. --- 18,34 ----
  27.    *   The fix was to add a new variable to keep track of the count
  28.    *   of bits in the buffer and always check to see that there are
  29.    *   enough bits for at least one new code to be extracted.
  30. +  *
  31. +  * Version 1.2
  32. +  *
  33. +  * Bug2 - fixed Sun, 29 Jan 89 14:16:45 PST
  34. +  *        reported by kwok@iris.ucdavis.edu (Conrad Kwok)
  35. +  *        (I used Conrad's suggested patches for the fix).
  36. +  *
  37. +  *   The decompress routine uses several globals which were not
  38. +  *   properly initialized when more than one file is decompressed.
  39. +  *   Also a proper return value from decompress() was not always
  40. +  *   given.
  41.    */
  42.   #include <stdio.h>
  43.   #include <fcntl.h>
  44. ***************
  45. *** 94,100 ****
  46.    * message you get with the -H option.
  47.    */
  48.   unsigned char buf[MAXBUF] = "\
  49. ! u16 - 16 bit LZW uncompress for the IBM PC, version 1.1\n\
  50.   u16 [-H] [files...]\n\
  51.   \n\
  52.   -H\tPrint this message and exit.\n\
  53. --- 105,111 ----
  54.    * message you get with the -H option.
  55.    */
  56.   unsigned char buf[MAXBUF] = "\
  57. ! u16 - 16 bit LZW uncompress for the IBM PC, version 1.2\n\
  58.   u16 [-H] [files...]\n\
  59.   \n\
  60.   -H\tPrint this message and exit.\n\
  61. ***************
  62. *** 283,288 ****
  63. --- 294,305 ----
  64.      long stacksize = 0;
  65.   #endif
  66.   
  67. +    eofmark = NULL;
  68. +    bitsinbuf=0;
  69. +    bufsize=0;
  70. +    clear_flg=0;
  71. +    free_ent=0;
  72.      /* No buffering on stdin, we do all our own buffering.
  73.       */
  74.      setvbuf(stdin, NULL, _IONBF, 0);
  75. ***************
  76. *** 296,302 ****
  77.      /* Read the iniital buffer worth of data and check magic numbers
  78.       * and flags.
  79.       */
  80. -    bitsinbuf = 0;
  81.      ReadBuf();
  82.      bitsinbuf -= 3 * 8;
  83.      if (bufsize < 3) {
  84. --- 313,318 ----
  85. ***************
  86. *** 336,342 ****
  87.   
  88.      finchar = oldcode = getcode();
  89.      if(oldcode == -1)         /* EOF already? */
  90. !       return;             /* Get out of here */
  91.      putchar((char)finchar );  /* first code must be 8 bits = char */
  92.   #ifdef DEBUG
  93.      ++bytes_out;
  94. --- 352,358 ----
  95.   
  96.      finchar = oldcode = getcode();
  97.      if(oldcode == -1)         /* EOF already? */
  98. !       return 1;             /* Get out of here */
  99.      putchar((char)finchar );  /* first code must be 8 bits = char */
  100.   #ifdef DEBUG
  101.      ++bytes_out;
  102.  
  103. =====================================================================
  104.     usenet: tahorsley@ssd.harris.com  USMail: Tom Horsley
  105. compuserve: 76505,364                         511 Kingbird Circle
  106.      genie: T.HORSLEY                         Delray Beach, FL  33444
  107. ======================== Aging: Just say no! ========================
  108.  
  109.  
  110.