diff options
Diffstat (limited to 'gzwrite.c')
-rw-r--r-- | gzwrite.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -97,6 +97,15 @@ local int gz_comp(state, flush) | |||
97 | return 0; | 97 | return 0; |
98 | } | 98 | } |
99 | 99 | ||
100 | /* check for a pending reset */ | ||
101 | if (state->reset) { | ||
102 | /* don't start a new gzip member unless there is data to write */ | ||
103 | if (strm->avail_in == 0) | ||
104 | return 0; | ||
105 | deflateReset(strm); | ||
106 | state->reset = 0; | ||
107 | } | ||
108 | |||
100 | /* run deflate() on provided input until it produces no more output */ | 109 | /* run deflate() on provided input until it produces no more output */ |
101 | ret = Z_OK; | 110 | ret = Z_OK; |
102 | do { | 111 | do { |
@@ -134,7 +143,7 @@ local int gz_comp(state, flush) | |||
134 | 143 | ||
135 | /* if that completed a deflate stream, allow another to start */ | 144 | /* if that completed a deflate stream, allow another to start */ |
136 | if (flush == Z_FINISH) | 145 | if (flush == Z_FINISH) |
137 | deflateReset(strm); | 146 | state->reset = 1; |
138 | 147 | ||
139 | /* all done, no errors */ | 148 | /* all done, no errors */ |
140 | return 0; | 149 | return 0; |