Fix easy cases of unneeded casts
This commit is contained in:
parent
c8750b9dfd
commit
7496a6a866
@ -15,9 +15,11 @@ chan_init(struct chan *chan, enum chan_type type, const char *fmt, ...)
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
|
||||||
int n = (int) ARRAYLEN(chan->name);
|
size_t n = ARRAYLEN(chan->name);
|
||||||
int ret = vsnprintf(chan->name, (size_t) n, fmt, ap);
|
int ret = vsnprintf(chan->name, n, fmt, ap);
|
||||||
if (ret >= n)
|
if (ret < 0)
|
||||||
|
die("vsnprintf failed");
|
||||||
|
else if ((size_t) ret >= n)
|
||||||
die("channel name too long");
|
die("channel name too long");
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
|
@ -29,14 +29,14 @@ html_encode(char *dst, int ndst, const char *src)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int c = src[i];
|
char c = src[i];
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '&': strcpy(&dst[j], "&"); j += 5; break;
|
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 += 6; break;
|
case '\'': strcpy(&dst[j], "'"); j += 6; break;
|
||||||
case '<': strcpy(&dst[j], "<"); j += 4; break;
|
case '<': strcpy(&dst[j], "<"); j += 4; 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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user