commit c207930: [Minor] Fix various warnings

Vsevolod Stakhov vsevolod at highsecure.ru
Sun Apr 7 08:49:03 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-04-07 09:34:46 +0100
URL: https://github.com/rspamd/rspamd/commit/c207930dc64a680cc9a1ae9075e66f9d963e32e4

[Minor] Fix various warnings

---
 contrib/librdns/util.c       | 10 +++++-----
 src/libcryptobox/cryptobox.c |  4 ++++
 src/libutil/mem_pool.c       |  2 +-
 src/libutil/str_util.c       |  6 +++---
 src/libutil/str_util.h       |  2 +-
 src/rspamadm/lua_repl.c      |  2 --
 6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/contrib/librdns/util.c b/contrib/librdns/util.c
index 863db3564..9536a35b2 100644
--- a/contrib/librdns/util.c
+++ b/contrib/librdns/util.c
@@ -56,8 +56,7 @@ static int
 rdns_make_inet_socket (int type, struct addrinfo *addr, struct sockaddr **psockaddr,
 		socklen_t *psocklen)
 {
-	int fd, r, s_error;
-	socklen_t optlen;
+	int fd = -1;
 	struct addrinfo *cur;
 
 	cur = addr;
@@ -96,8 +95,7 @@ out:
 static int
 rdns_make_unix_socket (const char *path, struct sockaddr_un *addr, int type)
 {
-	int fd = -1, s_error, r, serrno;
-	socklen_t optlen;
+	int fd = -1, serrno;
 
 	if (path == NULL) {
 		return -1;
@@ -178,7 +176,7 @@ rdns_make_client_socket (const char *credits,
 					struct sockaddr *cpy;
 
 					cpy = calloc (1, sizeof (un));
-					*psockaddr = sizeof (un);
+					*psocklen = sizeof (un);
 
 					if (cpy == NULL) {
 						close (r);
@@ -424,6 +422,8 @@ rdns_reply_free (struct rdns_reply *rep)
 				free (entry->content.soa.mname);
 				free (entry->content.soa.admin);
 				break;
+			default:
+				break;
 			}
 			free (entry);
 		}
diff --git a/src/libcryptobox/cryptobox.c b/src/libcryptobox/cryptobox.c
index d8f5459d3..1dcd18838 100644
--- a/src/libcryptobox/cryptobox.c
+++ b/src/libcryptobox/cryptobox.c
@@ -245,6 +245,8 @@ rspamd_cryptobox_test_instr (gint instr)
 	signal (SIGILL, old_handler);
 #endif
 
+	(void)rd; /* Silence warning */
+
 	/* We actually never return here if SIGILL has been caught */
 	return ok == 1;
 }
@@ -354,6 +356,8 @@ rspamd_cryptobox_init (void)
 			case CPUID_RDRAND:
 				rspamd_printf_gstring (buf, "rdrand, ");
 				break;
+			default:
+				break; /* Silence warning */
 			}
 		}
 	}
diff --git a/src/libutil/mem_pool.c b/src/libutil/mem_pool.c
index a519013d1..7ef649c0c 100644
--- a/src/libutil/mem_pool.c
+++ b/src/libutil/mem_pool.c
@@ -75,7 +75,7 @@ struct rspamd_mempool_entry_point {
 static inline uint32_t
 rspamd_entry_hash (const char *str)
 {
-	return rspamd_cryptobox_fast_hash (str, strlen (str), rspamd_hash_seed ());
+	return (guint)rspamd_cryptobox_fast_hash (str, strlen (str), rspamd_hash_seed ());
 }
 
 static inline int
diff --git a/src/libutil/str_util.c b/src/libutil/str_util.c
index ac7471ada..d32a0d4d1 100644
--- a/src/libutil/str_util.c
+++ b/src/libutil/str_util.c
@@ -265,7 +265,7 @@ rspamd_str_hash (gconstpointer key)
 
 	len = strlen ((const gchar *)key);
 
-	return rspamd_cryptobox_fast_hash (key, len, rspamd_hash_seed ());
+	return (guint)rspamd_cryptobox_fast_hash (key, len, rspamd_hash_seed ());
 }
 
 gboolean
@@ -314,7 +314,7 @@ rspamd_ftok_hash (gconstpointer key)
 {
 	const rspamd_ftok_t *f = key;
 
-	return t1ha (f->begin, f->len, rspamd_hash_seed ());
+	return (guint)rspamd_cryptobox_fast_hash (f->begin, f->len, rspamd_hash_seed ());
 }
 
 gboolean
@@ -2768,7 +2768,7 @@ rspamd_str_regexp_escape (const gchar *pattern, gsize slen,
 
 
 gchar *
-rspamd_str_make_utf_valid (const gchar *src, gsize slen, gsize *dstlen)
+rspamd_str_make_utf_valid (const guchar *src, gsize slen, gsize *dstlen)
 {
 	GString *dst;
 	const gchar *last;
diff --git a/src/libutil/str_util.h b/src/libutil/str_util.h
index 91efdf187..8e8898a32 100644
--- a/src/libutil/str_util.h
+++ b/src/libutil/str_util.h
@@ -476,7 +476,7 @@ rspamd_str_regexp_escape (const gchar *pattern, gsize slen,
  * @param dstelen
  * @return
  */
-gchar * rspamd_str_make_utf_valid (const gchar *src, gsize slen, gsize *dstlen);
+gchar * rspamd_str_make_utf_valid (const guchar *src, gsize slen, gsize *dstlen);
 
 /**
  * Strips characters in `strip_chars` from start and end of the GString
diff --git a/src/rspamadm/lua_repl.c b/src/rspamadm/lua_repl.c
index e91bd34fa..430c800f9 100644
--- a/src/rspamadm/lua_repl.c
+++ b/src/rspamadm/lua_repl.c
@@ -619,8 +619,6 @@ static void
 rspamadm_lua_error_handler (struct rspamd_http_connection_entry *conn_ent,
 	GError *err)
 {
-	struct rspamadm_lua_repl_session *session = conn_ent->ud;
-
 	rspamd_fprintf (stderr, "http error occurred: %s\n", err->message);
 }
 


More information about the Commits mailing list