fixed warnings

This commit is contained in:
WanderingPenwing 2024-08-03 11:30:39 +02:00
parent 1420954ac8
commit 620a979271
2 changed files with 25 additions and 15 deletions

2
surf.c
View file

@ -2045,7 +2045,7 @@ msgext(Client *c, char type, const Arg *a)
} }
if (send(spair[0], msg, ret, 0) != ret) if (send(spair[0], msg, ret, 0) != ret)
fprintf(stderr, "surf: error sending: %u%c%d (%d)\n", fprintf(stderr, "surf: error sending: %" PRIu64 "%c%d (%d)\n",
c->pageid, type, a->i, ret); c->pageid, type, a->i, ret);
} }

View file

@ -25,7 +25,7 @@ msgsurf(guint64 pageid, const char *s)
size_t sln = strlen(s); size_t sln = strlen(s);
int ret; int ret;
if ((ret = snprintf(msg, sizeof(msg), "%c%s", pageid, s)) if ((ret = snprintf(msg, sizeof(msg), "%" PRIu64 "%s", pageid, s))
>= sizeof(msg)) { >= sizeof(msg)) {
fprintf(stderr, "webext: msg: message too long: %d\n", ret); fprintf(stderr, "webext: msg: message too long: %d\n", ret);
return; return;
@ -55,7 +55,7 @@ readsock(GIOChannel *s, GIOCondition c, gpointer unused)
} }
if (msgsz < 2) { if (msgsz < 2) {
fprintf(stderr, "webext: readsock: message too short: %d\n", fprintf(stderr, "webext: readsock: message too short: %zu\n",
msgsz); msgsz);
return TRUE; return TRUE;
} }
@ -72,7 +72,12 @@ readsock(GIOChannel *s, GIOCondition c, gpointer unused)
snprintf(js, sizeof(js), snprintf(js, sizeof(js),
"window.scrollBy(window.innerWidth/100*%d,0);", "window.scrollBy(window.innerWidth/100*%d,0);",
msg[2]); msg[2]);
jsc_context_evaluate(jsc, js, -1); JSCValue *h_result = jsc_context_evaluate(jsc, js, -1);
if (h_result) {
free(h_result);
} else {
fprintf(stderr, "Error evaluating JavaScript\n");
}
break; break;
case 'v': case 'v':
if (msgsz != 3) if (msgsz != 3)
@ -80,7 +85,12 @@ readsock(GIOChannel *s, GIOCondition c, gpointer unused)
snprintf(js, sizeof(js), snprintf(js, sizeof(js),
"window.scrollBy(0,window.innerHeight/100*%d);", "window.scrollBy(0,window.innerHeight/100*%d);",
msg[2]); msg[2]);
jsc_context_evaluate(jsc, js, -1); JSCValue *v_result = jsc_context_evaluate(jsc, js, -1);
if (v_result) {
free(v_result);
} else {
fprintf(stderr, "Error evaluating JavaScript\n");
}
break; break;
} }