summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Ryde <user42@zip.com.au>2006-07-23 22:19:41 +0000
committerKevin Ryde <user42@zip.com.au>2006-07-23 22:19:41 +0000
commit7ac90ac289d2a10a0d99f626dab5d10df2d66c8d (patch)
tree46d7999e4378db1efe9ee0db92a4a68e89e4c133
parent0c5365ea3e3cad0fc72a056a4f80f22d8e1659e7 (diff)
downloadguile-7ac90ac289d2a10a0d99f626dab5d10df2d66c8d.tar.gz
(scm_htonl, scm_ntohl): Use scm_to_uint32 rather than
NUM2ULONG, to enforce 32-bit range check on systems with 64-bit long.
-rw-r--r--libguile/socket.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libguile/socket.c b/libguile/socket.c
index a9b7ed8ca..fb2e8c7b7 100644
--- a/libguile/socket.c
+++ b/libguile/socket.c
@@ -98,9 +98,7 @@ SCM_DEFINE (scm_htonl, "htonl", 1, 0, 0,
"and returned as a new integer.")
#define FUNC_NAME s_scm_htonl
{
- scm_t_uint32 c_in = SCM_NUM2ULONG (1, value);
-
- return scm_from_ulong (htonl (c_in));
+ return scm_from_ulong (htonl (scm_to_uint32 (value)));
}
#undef FUNC_NAME
@@ -111,9 +109,7 @@ SCM_DEFINE (scm_ntohl, "ntohl", 1, 0, 0,
"and returned as a new integer.")
#define FUNC_NAME s_scm_ntohl
{
- scm_t_uint32 c_in = SCM_NUM2ULONG (1, value);
-
- return scm_from_ulong (ntohl (c_in));
+ return scm_from_ulong (ntohl (scm_to_uint32 (value)));
}
#undef FUNC_NAME