home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume6 / u16.patch2 < prev    next >
Encoding:
Internet Message Format  |  1989-02-03  |  3.3 KB

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