ruby-changes:6352
From: nobu <ko1@a...>
Date: Fri, 4 Jul 2008 14:19:36 +0900 (JST)
Subject: [ruby-changes:6352] Ruby:r17868 (ruby_1_8, trunk): * lib/net/ftp.rb (Net::FTP#sendport): use divmod.
nobu 2008-07-04 14:17:25 +0900 (Fri, 04 Jul 2008)
New Revision: 17868
Modified files:
branches/ruby_1_8/ChangeLog
branches/ruby_1_8/lib/net/ftp.rb
trunk/ChangeLog
trunk/lib/net/ftp.rb
Log:
* lib/net/ftp.rb (Net::FTP#sendport): use divmod. [ruby-core:17557]
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=17868
Index: ChangeLog
===================================================================
--- ChangeLog (revision 17867)
+++ ChangeLog (revision 17868)
@@ -1,3 +1,7 @@
+Fri Jul 4 14:17:22 2008 Nobuyoshi Nakada <nobu@r...>
+
+ * lib/net/ftp.rb (Net::FTP#sendport): use divmod. [ruby-core:17557]
+
Fri Jul 4 11:08:37 2008 nari <authorNari@g...>
* gc.c (garbage_collect_force): sweep is completely ended.
Index: lib/net/ftp.rb
===================================================================
--- lib/net/ftp.rb (revision 17867)
+++ lib/net/ftp.rb (revision 17868)
@@ -296,12 +296,9 @@
def sendport(host, port)
af = (@sock.peeraddr)[0]
if af == "AF_INET"
- hbytes = host.split(".")
- pbytes = [port / 256, port % 256]
- bytes = hbytes + pbytes
- cmd = "PORT " + bytes.join(",")
+ cmd = "PORT " + (host.split(".") + port.divmod(256)).join(",")
elsif af == "AF_INET6"
- cmd = "EPRT |2|" + host + "|" + sprintf("%d", port) + "|"
+ cmd = sprintf("EPRT |2|%s|%d|", host, port)
else
raise FTPProtoError, host
end
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog (revision 17867)
+++ ruby_1_8/ChangeLog (revision 17868)
@@ -1,3 +1,7 @@
+Fri Jul 4 14:17:22 2008 Nobuyoshi Nakada <nobu@r...>
+
+ * lib/net/ftp.rb (Net::FTP#sendport): use divmod. [ruby-core:17557]
+
Fri Jul 4 05:05:17 2008 NAKAMURA Usaku <usa@r...>
* numeric.c (rb_fix2uint): typo.
Index: ruby_1_8/lib/net/ftp.rb
===================================================================
--- ruby_1_8/lib/net/ftp.rb (revision 17867)
+++ ruby_1_8/lib/net/ftp.rb (revision 17868)
@@ -278,12 +278,9 @@
def sendport(host, port)
af = (@sock.peeraddr)[0]
if af == "AF_INET"
- hbytes = host.split(".")
- pbytes = [port / 256, port % 256]
- bytes = hbytes + pbytes
- cmd = "PORT " + bytes.join(",")
+ cmd = "PORT " + (host.split(".") + port.divmod(256)).join(",")
elsif af == "AF_INET6"
- cmd = "EPRT |2|" + host + "|" + sprintf("%d", port) + "|"
+ cmd = sprintf("EPRT |2|%s|%d|", host, port)
else
raise FTPProtoError, host
end
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/