From: Kp Date: Sun, 7 Dec 2008 21:46:47 +0000 (-0600) Subject: Cleanup: cast socket to long before logging it. X-Git-Tag: silc.toolkit.1.1.9~6^2~4 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=c38f423e3baa389150c5b31ee95a60e8e2f221f2 Cleanup: cast socket to long before logging it. The SilcSocket type varies in size, depending on the host platform. On Unix systems, it is an int, which is 32-bits on all interesting platforms. On Windows, it is a SOCKET, which is also 32-bits. However, on Symbian, SilcSocket is a void pointer. Changing %lu to %u may not work in all cases due to this size difference, so instead cast the socket to a long unsigned, which should avoid loss of precision on all platforms and still satisfy the %lu format specifier. --- diff --git a/lib/silcutil/silcsocketstream.c b/lib/silcutil/silcsocketstream.c index af8f2c34..95b969d9 100644 --- a/lib/silcutil/silcsocketstream.c +++ b/lib/silcutil/silcsocketstream.c @@ -166,7 +166,7 @@ silc_socket_tcp_stream_create(SilcSocket sock, SilcBool lookup, return NULL; } - SILC_LOG_DEBUG(("Creating TCP socket stream %p, sock %lu", stream, sock)); + SILC_LOG_DEBUG(("Creating TCP socket stream %p, sock %lu", stream, (long unsigned) sock)); stream->ops = &silc_socket_stream_ops; stream->sock = sock;