diff --git a/src/emu/chan.c b/src/emu/chan.c index 40cfba9..6d24a0a 100644 --- a/src/emu/chan.c +++ b/src/emu/chan.c @@ -15,9 +15,11 @@ chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...) va_list ap; va_start(ap, fmt); - int n = (int) ARRAYLEN(chan->name); - int ret = vsnprintf(chan->name, (size_t) n, fmt, ap); - if (ret >= n) + size_t n = ARRAYLEN(chan->name); + int ret = vsnprintf(chan->name, n, fmt, ap); + if (ret < 0) + die("vsnprintf failed"); + else if ((size_t) ret >= n) die("channel name too long"); va_end(ap); diff --git a/src/emu/ovnievents.c b/src/emu/ovnievents.c index c217e1e..bb037a4 100644 --- a/src/emu/ovnievents.c +++ b/src/emu/ovnievents.c @@ -29,14 +29,14 @@ html_encode(char *dst, int ndst, const char *src) return -1; } - int c = src[i]; + char c = src[i]; switch (c) { case '&': strcpy(&dst[j], "&"); j += 5; break; case '"': strcpy(&dst[j], """); j += 6; break; case '\'': strcpy(&dst[j], "'"); j += 6; break; case '<': strcpy(&dst[j], "<"); j += 4; break; case '>': strcpy(&dst[j], ">"); j += 4; break; - default: dst[j++] = (char) c; break; + default: dst[j++] = c; break; } }