[master] 06e1b51 Add a function to test if the input gzip buffer is empty.
Poul-Henning Kamp
phk at project.varnish-software.com
Fri Jan 21 13:01:13 CET 2011
commit 06e1b51d7495852c56a596fd7611e5b8f7c01075
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Fri Jan 21 11:56:56 2011 +0000
Add a function to test if the input gzip buffer is empty.
diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 8d1696e..3e2fe64 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -627,8 +627,9 @@ void Fetch_Init(void);
struct vgz;
struct vgz *VGZ_NewUngzip(const struct sess *sp, struct ws *tmp);
-void VGZ_Ibuf(struct vgz *, const void *, size_t len);
-void VGZ_Obuf(struct vgz *, const void *, size_t len);
+void VGZ_Ibuf(struct vgz *, const void *, ssize_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_Gunzip(struct vgz *, const void **, size_t *len);
void VGZ_Destroy(struct vgz **);
diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c
index 9ac3d6c..be34261 100644
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -190,7 +190,7 @@ VGZ_NewGzip(const struct sess *sp, struct ws *tmp)
/*--------------------------------------------------------------------*/
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);
@@ -200,10 +200,18 @@ VGZ_Ibuf(struct vgz *vg, const void *ptr, size_t 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
-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);
More information about the varnish-commit
mailing list