From 1702786389a71b28aac9c2f66dc27fa02889de22 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Thu, 18 Jul 2019 21:07:06 +0100 Subject: Fix compiler warnings emitted by Clang/LLVM and some older GCC versions. --- TODO | 4 ---- config.c | 5 ++--- functions.c | 2 +- message.c | 2 +- 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/TODO b/TODO index 9f95a77..2753cf7 100644 --- a/TODO +++ b/TODO @@ -1,5 +1 @@ -Fuzzing. - -Fix warnings with different compilers (older gcc, clang). - Support multiple connect commands. diff --git a/config.c b/config.c index 7f08e52..18e2178 100644 --- a/config.c +++ b/config.c @@ -22,7 +22,6 @@ // Returns 1 for success or 0 for error/failure. int getconfstr(char *confname, char *filename, char* dest) { FILE *fp; - char *ret; char str[MAXCHAR]; int found = 0; // Have we found the configuration option? @@ -57,7 +56,7 @@ int getconfstr(char *confname, char *filename, char* dest) { // If the resulting temporary string contains the requested option name, // we have found our configuration option and it is in the current 'str' - if (!(ret = strstr(substr, confname)) == 0) { + if (strstr(substr, confname)) { found = 1; break; } @@ -71,7 +70,7 @@ int getconfstr(char *confname, char *filename, char* dest) { return 0; } - long int pos; + long int pos = 0; char conf[MAXCHAR]; // Temporary string to build configuration value in // Starting from the end of the option name, find the position of the start of the configuration value diff --git a/functions.c b/functions.c index a1faf16..8557f7a 100644 --- a/functions.c +++ b/functions.c @@ -1195,7 +1195,7 @@ int addclientcode(int sourcefd, char *code, struct clientcodes *clientcodes, str debugprint(DEBUG_SOME, "addclientcode(): Adding client code '%s' if it doesn't already exist.\n", code); // Make sure there aren't too many client codes already - int counter; + int counter = 0; for (int i = 0; i < MAXCLIENTCODES; i++) { if (clientcodes[i].code[0]) { counter++; diff --git a/message.c b/message.c index 8eceb4b..3e9f15c 100644 --- a/message.c +++ b/message.c @@ -96,7 +96,7 @@ int processservermessage(SSL *server_ssl, char *str, struct client *clients, int // If this is a reconnection, JOIN existing channels and catch clients up again if (ircdstate->reconnecting) { // First tell clients if our nick changed - if (!strcmp(ircdstate->ircnick, ircdstate->oldnick) == 0) { + if (!strcmp(ircdstate->ircnick, ircdstate->oldnick)) { debugprint(DEBUG_SOME, "Telling clients about nick change.\n"); char nickmsg[MAXDATASIZE]; snprintf(nickmsg, MAXDATASIZE, ":%s NICK :%s", ircdstate->oldnick, ircdstate->ircnick); -- cgit v1.2.3