[master] 3d60db6 Sort out some signed/unsigned mismatches

Poul-Henning Kamp phk at FreeBSD.org
Thu Apr 27 08:40:05 CEST 2017


commit 3d60db6b8ec5de2337e52b73163305ae7c5c0094
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Apr 27 06:39:42 2017 +0000

    Sort out some signed/unsigned mismatches

diff --git a/include/vapi/vsl.h b/include/vapi/vsl.h
index c6afb2f..03d98d7 100644
--- a/include/vapi/vsl.h
+++ b/include/vapi/vsl.h
@@ -110,8 +110,8 @@ enum VSL_reason_e {
 
 struct VSL_transaction {
 	unsigned		level;
-	int32_t			vxid;
-	int32_t			vxid_parent;
+	uint32_t		vxid;
+	uint32_t		vxid_parent;
 	enum VSL_transaction_e	type;
 	enum VSL_reason_e	reason;
 	struct VSL_cursor	*c;
diff --git a/include/vre.h b/include/vre.h
index f19ff2c..8062a3a 100644
--- a/include/vre.h
+++ b/include/vre.h
@@ -52,7 +52,7 @@ extern const unsigned VRE_has_jit;
 extern const unsigned VRE_CASELESS;
 extern const unsigned VRE_NOTEMPTY;
 
-vre_t *VRE_compile(const char *, int, const char **, int *);
+vre_t *VRE_compile(const char *, unsigned, const char **, int *);
 int VRE_exec(const vre_t *code, const char *subject, int length,
     int startoffset, int options, int *ovector, int ovecsize,
     const volatile struct vre_limits *lim);
diff --git a/lib/libvarnish/vre.c b/lib/libvarnish/vre.c
index b625566..61469d1 100644
--- a/lib/libvarnish/vre.c
+++ b/lib/libvarnish/vre.c
@@ -65,7 +65,7 @@ const unsigned VRE_CASELESS = PCRE_CASELESS;
 const unsigned VRE_NOTEMPTY = PCRE_NOTEMPTY;
 
 vre_t *
-VRE_compile(const char *pattern, int options,
+VRE_compile(const char *pattern, unsigned options,
     const char **errptr, int *erroffset)
 {
 	vre_t *v;
diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c
index 207a862..b418c64 100644
--- a/lib/libvarnishapi/vsl.c
+++ b/lib/libvarnishapi/vsl.c
@@ -368,7 +368,7 @@ VSL_PrintTransactions(struct VSL_data *vsl, struct VSL_transaction * const pt[],
 			else
 				VSL_PRINT(fo, "%-3.*s ",
 				    (int)(t->level), "***");
-			VSL_PRINT(fo, "%*.s%-14s %*.s%-10d\n",
+			VSL_PRINT(fo, "%*.s%-14s %*.s%-10u\n",
 			    verbose ? 10 + 1 : 0, " ",
 			    VSL_transactions[t->type],
 			    verbose ? 1 + 1 : 0, " ",
diff --git a/lib/libvarnishapi/vsl_cursor.c b/lib/libvarnishapi/vsl_cursor.c
index 0285df3..c90f93d 100644
--- a/lib/libvarnishapi/vsl_cursor.c
+++ b/lib/libvarnishapi/vsl_cursor.c
@@ -318,7 +318,7 @@ vslc_file_delete(const struct VSL_cursor *cursor)
 static ssize_t
 vslc_file_readn(int fd, void *buf, size_t n)
 {
-	size_t t = 0;
+	ssize_t t = 0;
 	ssize_t l;
 
 	while (t < n) {
@@ -335,7 +335,7 @@ vslc_file_next(const struct VSL_cursor *cursor)
 {
 	struct vslc_file *c;
 	ssize_t i;
-	size_t l;
+	ssize_t l;
 
 	CAST_OBJ_NOTNULL(c, cursor->priv_data, VSLC_FILE_MAGIC);
 	assert(&c->cursor == cursor);
diff --git a/lib/libvarnishapi/vut.c b/lib/libvarnishapi/vut.c
index 0783f7d..7889010 100644
--- a/lib/libvarnishapi/vut.c
+++ b/lib/libvarnishapi/vut.c
@@ -237,10 +237,10 @@ VUT_Setup(void)
 	AZ(VUT.vsm);
 	AZ(VUT.vslq);
 
-	/* Check input arguments */
-	if ((VUT.n_arg == NULL ? 0 : 1) +
-	    (VUT.N_arg == NULL ? 0 : 1) +
-	    (VUT.r_arg == NULL ? 0 : 1) > 1)
+	/* Check input arguments (2 used for bug in FlexeLint) */
+	if ((VUT.n_arg == NULL ? 0 : 2) +
+	    (VUT.N_arg == NULL ? 0 : 2) +
+	    (VUT.r_arg == NULL ? 0 : 2) > 2)
 		VUT_Error(1, "Only one of -n, -N and -r options may be used");
 
 	/* Create and validate the query expression */
diff --git a/lib/libvarnishapi/vxp.h b/lib/libvarnishapi/vxp.h
index e1e9918..b282a17 100644
--- a/lib/libvarnishapi/vxp.h
+++ b/lib/libvarnishapi/vxp.h
@@ -64,7 +64,7 @@ struct vxp {
 	struct token		*t;
 
 	unsigned		vex_options;
-	int			vre_options;
+	unsigned		vre_options;
 
 	struct vsb		*sb;
 	int			err;
diff --git a/lib/libvarnishapi/vxp_parse.c b/lib/libvarnishapi/vxp_parse.c
index 0331bd3..201d03a 100644
--- a/lib/libvarnishapi/vxp_parse.c
+++ b/lib/libvarnishapi/vxp_parse.c
@@ -195,7 +195,7 @@ vxp_expr_lhs(struct vxp *vxp, struct vex_lhs **plhs)
 }
 
 static void
-vxp_expr_num(struct vxp *vxp, struct vex_rhs **prhs, int vxid)
+vxp_expr_num(struct vxp *vxp, struct vex_rhs **prhs, unsigned vxid)
 {
 	char *endptr;
 



More information about the varnish-commit mailing list