Cleanup: cast socket to long before logging it.
authorKp <kp@valhallalegends.com>
Sun, 7 Dec 2008 21:46:47 +0000 (15:46 -0600)
committerKp <kp@valhallalegends.com>
Sat, 13 Dec 2008 19:57:37 +0000 (13:57 -0600)
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.

lib/silcutil/silcsocketstream.c

index af8f2c34cba0b60f6584b07dd57b10931fe115ab..95b969d9ab9388b93309f36e1630b6ef659bf620 100644 (file)
@@ -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;