[hackers] [quark] Be extra pedantic again and remove all warnings || Laslo Hunhold
commit 1879e14e79aca6f676d48e58500eb755f341e78b
Author: Laslo Hunhold <dev_AT_frign.de>
AuthorDate: Mon Mar 5 00:30:53 2018 +0100
Commit: Laslo Hunhold <dev_AT_frign.de>
CommitDate: Mon Mar 5 00:30:53 2018 +0100
Be extra pedantic again and remove all warnings
Since now config.def.h has been reduced we don't have any more unused
variables and thus the manual fiddling with error-levels is no longer
necessary.
To get a completely clean result though we have to still cast some
variables here and there.
diff --git a/config.mk b/config.mk
index 0eb5f27..7056241 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -9,7 +9,7 @@ MANPREFIX = $(PREFIX)/share/man
# flags
CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=700 -D_BSD_SOURCE
-CFLAGS = -std=c99 -pedantic -Wno-unused-variable -Wno-implicit-function-declaration -Wall -Os
+CFLAGS = -std=c99 -pedantic -Wall -Wextra -Os
LDFLAGS = -s
# compiler and linker
diff --git a/http.c b/http.c
index 9140cc7..cf08ada 100644
--- a/http.c
+++ b/http.c
_AT_@ -346,7 +346,7 @@ http_send_response(int fd, struct request *r)
/* if we have a vhost prefix, prepend it to the target */
if (s.vhost[i].prefix) {
- if (snprintf(realtarget, sizeof(realtarget), "%s%s",
+ if ((size_t)snprintf(realtarget, sizeof(realtarget), "%s%s",
s.vhost[i].prefix, realtarget) >= sizeof(realtarget)) {
return http_send_status(fd, S_REQUEST_TOO_LARGE);
}
_AT_@ -363,8 +363,8 @@ http_send_response(int fd, struct request *r)
}
/* swap out target prefix */
- if (snprintf(tmptarget, sizeof(tmptarget), "%s%s", s.map[i].to,
- realtarget + len) >= sizeof(tmptarget)) {
+ if ((size_t)snprintf(tmptarget, sizeof(tmptarget), "%s%s",
+ s.map[i].to, realtarget + len) >= sizeof(tmptarget)) {
return http_send_status(fd, S_REQUEST_TOO_LARGE);
}
memcpy(realtarget, tmptarget, sizeof(realtarget));
_AT_@ -441,8 +441,8 @@ http_send_response(int fd, struct request *r)
if (S_ISDIR(st.st_mode)) {
/* append docindex to target */
- if (snprintf(realtarget, sizeof(realtarget), "%s%s",
- r->target, s.docindex) >= sizeof(realtarget)) {
+ if ((size_t)snprintf(realtarget, sizeof(realtarget), "%s%s",
+ r->target, s.docindex) >= sizeof(realtarget)) {
return http_send_status(fd, S_REQUEST_TOO_LARGE);
}
diff --git a/main.c b/main.c
index 7bcaeed..1c7d285 100644
--- a/main.c
+++ b/main.c
_AT_@ -109,8 +109,9 @@ main(int argc, char *argv[])
struct rlimit rlim;
struct sockaddr_storage in_sa;
pid_t cpid, wpid, spid;
+ size_t i;
socklen_t in_sa_len;
- int i, insock, status = 0, infd;
+ int insock, status = 0, infd;
const char *err;
char *tok;
diff --git a/resp.c b/resp.c
index 7a7d7a2..06714fb 100644
--- a/resp.c
+++ b/resp.c
_AT_@ -75,7 +75,7 @@ resp_dir(int fd, char *name, struct request *r)
}
/* listing */
- for (i = 0; i < dirlen; i++) {
+ for (i = 0; i < (size_t)dirlen; i++) {
/* skip hidden files, "." and ".." */
if (e[i]->d_name[0] == '.') {
continue;
_AT_@ -165,7 +165,8 @@ resp_file(int fd, char *name, struct request *r, struct stat *st, char *mime,
/* write data until upper bound is hit */
remaining = upper - lower + 1;
- while ((bread = fread(buf, 1, MIN(sizeof(buf), remaining), fp))) {
+ while ((bread = fread(buf, 1, MIN(sizeof(buf),
+ (size_t)remaining), fp))) {
if (bread < 0) {
return S_INTERNAL_SERVER_ERROR;
}
Received on Mon Mar 05 2018 - 00:32:00 CET
This archive was generated by hypermail 2.3.0
: Mon Mar 05 2018 - 00:36:39 CET