[hackers][surf] fix compiler warnings

From: Prathu Baronia <prathu.baronia_AT_praton.me>
Date: Mon, 21 Mar 2022 22:56:05 +0530

- Replace %d with %ld specifiers for long unsigned int variables.
- g_variant_get expects Gvariant* instead of const Gvariant*.

Signed-off-by: Prathu Baronia <prathu.baronia_AT_praton.me>
---
 surf.c        | 6 +++---
 webext-surf.c | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/surf.c b/surf.c
index 03d8242..069d8ec 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -1237,7 +1237,7 @@ readsock(GIOChannel *s, GIOCondition ioc, gpointer unused)
 		return TRUE;
 	}
 	if (msgsz < 2) {
-		fprintf(stderr, "surf: message too short: %d\n", msgsz);
+		fprintf(stderr, "surf: message too short: %ld\n", msgsz);
 		return TRUE;
 	}
 
_AT_@ -1863,14 +1863,14 @@ msgext(Client *c, char type, const Arg *a)
 	if (spair[0] < 0)
 		return;
 
-	if ((ret = snprintf(msg, sizeof(msg), "%c%c%c", c->pageid, type, a->i))
+	if ((ret = snprintf(msg, sizeof(msg), "%ld%c%c", c->pageid, type, a->i))
 	    >= sizeof(msg)) {
 		fprintf(stderr, "surf: message too long: %d\n", ret);
 		return;
 	}
 
 	if (send(spair[0], msg, ret, 0) != ret)
-		fprintf(stderr, "surf: error sending: %u%c%d (%d)\n",
+		fprintf(stderr, "surf: error sending: %ld%c%d (%d)\n",
 		        c->pageid, type, a->i, ret);
 }
 
diff --git a/webext-surf.c b/webext-surf.c
index d087219..f852c3e 100644
--- a/webext-surf.c
+++ b/webext-surf.c
_AT_@ -25,7 +25,7 @@ msgsurf(guint64 pageid, const char *s)
 	size_t sln = strlen(s);
 	int ret;
 
-	if ((ret = snprintf(msg, sizeof(msg), "%c%s", pageid, s))
+	if ((ret = snprintf(msg, sizeof(msg), "%ld%s", pageid, s))
 	    >= sizeof(msg)) {
 		fprintf(stderr, "webext: msg: message too long: %d\n", ret);
 		return;
_AT_@ -55,7 +55,7 @@ readsock(GIOChannel *s, GIOCondition c, gpointer unused)
 	}
 
 	if (msgsz < 2) {
-		fprintf(stderr, "webext: readsock: message too short: %d\n",
+		fprintf(stderr, "webext: readsock: message too short: %ld\n",
 		        msgsz);
 		return TRUE;
 	}
_AT_@ -95,7 +95,7 @@ webkit_web_extension_initialize_with_user_data(WebKitWebExtension *e,
 
 	webext = e;
 
-	g_variant_get(gv, "i", &sock);
+	g_variant_get((GVariant *)gv, "i", &sock);
 
 	gchansock = g_io_channel_unix_new(sock);
 	g_io_channel_set_encoding(gchansock, NULL, NULL);
-- 
2.17.1
Received on Mon Mar 21 2022 - 18:26:05 CET

This archive was generated by hypermail 2.3.0 : Mon Mar 21 2022 - 19:12:37 CET