maint: port to platforms lacking SIGPIPE
[debian/gzip] / deflate.c
index b1fafde6904c596c301f428d9e24bbd046842272..f0f23940ac9d0c891877105ebc803d508483987d 100644 (file)
--- a/deflate.c
+++ b/deflate.c
@@ -1,6 +1,6 @@
 /* deflate.c -- compress data using the deflation algorithm
 
-   Copyright (C) 1999, 2006, 2009-2011 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2006, 2009-2013 Free Software Foundation, Inc.
    Copyright (C) 1992-1993 Jean-loup Gailly
 
    This program is free software; you can redistribute it and/or modify
@@ -226,10 +226,17 @@ typedef struct config {
    ush max_chain;
 } config;
 
+#ifdef ASMV
+# define static_unless_ASMV
+#else
+# define static_unless_ASMV static
+#endif
+
 #ifdef  FULL_SEARCH
 # define nice_match MAX_MATCH
 #else
-  static int nice_match; /* Stop searching when current match exceeds this */
+  /* Stop searching when current match exceeds this */
+  static_unless_ASMV int nice_match;
 #endif
 
 local config configuration_table[10] = {
@@ -564,6 +571,8 @@ local void fill_window()
         n = read_buf((char*)window+strstart+lookahead, more);
         if (n == 0 || n == (unsigned)EOF) {
             eofile = 1;
+            /* Don't let garbage pollute the dictionary.  */
+            memzero (window + strstart + lookahead, MIN_MATCH - 1);
         } else {
             lookahead += n;
         }