Commit 06e1b51d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a function to test if the input gzip buffer is empty.

parent 1165eddd
...@@ -627,8 +627,9 @@ void Fetch_Init(void); ...@@ -627,8 +627,9 @@ void Fetch_Init(void);
struct vgz; struct vgz;
struct vgz *VGZ_NewUngzip(const struct sess *sp, struct ws *tmp); struct vgz *VGZ_NewUngzip(const struct sess *sp, struct ws *tmp);
void VGZ_Ibuf(struct vgz *, const void *, size_t len); void VGZ_Ibuf(struct vgz *, const void *, ssize_t len);
void VGZ_Obuf(struct vgz *, const void *, size_t len); int VGZ_IbufEmpty(struct vgz *vg);
void VGZ_Obuf(struct vgz *, const void *, ssize_t len);
int VGZ_Gzip(struct vgz *, const void **, size_t *len, int flag); int VGZ_Gzip(struct vgz *, const void **, size_t *len, int flag);
int VGZ_Gunzip(struct vgz *, const void **, size_t *len); int VGZ_Gunzip(struct vgz *, const void **, size_t *len);
void VGZ_Destroy(struct vgz **); void VGZ_Destroy(struct vgz **);
......
...@@ -190,7 +190,7 @@ VGZ_NewGzip(const struct sess *sp, struct ws *tmp) ...@@ -190,7 +190,7 @@ VGZ_NewGzip(const struct sess *sp, struct ws *tmp)
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
void void
VGZ_Ibuf(struct vgz *vg, const void *ptr, size_t len) VGZ_Ibuf(struct vgz *vg, const void *ptr, ssize_t len)
{ {
CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
...@@ -200,10 +200,18 @@ VGZ_Ibuf(struct vgz *vg, const void *ptr, size_t len) ...@@ -200,10 +200,18 @@ VGZ_Ibuf(struct vgz *vg, const void *ptr, size_t len)
vg->vz.avail_in = len; vg->vz.avail_in = len;
} }
int
VGZ_IbufEmpty(struct vgz *vg)
{
CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
return (vg->vz.avail_in == 0);
}
/*--------------------------------------------------------------------*/ /*--------------------------------------------------------------------*/
void void
VGZ_Obuf(struct vgz *vg, const void *ptr, size_t len) VGZ_Obuf(struct vgz *vg, const void *ptr, ssize_t len)
{ {
CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC); CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment