summaryrefslogtreecommitdiff
path: root/src/gunzip.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2019-12-18 10:00:29 +0200
committerTimo Teräs <timo.teras@iki.fi>2019-12-18 10:00:29 +0200
commit6996b1ea7504b1d3c90fbe6a6d4dee162fcff683 (patch)
treef1d94dd7e9e0709d068073c7ab6f5a97c7b8bb5d /src/gunzip.c
parent695a2f8231f11f690ba96d6c4b537e22dd6571fd (diff)
downloadapk-tools-6996b1ea7504b1d3c90fbe6a6d4dee162fcff683.tar.gz
apk-tools-6996b1ea7504b1d3c90fbe6a6d4dee162fcff683.tar.bz2
apk-tools-6996b1ea7504b1d3c90fbe6a6d4dee162fcff683.tar.xz
apk-tools-6996b1ea7504b1d3c90fbe6a6d4dee162fcff683.zip
io: use proper base struct types for method implementations
Diffstat (limited to 'src/gunzip.c')
-rw-r--r--src/gunzip.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/gunzip.c b/src/gunzip.c
index 2de841b..5d96c7e 100644
--- a/src/gunzip.c
+++ b/src/gunzip.c
@@ -30,10 +30,9 @@ struct apk_gzip_istream {
apk_blob_t cbarg;
};
-static void gzi_get_meta(void *stream, struct apk_file_meta *meta)
+static void gzi_get_meta(struct apk_istream *is, struct apk_file_meta *meta)
{
- struct apk_gzip_istream *gis =
- container_of(stream, struct apk_gzip_istream, is);
+ struct apk_gzip_istream *gis = container_of(is, struct apk_gzip_istream, is);
apk_bstream_get_meta(gis->bs, meta);
}
@@ -47,10 +46,9 @@ static int gzi_boundary_change(struct apk_gzip_istream *gis)
return r;
}
-static ssize_t gzi_read(void *stream, void *ptr, size_t size)
+static ssize_t gzi_read(struct apk_istream *is, void *ptr, size_t size)
{
- struct apk_gzip_istream *gis =
- container_of(stream, struct apk_gzip_istream, is);
+ struct apk_gzip_istream *gis = container_of(is, struct apk_gzip_istream, is);
int r;
if (gis->err != 0) {
@@ -134,10 +132,9 @@ ret:
return size - gis->zs.avail_out;
}
-static void gzi_close(void *stream)
+static void gzi_close(struct apk_istream *is)
{
- struct apk_gzip_istream *gis =
- container_of(stream, struct apk_gzip_istream, is);
+ struct apk_gzip_istream *gis = container_of(is, struct apk_gzip_istream, is);
inflateEnd(&gis->zs);
apk_bstream_close(gis->bs, NULL);
@@ -184,9 +181,9 @@ struct apk_gzip_ostream {
z_stream zs;
};
-static ssize_t gzo_write(void *stream, const void *ptr, size_t size)
+static ssize_t gzo_write(struct apk_ostream *os, const void *ptr, size_t size)
{
- struct apk_gzip_ostream *gos = (struct apk_gzip_ostream *) stream;
+ struct apk_gzip_ostream *gos = container_of(os, struct apk_gzip_ostream, os);
unsigned char buffer[1024];
ssize_t have, r;
@@ -209,9 +206,9 @@ static ssize_t gzo_write(void *stream, const void *ptr, size_t size)
return size;
}
-static int gzo_close(void *stream)
+static int gzo_close(struct apk_ostream *os)
{
- struct apk_gzip_ostream *gos = (struct apk_gzip_ostream *) stream;
+ struct apk_gzip_ostream *gos = container_of(os, struct apk_gzip_ostream, os);
unsigned char buffer[1024];
size_t have;
int r, rc = 0;
@@ -229,7 +226,7 @@ static int gzo_close(void *stream)
rc = r;
deflateEnd(&gos->zs);
- free(stream);
+ free(gos);
return rc;
}