mirror of
				https://github.com/osmarks/ngircd.git
				synced 2025-10-31 05:52:59 +00:00 
			
		
		
		
	Fix "implicit conversion shortens 64-bit value" warning
This patch fixes the following gcc warning in our sources: "implicit conversion shortens 64-bit value into a 32-bit value"
This commit is contained in:
		| @@ -151,7 +151,8 @@ ng_ipaddr_tostr_r(const ng_ipaddr_t *addr, char *str) | |||||||
| 	if (*str == ':') { | 	if (*str == ':') { | ||||||
| 		char tmp[NG_INET_ADDRSTRLEN] = "0"; | 		char tmp[NG_INET_ADDRSTRLEN] = "0"; | ||||||
| 		ret = getnameinfo(sa, ng_ipaddr_salen(addr), | 		ret = getnameinfo(sa, ng_ipaddr_salen(addr), | ||||||
| 				tmp+1, sizeof(tmp) -1, NULL, 0, NI_NUMERICHOST); | 				  tmp + 1, (socklen_t)sizeof(tmp) - 1, | ||||||
|  | 				  NULL, 0, NI_NUMERICHOST); | ||||||
| 		if (ret == 0) | 		if (ret == 0) | ||||||
| 			strlcpy(str, tmp, NG_INET_ADDRSTRLEN); | 			strlcpy(str, tmp, NG_INET_ADDRSTRLEN); | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -58,10 +58,10 @@ ng_ipaddr_salen(const ng_ipaddr_t *a) | |||||||
| #ifdef WANT_IPV6 | #ifdef WANT_IPV6 | ||||||
| 	assert(a->sa.sa_family == AF_INET || a->sa.sa_family == AF_INET6); | 	assert(a->sa.sa_family == AF_INET || a->sa.sa_family == AF_INET6); | ||||||
| 	if (a->sa.sa_family == AF_INET6) | 	if (a->sa.sa_family == AF_INET6) | ||||||
| 		return sizeof(a->sin6); | 		return (socklen_t)sizeof(a->sin6); | ||||||
| #endif | #endif | ||||||
| 	assert(a->sin4.sin_family == AF_INET); | 	assert(a->sin4.sin_family == AF_INET); | ||||||
| 	return sizeof(a->sin4); | 	return (socklen_t)sizeof(a->sin4); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -115,4 +115,3 @@ ng_ipaddr_tostr_r(const ng_ipaddr_t *addr, char *d) | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| /* -eof- */ | /* -eof- */ | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1085,7 +1085,7 @@ Channel_CheckKey(CHANNEL *Chan, CLIENT *Client, const char *Key) | |||||||
| 		return false; | 		return false; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	while (fgets(line, sizeof(line), fd) != NULL) { | 	while (fgets(line, (int)sizeof(line), fd) != NULL) { | ||||||
| 		ngt_TrimStr(line); | 		ngt_TrimStr(line); | ||||||
| 		if (! (nick = strchr(line, ':'))) | 		if (! (nick = strchr(line, ':'))) | ||||||
| 			continue; | 			continue; | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* | /* | ||||||
|  * ngIRCd -- The Next Generation IRC Daemon |  * ngIRCd -- The Next Generation IRC Daemon | ||||||
|  * Copyright (c)2001-2008 Alexander Barton (alex@barton.de) |  * Copyright (c)2001-2009 Alexander Barton (alex@barton.de) | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or modify |  * 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 |  * it under the terms of the GNU General Public License as published by | ||||||
| @@ -152,8 +152,8 @@ ports_parse(array *a, int Line, char *Arg) | |||||||
| 	 * must be separated by "," */ | 	 * must be separated by "," */ | ||||||
| 	ptr = strtok( Arg, "," ); | 	ptr = strtok( Arg, "," ); | ||||||
| 	while (ptr) { | 	while (ptr) { | ||||||
| 		ngt_TrimStr( ptr ); | 		ngt_TrimStr(ptr); | ||||||
| 		port = atol( ptr ); | 		port = atoi(ptr); | ||||||
| 		if (port > 0 && port < 0xFFFF) { | 		if (port > 0 && port < 0xFFFF) { | ||||||
| 			port16 = (UINT16) port; | 			port16 = (UINT16) port; | ||||||
| 			if (!array_catb(a, (char*)&port16, sizeof port16)) | 			if (!array_catb(a, (char*)&port16, sizeof port16)) | ||||||
| @@ -545,7 +545,7 @@ Set_Defaults( bool InitServers ) | |||||||
| static bool | static bool | ||||||
| no_listenports(void) | no_listenports(void) | ||||||
| { | { | ||||||
| 	unsigned int cnt = array_bytes(&Conf_ListenPorts); | 	size_t cnt = array_bytes(&Conf_ListenPorts); | ||||||
| #ifdef SSL_SUPPORT | #ifdef SSL_SUPPORT | ||||||
| 	cnt += array_bytes(&Conf_SSLOptions.ListenPorts); | 	cnt += array_bytes(&Conf_SSLOptions.ListenPorts); | ||||||
| #endif | #endif | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* | /* | ||||||
|  * ngIRCd -- The Next Generation IRC Daemon |  * ngIRCd -- The Next Generation IRC Daemon | ||||||
|  * Copyright (c)2001-2007 Alexander Barton (alex@barton.de) |  * Copyright (c)2001-2009 Alexander Barton (alex@barton.de) | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or modify |  * 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 |  * it under the terms of the GNU General Public License as published by | ||||||
| @@ -155,7 +155,7 @@ cb_connserver(int sock, UNUSED short what) | |||||||
| 	assert( what & IO_WANTWRITE); | 	assert( what & IO_WANTWRITE); | ||||||
|  |  | ||||||
| 	/* connect() finished, get result. */ | 	/* connect() finished, get result. */ | ||||||
| 	sock_len = sizeof( err ); | 	sock_len = (socklen_t)sizeof(err); | ||||||
| 	res = getsockopt( My_Connections[idx].sock, SOL_SOCKET, SO_ERROR, &err, &sock_len ); | 	res = getsockopt( My_Connections[idx].sock, SOL_SOCKET, SO_ERROR, &err, &sock_len ); | ||||||
| 	assert( sock_len == sizeof( err )); | 	assert( sock_len == sizeof( err )); | ||||||
|  |  | ||||||
| @@ -485,7 +485,7 @@ set_v6_only(int af, int sock) | |||||||
| 	if (af != AF_INET6) | 	if (af != AF_INET6) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
| 	if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on))) | 	if (setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &on, (socklen_t)sizeof(on))) | ||||||
| 		Log(LOG_ERR, "Could not set IPV6_V6ONLY: %s", strerror(errno)); | 		Log(LOG_ERR, "Could not set IPV6_V6ONLY: %s", strerror(errno)); | ||||||
| #else | #else | ||||||
| 	(void)af; | 	(void)af; | ||||||
| @@ -1518,7 +1518,7 @@ Handle_Buffer(CONN_ID Idx) | |||||||
| 			return 0; | 			return 0; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		len_processed += len; | 		len_processed += (unsigned int)len; | ||||||
| 		if (len <= delta) { | 		if (len <= delta) { | ||||||
| 			/* Request is empty (only '\r\n', '\r' or '\n'); | 			/* Request is empty (only '\r\n', '\r' or '\n'); | ||||||
| 			 * delta is 2 ('\r\n') or 1 ('\r' or '\n'), see above */ | 			 * delta is 2 ('\r\n') or 1 ('\r' or '\n'), see above */ | ||||||
| @@ -2000,4 +2000,6 @@ Conn_UsesSSL(CONN_ID Idx) | |||||||
| 	return Conn_OPTION_ISSET(&My_Connections[Idx], CONN_SSL); | 	return Conn_OPTION_ISSET(&My_Connections[Idx], CONN_SSL); | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
| /* -eof- */ | /* -eof- */ | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* | /* | ||||||
|  * ngIRCd -- The Next Generation IRC Daemon |  * ngIRCd -- The Next Generation IRC Daemon | ||||||
|  * Copyright (c)2001-2008 by Alexander Barton (alex@barton.de) |  * Copyright (c)2001-2009 by Alexander Barton (alex@barton.de) | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or modify |  * 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 |  * it under the terms of the GNU General Public License as published by | ||||||
| @@ -41,7 +41,7 @@ | |||||||
| #define CONN_SSL_WANT_READ	128	/* SSL/TLS library needs to read protocol data */ | #define CONN_SSL_WANT_READ	128	/* SSL/TLS library needs to read protocol data */ | ||||||
| #define CONN_SSL_FLAGS_ALL	(CONN_SSL_CONNECT|CONN_SSL|CONN_SSL_WANT_WRITE|CONN_SSL_WANT_READ) | #define CONN_SSL_FLAGS_ALL	(CONN_SSL_CONNECT|CONN_SSL|CONN_SSL_WANT_WRITE|CONN_SSL_WANT_READ) | ||||||
| #endif | #endif | ||||||
| typedef int CONN_ID; | typedef long CONN_ID; | ||||||
|  |  | ||||||
| #include "client.h" | #include "client.h" | ||||||
|  |  | ||||||
| @@ -122,4 +122,5 @@ static inline bool Conn_UsesSSL(UNUSED CONN_ID Idx) { return false; } | |||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  |  | ||||||
| /* -eof- */ | /* -eof- */ | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* | /* | ||||||
|  * ngIRCd -- The Next Generation IRC Daemon |  * ngIRCd -- The Next Generation IRC Daemon | ||||||
|  * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de) |  * Copyright (c)2001-2009 Alexander Barton (alex@barton.de) | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or modify |  * 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 |  * it under the terms of the GNU General Public License as published by | ||||||
| @@ -37,8 +37,9 @@ Hash( const char *String ) | |||||||
|  |  | ||||||
| 	char buffer[LINE_LEN]; | 	char buffer[LINE_LEN]; | ||||||
|  |  | ||||||
| 	strlcpy( buffer, String, sizeof( buffer )); | 	strlcpy(buffer, String, sizeof(buffer)); | ||||||
| 	return jenkins_hash( (UINT8 *)ngt_LowerStr( buffer ), strlen( buffer ), 42 ); | 	return jenkins_hash((UINT8 *)ngt_LowerStr(buffer), | ||||||
|  | 			    (UINT32)strlen(buffer), 42); | ||||||
| } /* Hash */ | } /* Hash */ | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* | /* | ||||||
|  * ngIRCd -- The Next Generation IRC Daemon |  * ngIRCd -- The Next Generation IRC Daemon | ||||||
|  * Copyright (c)2001-2008 Alexander Barton (alex@barton.de) |  * Copyright (c)2001-2009 Alexander Barton (alex@barton.de) | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or modify |  * 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 |  * it under the terms of the GNU General Public License as published by | ||||||
| @@ -440,7 +440,7 @@ t_diff(time_t *t, const time_t d) | |||||||
| 	remain = diff * d; | 	remain = diff * d; | ||||||
| 	*t -= remain; | 	*t -= remain; | ||||||
|  |  | ||||||
| 	return diff; | 	return (unsigned int)diff; | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* | /* | ||||||
|  * ngIRCd -- The Next Generation IRC Daemon |  * ngIRCd -- The Next Generation IRC Daemon | ||||||
|  * Copyright (c)2001-2003 by Alexander Barton (alex@barton.de) |  * Copyright (c)2001-2009 by Alexander Barton (alex@barton.de) | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or modify |  * 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 |  * it under the terms of the GNU General Public License as published by | ||||||
| @@ -218,7 +218,7 @@ ReverseLookup(const ng_ipaddr_t *IpAddr, char *resbuf, size_t reslen) | |||||||
| 	*resbuf = 0; | 	*resbuf = 0; | ||||||
|  |  | ||||||
| 	res = getnameinfo((struct sockaddr *) IpAddr, ng_ipaddr_salen(IpAddr), | 	res = getnameinfo((struct sockaddr *) IpAddr, ng_ipaddr_salen(IpAddr), | ||||||
| 				resbuf, reslen, NULL, 0, NI_NAMEREQD); | 			  resbuf, (socklen_t)reslen, NULL, 0, NI_NAMEREQD); | ||||||
| 	if (res == 0) | 	if (res == 0) | ||||||
| 		return true; | 		return true; | ||||||
|  |  | ||||||
| @@ -540,5 +540,6 @@ Resolve_Read( RES_STAT *s, void* readbuf, size_t buflen) | |||||||
| 	Resolve_Shutdown(s); | 	Resolve_Shutdown(s); | ||||||
| 	return (size_t)bytes_read; | 	return (size_t)bytes_read; | ||||||
| } | } | ||||||
| /* -eof- */ |  | ||||||
|  |  | ||||||
|  |  | ||||||
|  | /* -eof- */ | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| /* | /* | ||||||
|  * ngIRCd -- The Next Generation IRC Daemon |  * ngIRCd -- The Next Generation IRC Daemon | ||||||
|  * Copyright (c)2001-2008 Alexander Barton (alex@barton.de) |  * Copyright (c)2001-2009 Alexander Barton (alex@barton.de) | ||||||
|  * |  * | ||||||
|  * This program is free software; you can redistribute it and/or modify |  * 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 |  * it under the terms of the GNU General Public License as published by | ||||||
| @@ -107,16 +107,19 @@ ngt_TrimLastChr( char *String, const char Chr) | |||||||
| 	/* If last character in the string matches Chr, remove it. | 	/* If last character in the string matches Chr, remove it. | ||||||
| 	 * Empty strings are handled correctly. */ | 	 * Empty strings are handled correctly. */ | ||||||
|  |  | ||||||
|         unsigned int len; | 	size_t len; | ||||||
|  |  | ||||||
| 	assert( String != NULL ); | 	assert(String != NULL); | ||||||
|  |  | ||||||
| 	len = strlen( String ); | 	len = strlen(String); | ||||||
| 	if( len == 0 ) return; | 	if(len == 0) | ||||||
|  | 		return; | ||||||
|  |  | ||||||
| 	len--; | 	len--; | ||||||
|  |  | ||||||
| 	if( String[len] == Chr ) String[len] = '\0'; | 	if(String[len] == Chr) | ||||||
|  | 		String[len] = '\0'; | ||||||
| } /* ngt_TrimLastChr */ | } /* ngt_TrimLastChr */ | ||||||
|  |  | ||||||
|  |  | ||||||
| /* -eof- */ | /* -eof- */ | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Alexander Barton
					Alexander Barton