summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-29 21:35:28 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-10-29 21:35:28 +0000
commita2868ff65166b27acbbda4af1b9df84ed3171541 (patch)
tree08a0b09a8416ab4b1da83d70cd2fb85a72edb188 /ext
parent454abc5185a4a6425f1140d5c0e2157f8d3f75e1 (diff)
* eval.c, file.c, gc.c, io.c, object.c, ruby.c, ruby.h, struct.c,
ext/socket/socket.c: differentiate long and int; use proper printf type specifiers and do casts where appropriate. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/socket.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index 0825e8d..17df447 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -824,13 +824,13 @@ load_addr_info(h, serv, type, res)
host = NULL;
}
if (FIXNUM_P(serv)) {
- snprintf(pbuf, sizeof(pbuf), "%ld", FIX2UINT(serv));
+ snprintf(pbuf, sizeof(pbuf), "%u", FIX2UINT(serv));
portp = pbuf;
}
else {
SafeStringValue(serv);
if (RSTRING(serv)->len >= sizeof(pbuf))
- rb_raise(rb_eArgError, "servicename too long (%d)", RSTRING(serv)->len);
+ rb_raise(rb_eArgError, "servicename too long (%ld)", RSTRING(serv)->len);
strcpy(pbuf, RSTRING(serv)->ptr);
portp = pbuf;
}
@@ -2126,7 +2126,7 @@ sock_s_getaddrinfo(argc, argv)
pptr = NULL;
}
else if (FIXNUM_P(port)) {
- snprintf(pbuf, sizeof(pbuf), "%ld", FIX2INT(port));
+ snprintf(pbuf, sizeof(pbuf), "%d", FIX2INT(port));
pptr = pbuf;
}
else {
@@ -2227,7 +2227,7 @@ sock_s_getnameinfo(argc, argv)
}
}
else {
- rb_raise(rb_eArgError, "array size should be 3 or 4, %d given",
+ rb_raise(rb_eArgError, "array size should be 3 or 4, %ld given",
RARRAY(sa)->len);
}
/* host */
@@ -2245,7 +2245,7 @@ sock_s_getnameinfo(argc, argv)
pptr = NULL;
}
else if (FIXNUM_P(port)) {
- snprintf(pbuf, sizeof(pbuf), "%ld", NUM2INT(port));
+ snprintf(pbuf, sizeof(pbuf), "%d", NUM2INT(port));
pptr = pbuf;
}
else {
@@ -2331,7 +2331,7 @@ sock_s_unpack_sockaddr_in(self, addr)
sockaddr = (struct sockaddr_in*)StringValuePtr(addr);
if (RSTRING(addr)->len != sizeof(struct sockaddr_in)) {
- rb_raise(rb_eTypeError, "sockaddr_in size differs - %d required; %d given",
+ rb_raise(rb_eTypeError, "sockaddr_in size differs - %ld required; %d given",
RSTRING(addr)->len, sizeof(struct sockaddr_in));
}
host = mkipaddr(sockaddr);
@@ -2365,7 +2365,7 @@ sock_s_unpack_sockaddr_un(self, addr)
sockaddr = (struct sockaddr_un*)StringValuePtr(addr);
if (RSTRING(addr)->len != sizeof(struct sockaddr_un)) {
- rb_raise(rb_eTypeError, "sockaddr_un size differs - %d required; %d given",
+ rb_raise(rb_eTypeError, "sockaddr_un size differs - %ld required; %d given",
RSTRING(addr)->len, sizeof(struct sockaddr_un));
}
/* xxx: should I check against sun_path size? */