summaryrefslogtreecommitdiffstats
path: root/src/gzip.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gzip.c')
-rw-r--r--src/gzip.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gzip.c b/src/gzip.c
index 531294b..ef4d4aa 100644
--- a/src/gzip.c
+++ b/src/gzip.c
@@ -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)
{