[master] e633a7f Various FlexeLint inspired cleanups.

Poul-Henning Kamp phk at varnish-cache.org
Fri May 13 12:24:00 CEST 2011


commit e633a7f885660ee76d075098810c31bdad4e5571
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri May 13 10:23:41 2011 +0000

    Various FlexeLint inspired cleanups.

diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index 216c432..75ce56d 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -703,15 +703,15 @@ struct vgz *VGZ_NewUngzip(struct sess *sp, const char *id);
 struct vgz *VGZ_NewGzip(struct sess *sp, const char *id);
 void VGZ_Ibuf(struct vgz *, const void *, ssize_t len);
 int VGZ_IbufEmpty(const struct vgz *vg);
-void VGZ_Obuf(struct vgz *, const void *, ssize_t len);
+void VGZ_Obuf(struct vgz *, void *, ssize_t len);
 int VGZ_ObufFull(const struct vgz *vg);
 int VGZ_ObufStorage(const struct sess *sp, struct vgz *vg);
 int VGZ_Gzip(struct vgz *, const void **, size_t *len, enum vgz_flag);
 int VGZ_Gunzip(struct vgz *, const void **, size_t *len);
 void VGZ_Destroy(struct vgz **);
 void VGZ_UpdateObj(const struct vgz*, struct object *);
-int VGZ_WrwGunzip(const struct sess *, struct vgz *, void *ibuf, ssize_t ibufl,
-    char *obuf, ssize_t obufl, ssize_t *obufp);
+int VGZ_WrwGunzip(const struct sess *, struct vgz *, const void *ibuf,
+    ssize_t ibufl, char *obuf, ssize_t obufl, ssize_t *obufp);
 
 /* Return values */
 #define VGZ_ERROR	-1
diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c
index 015b907..73a185e 100644
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -235,7 +235,7 @@ VGZ_IbufEmpty(const struct vgz *vg)
 /*--------------------------------------------------------------------*/
 
 void
-VGZ_Obuf(struct vgz *vg, const void *ptr, ssize_t len)
+VGZ_Obuf(struct vgz *vg, void *ptr, ssize_t len)
 {
 
 	CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
@@ -353,8 +353,8 @@ VGZ_Gzip(struct vgz *vg, const void **pptr, size_t *plen, enum vgz_flag flags)
  */
 
 int
-VGZ_WrwGunzip(const struct sess *sp, struct vgz *vg, void *ibuf, ssize_t ibufl,
-    char *obuf, ssize_t obufl, ssize_t *obufp)
+VGZ_WrwGunzip(const struct sess *sp, struct vgz *vg, const void *ibuf,
+    ssize_t ibufl, char *obuf, ssize_t obufl, ssize_t *obufp)
 {
 	int i;
 	size_t dl;
@@ -601,7 +601,7 @@ vfp_testgzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
 	struct vgz *vg;
 	ssize_t l, w;
 	int i = -100;
-	uint8_t	ibuf[params->gzip_stack_buffer];
+	uint8_t	obuf[params->gzip_stack_buffer];
 	size_t dl;
 	const void *dp;
 	struct storage *st;
@@ -627,7 +627,7 @@ vfp_testgzip_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
 			RES_StreamPoll(sp);
 
 		while (!VGZ_IbufEmpty(vg)) {
-			VGZ_Obuf(vg, ibuf, sizeof ibuf);
+			VGZ_Obuf(vg, obuf, sizeof obuf);
 			i = VGZ_Gunzip(vg, &dp, &dl);
 			if (i != VGZ_OK && i != VGZ_END) {
 				WSP(sp, SLT_FetchError,
diff --git a/lib/libvarnish/tcp.c b/lib/libvarnish/tcp.c
index 1f529b3..9e132f3 100644
--- a/lib/libvarnish/tcp.c
+++ b/lib/libvarnish/tcp.c
@@ -89,8 +89,8 @@ TCP_name(const struct sockaddr_storage *addr, unsigned l,
 		 * for the gai_strerror in the bufffer :-(
 		 */
 		printf("getnameinfo = %d %s\n", i, gai_strerror(i));
-		snprintf(abuf, alen, "Conversion");
-		snprintf(pbuf, plen, "Failed");
+		(void)snprintf(abuf, alen, "Conversion");
+		(void)snprintf(pbuf, plen, "Failed");
 		return;
 	}
 	/* XXX dirty hack for v4-to-v6 mapped addresses */
@@ -125,8 +125,8 @@ TCP_hisname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen)
 	if (!getpeername(sock, (void*)&addr_s, &l))
 		TCP_name(&addr_s, l, abuf, alen, pbuf, plen);
 	else {
-		snprintf(abuf, alen, "<none>");
-		snprintf(pbuf, plen, "<none>");
+		(void)snprintf(abuf, alen, "<none>");
+		(void)snprintf(pbuf, plen, "<none>");
 	}
 }
 



More information about the varnish-commit mailing list