gzip: fix some Y2038 etc. bugs
[debian/gzip] / inflate.c
index d7dbebeb1ca45c9d4331a0feed782a904bbb7e32..ff2be7e0fecd2dd0884b5fafd4839381e1ac0471 100644 (file)
--- a/inflate.c
+++ b/inflate.c
@@ -1,6 +1,6 @@
 /* Inflate deflated data
 
-   Copyright (C) 1997-1999, 2002, 2006, 2009-2011 Free Software Foundation,
+   Copyright (C) 1997-1999, 2002, 2006, 2009-2016 Free Software Foundation,
    Inc.
 
    This program is free software; you can redistribute it and/or modify
  */
 
 #include <config.h>
-#include "tailor.h"
 
 #include <stdlib.h>
 
+#include "tailor.h"
 #include "gzip.h"
 #define slide window
 
@@ -208,10 +208,10 @@ static ush cpdext[] = {         /* Extra bits for distance codes */
    the stream.
  */
 
-ulg bb;                         /* bit buffer */
-unsigned bk;                    /* bits in bit buffer */
+static ulg bb;                         /* bit buffer */
+static unsigned bk;                    /* bits in bit buffer */
 
-ush mask_bits[] = {
+static ush mask_bits[] = {
     0x0000,
     0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
     0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
@@ -219,13 +219,7 @@ ush mask_bits[] = {
 
 #define GETBYTE() (inptr < insize ? inbuf[inptr++] : (wp = w, fill_inbuf(0)))
 
-#ifdef CRYPT
-  uch cc;
-#  define NEXTBYTE() \
-     (decrypt ? (cc = GETBYTE(), zdecode(cc), cc) : GETBYTE())
-#else
-#  define NEXTBYTE()  (uch)GETBYTE()
-#endif
+#define NEXTBYTE()  (uch)GETBYTE()
 #define NEEDBITS(n) {while(k<(n)){b|=((ulg)NEXTBYTE())<<k;k+=8;}}
 #define DUMPBITS(n) {b>>=(n);k-=(n);}
 
@@ -263,8 +257,8 @@ ush mask_bits[] = {
  */
 
 
-int lbits = 9;          /* bits in base literal/length lookup table */
-int dbits = 6;          /* bits in base distance lookup table */
+static int lbits = 9;   /* bits in base literal/length lookup table */
+static int dbits = 6;   /* bits in base distance lookup table */
 
 
 /* If BMAX needs to be larger than 16, then h and x[] should be ulg. */
@@ -272,7 +266,7 @@ int dbits = 6;          /* bits in base distance lookup table */
 #define N_MAX 288       /* maximum number of codes in any set */
 
 
-unsigned hufts;         /* track memory usage */
+static unsigned hufts;  /* track memory usage */
 
 
 static int