diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-11-22 19:01:07 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-11-22 19:01:07 -0800 |
commit | 76329c0206ede0a986da423e6a813ef91334f6cd (patch) | |
tree | 5a70ab28b4d10e92b0e2ca8e12efc99f2b8fd425 /src/luasec | |
parent | e77f3eb9f9cfbd79f56c666545e96d00cb752695 (diff) | |
download | teliva-76329c0206ede0a986da423e6a813ef91334f6cd.tar.gz |
standardize warning flags everywhere
I'd like to enable -Wextra as well, but that creates some false positives. I've at least made my changes clean w.r.t. -Wextra. Now we have 4 remaining warnings with gcc 9.3 that seem genuine. Need to fix those.
Diffstat (limited to 'src/luasec')
-rw-r--r-- | src/luasec/Makefile | 2 | ||||
-rw-r--r-- | src/luasec/context.c | 16 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/luasec/Makefile b/src/luasec/Makefile index d266209..c495109 100644 --- a/src/luasec/Makefile +++ b/src/luasec/Makefile @@ -9,7 +9,7 @@ OBJS= \ config.o \ ec.o -WARN=-Wall -pedantic +WARN=-Wall -Wpedantic -Wshadow BSD_CFLAGS=-O2 -fPIC $(WARN) $(INCDIR) $(DEFS) BSD_LDFLAGS=-O -fPIC -shared $(LIBDIR) diff --git a/src/luasec/context.c b/src/luasec/context.c index 5496fbf..b67f36f 100644 --- a/src/luasec/context.c +++ b/src/luasec/context.c @@ -1,7 +1,7 @@ /*-------------------------------------------------------------------------- * LuaSec 1.0.2 * - * Copyright (C) 2014-2021 Kim Alvefur, Paul Aurich, Tobias Markmann, + * Copyright (C) 2014-2021 Kim Alvefur, Paul Aurich, Tobias Markmann, * Matthew Wild. * Copyright (C) 2006-2021 Bruno Silvestre. * @@ -120,7 +120,7 @@ static const SSL_METHOD* str2method(const char *method, int *vmin, int *vmax) */ static int set_verify_flag(const char *str, int *flag) { - if (!strcmp(str, "none")) { + if (!strcmp(str, "none")) { *flag |= SSL_VERIFY_NONE; return 1; } @@ -132,7 +132,7 @@ static int set_verify_flag(const char *str, int *flag) *flag |= SSL_VERIFY_CLIENT_ONCE; return 1; } - if (!strcmp(str, "fail_if_no_peer_cert")) { + if (!strcmp(str, "fail_if_no_peer_cert")) { *flag |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT; return 1; } @@ -153,7 +153,7 @@ static int passwd_cb(char *buf, int size, int flag, void *udata) lua_pop(L, 1); /* Remove the result from the stack */ return 0; } - /* fallback */ + /* fall through */ case LUA_TSTRING: strncpy(buf, lua_tostring(L, -1), size); lua_pop(L, 1); /* Remove the result from the stack */ @@ -398,8 +398,8 @@ static int load_key(lua_State *L) case LUA_TFUNCTION: SSL_CTX_set_default_passwd_cb(ctx, passwd_cb); SSL_CTX_set_default_passwd_cb_userdata(ctx, L); - /* fallback */ - case LUA_TNIL: + /* fall through */ + case LUA_TNIL: if (SSL_CTX_use_PrivateKey_file(ctx, filename, SSL_FILETYPE_PEM) == 1) lua_pushboolean(L, 1); else { @@ -543,7 +543,7 @@ static int set_mode(lua_State *L) lua_pushboolean(L, 0); lua_pushfstring(L, "invalid mode (%s)", str); return 1; -} +} /** * Configure DH parameters. @@ -677,7 +677,7 @@ static int alpn_cb(SSL *s, const unsigned char **out, unsigned char *outlen, if (ret != OPENSSL_NPN_NEGOTIATED) { lua_pop(L, 2); return SSL_TLSEXT_ERR_NOACK; - } + } // Copy the result because lua_pop() can collect the pointer ctx->alpn = malloc(*outlen); |