[BACK]Return to zopen.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / compress

Diff for /src/usr.bin/compress/zopen.c between version 1.8 and 1.9

version 1.8, 2002/02/16 21:27:45 version 1.9, 2002/12/08 16:07:54
Line 36 
Line 36 
  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY   * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF   * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.   * SUCH DAMAGE.
    *
    *      From: @(#)zopen.c       8.1 (Berkeley) 6/27/93
  */   */
   
 #if defined(LIBC_SCCS) && !defined(lint)  
 #if 0  #if 0
 static char sccsid[] = "@(#)zopen.c     8.1 (Berkeley) 6/27/93";  static char sccsid[] = "@(#)zopen.c     8.1 (Berkeley) 6/27/93";
 #else  #else
 static char rcsid[] = "$OpenBSD$";  const char z_rcsid[] =
           "$OpenBSD$";
 #endif  #endif
 #endif /* LIBC_SCCS and not lint */  
   
 /*-  /*-
  * fcompress.c - File compression ala IEEE Computer, June 1984.   * fcompress.c - File compression ala IEEE Computer, June 1984.
Line 89 
Line 90 
 typedef long code_int;  typedef long code_int;
 typedef long count_int;  typedef long count_int;
   
 static u_char z_magic[] =  static const u_char z_magic[] =
         {'\037', '\235'};               /* 1F 9D */          {'\037', '\235'};               /* 1F 9D */
   
 #define BIT_MASK        0x1f            /* Defines for third byte of header. */  #define BIT_MASK        0x1f            /* Defines for third byte of header. */
Line 186 
Line 187 
 #define CLEAR   256             /* Table clear output code. */  #define CLEAR   256             /* Table clear output code. */
   
 static int      cl_block(struct s_zstate *);  static int      cl_block(struct s_zstate *);
 static void     cl_hash(struct s_zstate *, register count_int);  static void     cl_hash(struct s_zstate *, count_int);
 static code_int getcode(struct s_zstate *);  static code_int getcode(struct s_zstate *);
 static int      output(struct s_zstate *, code_int);  static int      output(struct s_zstate *, code_int);
   
Line 195 
Line 196 
  * Terry A. Welch, IEEE Computer Vol 17, No 6 (June 1984), pp 8-19.   * Terry A. Welch, IEEE Computer Vol 17, No 6 (June 1984), pp 8-19.
  *   *
  * Algorithm:   * Algorithm:
  *      Modified Lempel-Ziv method (LZW).  Basically finds common   *      Modified Lempel-Ziv method (LZW).  Basically finds common
  * substrings and replaces them with a variable size code.  This is   * substrings and replaces them with a variable size code.  This is
  * deterministic, and can be done on the fly.  Thus, the decompression   * deterministic, and can be done on the fly.  Thus, the decompression
  * procedure needs no input table, but tracks the way the table was built.   * procedure needs no input table, but tracks the way the table was built.
Line 279 
Line 280 
                                               zs->zs_ent);                                                zs->zs_ent);
                         /* Xor hashing. */                          /* Xor hashing. */
                         i = ((c << zs->zs_hshift) ^ zs->zs_ent);                          i = ((c << zs->zs_hshift) ^ zs->zs_ent);
   
                         if (htabof(i) == zs->zs_fcode) {                          if (htabof(i) == zs->zs_fcode) {
                                 zs->zs_ent = codetabof(i);                                  zs->zs_ent = codetabof(i);
                                 continue;                                  continue;
Line 345 
Line 346 
 /*-  /*-
  * Output the given code.   * Output the given code.
  * Inputs:   * Inputs:
  *      code:   A n_bits-bit integer.  If == -1, then EOF.  This assumes   *      code:   A n_bits-bit integer.  If == -1, then EOF.  This assumes
  *              that n_bits =< (long)wordsize - 1.   *              that n_bits =< (long)wordsize - 1.
  * Outputs:   * Outputs:
  *      Outputs code to the file.   *      Outputs code to the file.
  * Assumptions:   * Assumptions:
  *      Chars are 8 bits long.   *      Chars are 8 bits long.
  * Algorithm:   * Algorithm:
  *      Maintain a BITS character long buffer (so that 8 codes will   *      Maintain a BITS character long buffer (so that 8 codes will
  * fit in it exactly).  Use the VAX insv instruction to insert each   * fit in it exactly).  Use the VAX insv instruction to insert each
  * code in turn.  When the buffer fills up empty it and start over.   * code in turn.  When the buffer fills up empty it and start over.
  */   */
Line 568 
Line 569 
 /*-  /*-
  * Read one code from the standard input.  If EOF, return -1.   * Read one code from the standard input.  If EOF, return -1.
  * Inputs:   * Inputs:
  *      stdin   *      stdin
  * Outputs:   * Outputs:
  *      code or -1 is returned.   *      code or -1 is returned.
  */   */
 static code_int  static code_int
 getcode(zs)  getcode(zs)

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9