|
|
| version 1.3.2.1, 2012/11/13 10:30:44 | version 1.3.2.2, 2012/11/13 10:34:17 |
|---|---|
| Line 90 sync_Deflate(int inf, int outf, int level) | Line 90 sync_Deflate(int inf, int outf, int level) |
| flush = sync_EOF(inf) ? Z_FINISH : Z_NO_FLUSH; | flush = sync_EOF(inf) ? Z_FINISH : Z_NO_FLUSH; |
| do { | do { |
| // compress and write to file | /* compress and write to file */ |
| z.avail_out = readed; | z.avail_out = readed; |
| z.next_out = obuf; | z.next_out = obuf; |
| ret = deflate(&z, flush); | ret = deflate(&z, flush); |
| Line 117 sync_Deflate(int inf, int outf, int level) | Line 117 sync_Deflate(int inf, int outf, int level) |
| } | } |
| } while (flush != Z_FINISH); | } while (flush != Z_FINISH); |
| // free zlib | /* free zlib */ |
| deflateEnd(&z); | deflateEnd(&z); |
| return ret; | return ret; |
| } | } |
| /* | /* |
| * sync_Inflate() LibZ inflate data | * sync_Inflate() - LibZ inflate data |
| * | |
| * @inf = Input file | * @inf = Input file |
| * @outf = Output file | * @outf = Output file |
| * return: -1 error, != -1 ok | * return: -1 error, != -1 ok |
| Line 141 sync_Inflate(int inf, int outf) | Line 142 sync_Inflate(int inf, int outf) |
| return -1; | return -1; |
| } | } |
| // init zlib | /* init zlib */ |
| memset(&z, 0, sizeof z); | memset(&z, 0, sizeof z); |
| ret = inflateInit(&z); | ret = inflateInit(&z); |
| if (ret) | if (ret) |
| return ret; | return ret; |
| do { | do { |
| // set input buffer for decompress | /* set input buffer for decompress */ |
| ret = read(inf, ibuf, Z_CHUNK); | ret = read(inf, ibuf, Z_CHUNK); |
| if (-1 == ret) { | if (-1 == ret) { |
| LOGERR; | LOGERR; |
| Line 162 sync_Inflate(int inf, int outf) | Line 163 sync_Inflate(int inf, int outf) |
| flush = Z_NO_FLUSH; | flush = Z_NO_FLUSH; |
| do { | do { |
| // decompress and write to file | /* decompress and write to file */ |
| z.avail_out = Z_CHUNK; | z.avail_out = Z_CHUNK; |
| z.next_out = obuf; | z.next_out = obuf; |
| ret = inflate(&z, flush); | ret = inflate(&z, flush); |
| Line 186 sync_Inflate(int inf, int outf) | Line 187 sync_Inflate(int inf, int outf) |
| } while (!z.avail_out); | } while (!z.avail_out); |
| } while (flush != Z_STREAM_END); | } while (flush != Z_STREAM_END); |
| // free zlib | /* free zlib */ |
| inflateEnd(&z); | inflateEnd(&z); |
| return ret; | return ret; |
| } | } |