| 130 | } |
| 131 | |
| 132 | int git_inflate(git_zstream *strm, int flush) |
| 133 | { |
| 134 | int status; |
| 135 | |
| 136 | for (;;) { |
| 137 | zlib_pre_call(strm); |
| 138 | /* Never say Z_FINISH unless we are feeding everything */ |
| 139 | status = inflate(&strm->z, |
| 140 | (strm->z.avail_in != strm->avail_in) |
| 141 | ? 0 : flush); |
| 142 | if (status == Z_MEM_ERROR) |
| 143 | die("inflate: out of memory"); |
| 144 | zlib_post_call(strm, status); |
| 145 | |
| 146 | /* |
| 147 | * Let zlib work another round, while we can still |
| 148 | * make progress. |
| 149 | */ |
| 150 | if ((strm->avail_out && !strm->z.avail_out) && |
| 151 | (status == Z_OK || status == Z_BUF_ERROR)) |
| 152 | continue; |
| 153 | break; |
| 154 | } |
| 155 | |
| 156 | switch (status) { |
| 157 | /* Z_BUF_ERROR: normal, needs more space in the output buffer */ |
| 158 | case Z_BUF_ERROR: |
| 159 | case Z_OK: |
| 160 | case Z_STREAM_END: |
| 161 | return status; |
| 162 | default: |
| 163 | break; |
| 164 | } |
| 165 | error("inflate: %s (%s)", zerr_to_string(status), |
| 166 | strm->z.msg ? strm->z.msg : "no message"); |
| 167 | return status; |
| 168 | } |
| 169 | |
| 170 | unsigned long git_deflate_bound(git_zstream *strm, unsigned long size) |
| 171 | { |
no test coverage detected