Compilation fix OSX

Pedantic warning CLang for 64bits compiler.
This commit is contained in:
Bruno Herbelin
2023-08-12 16:01:12 +02:00
parent 793008852a
commit 3cde191afb
7 changed files with 16 additions and 12 deletions

View File

@@ -49,10 +49,10 @@ unsigned long IpEndpointName::GetHostByName( const char *s )
void IpEndpointName::AddressAsString( char *s ) const
{
if( address == ANY_ADDRESS ){
std::sprintf( s, "<any>" );
if( address == ANY_ADDRESS ){
std::snprintf( s, IpEndpointName::ADDRESS_STRING_LENGTH, "<any>" );
}else{
std::sprintf( s, "%d.%d.%d.%d",
std::snprintf( s, IpEndpointName::ADDRESS_STRING_LENGTH, "%d.%d.%d.%d",
(int)((address >> 24) & 0xFF),
(int)((address >> 16) & 0xFF),
(int)((address >> 8) & 0xFF),
@@ -65,9 +65,9 @@ void IpEndpointName::AddressAndPortAsString( char *s ) const
{
if( port == ANY_PORT ){
if( address == ANY_ADDRESS ){
std::sprintf( s, "<any>:<any>" );
std::snprintf( s, IpEndpointName::ADDRESS_AND_PORT_STRING_LENGTH, "<any>:<any>" );
}else{
std::sprintf( s, "%d.%d.%d.%d:<any>",
std::snprintf( s, IpEndpointName::ADDRESS_AND_PORT_STRING_LENGTH, "%d.%d.%d.%d:<any>",
(int)((address >> 24) & 0xFF),
(int)((address >> 16) & 0xFF),
(int)((address >> 8) & 0xFF),
@@ -75,9 +75,9 @@ void IpEndpointName::AddressAndPortAsString( char *s ) const
}
}else{
if( address == ANY_ADDRESS ){
std::sprintf( s, "<any>:%d", port );
std::snprintf( s, IpEndpointName::ADDRESS_AND_PORT_STRING_LENGTH, "<any>:%d", port );
}else{
std::sprintf( s, "%d.%d.%d.%d:%d",
std::snprintf( s, IpEndpointName::ADDRESS_AND_PORT_STRING_LENGTH, "%d.%d.%d.%d:%d",
(int)((address >> 24) & 0xFF),
(int)((address >> 16) & 0xFF),
(int)((address >> 8) & 0xFF),