]> asedeno.scripts.mit.edu Git - PuTTY.git/blobdiff - sshzlib.c
first pass
[PuTTY.git] / sshzlib.c
index c69edfb81f9a09648baa67c5cf909b3e83aaabcc..60447fdf60766b23b923e80df7fcb7db2dcd6ac8 100644 (file)
--- a/sshzlib.c
+++ b/sshzlib.c
@@ -201,7 +201,7 @@ static void lz77_compress(struct LZ77Context *ctx,
                          unsigned char *data, int len, int compress)
 {
     struct LZ77InternalContext *st = ctx->ictx;
-    int i, hash, distance, off, nmatch, matchlen, advance;
+    int i, distance, off, nmatch, matchlen, advance;
     struct Match defermatch, matches[MAXMATCH];
     int deferchr;
 
@@ -242,7 +242,7 @@ static void lz77_compress(struct LZ77Context *ctx,
            /*
             * Hash the next few characters.
             */
-           hash = lz77_hash(data);
+           int hash = lz77_hash(data);
 
            /*
             * Look the hash up in the corresponding hash chain and see
@@ -267,7 +267,6 @@ static void lz77_compress(struct LZ77Context *ctx,
            }
        } else {
            nmatch = 0;
-           hash = INVALID;
        }
 
        if (nmatch > 0) {
@@ -1366,6 +1365,7 @@ int main(int argc, char **argv)
             sfree(outbuf);
         } else {
             fprintf(stderr, "decoding error\n");
+            fclose(fp);
             return 1;
         }
     }