diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gzip.c | 9 | ||||
-rw-r--r-- | src/gzip.h | 3 |
2 files changed, 12 insertions, 0 deletions
@@ -37,6 +37,7 @@ struct opkg_opk_gzip { void *user_data; FILE *write_fp; char write_buffer[512]; + size_t written; z_stream stream; gz_header gz_header; }; @@ -81,6 +82,7 @@ opkg_opk_gzip_init_write(FILE *write_fp) gzip->dir = _OPKG_OPK_GZIP_DIR_WRITE; gzip->write_fp = write_fp; + gzip->written = 0; gzip->stream.zalloc = Z_NULL; gzip->stream.zfree = Z_NULL; @@ -196,6 +198,7 @@ _opkg_opk_gzip_write(struct opkg_opk_gzip *gzip, void *record, size_t size, if (fwrite(gzip->write_buffer, 1, len, gzip->write_fp) != len) { return OPKG_OPK_ERROR; } + gzip->written += len; } while (gzip->stream.avail_out == 0); if (gzip->stream.avail_in != 0) { @@ -219,6 +222,12 @@ opkg_opk_gzip_write(struct opkg_opk_gzip *gzip, void *record, size_t size) } } +size_t +opkg_opk_gzip_written(struct opkg_opk_gzip *gzip) +{ + return gzip->written; +} + int opkg_opk_gzip_free(struct opkg_opk_gzip *gzip) { @@ -65,6 +65,9 @@ opkg_opk_gzip_read(struct opkg_opk_gzip *gzip, void *record); int opkg_opk_gzip_write(struct opkg_opk_gzip *gzip, void *record, size_t size); +size_t +opkg_opk_gzip_written(struct opkg_opk_gzip *gzip); + /* * Frees a decompression structure. * Parameters: |