From c8162a80beba80f3b1d04fdba8e74bf5366c47f7 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Tue, 30 Oct 2018 01:53:24 +0100 Subject: [PATCH] Fix some compiler warnings of Apple Xcode/Clang For example: * src/ngircd/irc-login.c:102:21: Implicit conversion loses integer precision: 'int' to 'char' * src/ngircd/conn.c:1084:9: Implicit conversion turns floating-point number into integer: 'double' to 'bool' * src/tool/tool.c:85:10: Implicit conversion loses integer precision: 'int' to 'char' --- src/ngircd/conn.c | 4 ++-- src/ngircd/irc-login.c | 4 ++-- src/tool/tool.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/ngircd/conn.c b/src/ngircd/conn.c index e211d184..69567769 100644 --- a/src/ngircd/conn.c +++ b/src/ngircd/conn.c @@ -1081,9 +1081,9 @@ Conn_Close(CONN_ID Idx, const char *LogMsg, const char *FwdMsg, bool InformClien * the calculation of in_p and out_p: in_z_k and out_z_k * are non-zero, that's guaranteed by the protocol until * compression can be enabled. */ - if (! in_z_k) + if (in_z_k <= 0) in_z_k = in_k; - if (! out_z_k) + if (out_z_k <= 0) out_z_k = out_k; in_p = (int)(( in_k * 100 ) / in_z_k ); out_p = (int)(( out_k * 100 ) / out_z_k ); diff --git a/src/ngircd/irc-login.c b/src/ngircd/irc-login.c index 2a0a8fa5..846b10d6 100644 --- a/src/ngircd/irc-login.c +++ b/src/ngircd/irc-login.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2015 Alexander Barton (alex@barton.de) and Contributors. + * Copyright (c)2001-2018 Alexander Barton (alex@barton.de) and Contributors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -89,7 +89,7 @@ IRC_PASS( CLIENT *Client, REQUEST *Req ) /* Protocol version */ if (Req->argc >= 2 && strlen(Req->argv[1]) >= 4) { - int c2, c4; + char c2, c4; c2 = Req->argv[1][2]; c4 = Req->argv[1][4]; diff --git a/src/tool/tool.c b/src/tool/tool.c index b00e235e..35c1ee67 100644 --- a/src/tool/tool.c +++ b/src/tool/tool.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors. + * Copyright (c)2001-2018 Alexander Barton (alex@barton.de) and Contributors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -82,7 +82,7 @@ ngt_UpperStr(char *String) ptr = String; while(*ptr) { - *ptr = toupper((int)*ptr); + *ptr = (char)toupper(*ptr); ptr++; } return String; @@ -101,7 +101,7 @@ ngt_LowerStr(char *String) ptr = String; while(*ptr) { - *ptr = tolower((int)*ptr); + *ptr = (char)tolower(*ptr); ptr++; } return String; -- 2.39.2