Enable (and fix) sign comparison warnings

pull/152/head
Drahflow 5 years ago
parent 8e4ed10b6c
commit 971f24d597

@ -1,5 +1,5 @@
CFLAGS?=-g -O2 -fstack-protector-strong -D_FORTIFY_SOURCE=2
override CFLAGS:=-Wall -Wno-switch -Wextra $(CFLAGS)
override CFLAGS:=-Wall -Werror -Wno-switch -Wextra $(CFLAGS)
LDLIBS=-lrt
OS := $(shell uname)

@ -152,14 +152,18 @@ skip_comment(char *s)
// never writes more than dstmax to dst
// returns how many bytes were appended
static size_t
safe_append(char *dst, size_t dstmax, char *strbeg, char *strend)
safe_append(char *dst, size_t dstmax, char *postbeg, char *postend)
{
size_t dstlen = strlen(dst);
if (dstmax - dstlen - 1 < strend - strbeg)
strend = strbeg + (dstmax - dstlen - 1);
memcpy(dst + dstlen, strbeg, strend - strbeg);
dst[dstlen + (strend - strbeg)] = 0;
return strend - strbeg;
size_t postlen = postend - postbeg;
if (postend - postbeg < 0)
return 0;
if (dstmax - dstlen - 1 < postlen)
postlen = dstmax - dstlen - 1;
memcpy(dst + dstlen, postbeg, postlen);
dst[dstlen + postlen] = 0;
return postlen;
}
static size_t

@ -314,7 +314,7 @@ print_header(char *line) {
if (!highbit) {
if (e-s >= 998)
goto force_qp;
if (e-s >= 78 - linelen) {
if (linelen + e-s >= 78) {
// wrap in advance before long word
printf("\n");
linelen = 0;
@ -336,7 +336,7 @@ force_qp:
s++;
if (linelen >= 78 - 13 - 4 ||
(e-s < (78 - 13)/3 &&
e-s >= (78 - linelen - 13)/3)) {
e-s >= (int)(78 - linelen - 13)/3)) {
// wrap in advance
printf("\n");
linelen = 0;

Loading…
Cancel
Save