[前][次][番号順一覧][スレッド一覧]

ruby-changes:9327

From: nahi <ko1@a...>
Date: Fri, 19 Dec 2008 00:00:47 +0900 (JST)
Subject: [ruby-changes:9327] Ruby:r20864 (ruby_1_8): * test warning cleanups.

nahi	2008-12-19 00:00:23 +0900 (Fri, 19 Dec 2008)

  New Revision: 20864

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20864

  Log:
            * test warning cleanups.
            * lib/webrick/https.rb, lib/soap/attachment.rb, test/xsd/test_xsd.rb:
              uninitialized instance variables.
    
            * lib/xsd/datatypes.rb: use Date#new! instead of Date#new0 according
              to deprecation message.
    
            * lib/webrick/httpservlet/cgihandler.rb,
              lib/xsd/codegen/gensupport.rb, lib/soap/property.rb,
              lib/soap/mimemessage.rb, test/webrick/test_cgi.rb: use
              String#each_line and String#lines.to_a instead of String#each
              according to deprecation message.

  Modified files:
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/lib/soap/attachment.rb
    branches/ruby_1_8/lib/soap/mimemessage.rb
    branches/ruby_1_8/lib/soap/property.rb
    branches/ruby_1_8/lib/webrick/https.rb
    branches/ruby_1_8/lib/webrick/httpservlet/cgihandler.rb
    branches/ruby_1_8/lib/xsd/codegen/gensupport.rb
    branches/ruby_1_8/lib/xsd/datatypes.rb
    branches/ruby_1_8/test/webrick/test_cgi.rb
    branches/ruby_1_8/test/xsd/test_xsd.rb

Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 20863)
+++ ruby_1_8/ChangeLog	(revision 20864)
@@ -1,3 +1,19 @@
+Thu Dec 18 23:53:50 2008  NAKAMURA, Hiroshi  <nahi@r...>
+
+	* test warning cleanups.
+
+	* lib/webrick/https.rb, lib/soap/attachment.rb, test/xsd/test_xsd.rb:
+	  uninitialized instance variables.
+
+	* lib/xsd/datatypes.rb: use Date#new! instead of Date#new0 according
+	  to deprecation message.
+
+	* lib/webrick/httpservlet/cgihandler.rb,
+	  lib/xsd/codegen/gensupport.rb, lib/soap/property.rb,
+	  lib/soap/mimemessage.rb, test/webrick/test_cgi.rb: use
+	  String#each_line and String#lines.to_a instead of String#each
+	  according to deprecation message.
+
 Thu Dec 18 08:20:51 2008  James Edward Gray II  <jeg2@r...>
 
 	Merged 20854 from trunk.
Index: ruby_1_8/lib/webrick/httpservlet/cgihandler.rb
===================================================================
--- ruby_1_8/lib/webrick/httpservlet/cgihandler.rb	(revision 20863)
+++ ruby_1_8/lib/webrick/httpservlet/cgihandler.rb	(revision 20864)
@@ -80,7 +80,7 @@
           "Premature end of script headers: #{@script_filename}" if body.nil?
 
         begin
-          header = HTTPUtils::parse_header(raw_header)
+          header = HTTPUtils::parse_header(raw_header.lines.to_a)
           if /^(\d+)/ =~ header['status'][0]
             res.status = $1.to_i
             header.delete('status')
Index: ruby_1_8/lib/webrick/https.rb
===================================================================
--- ruby_1_8/lib/webrick/https.rb	(revision 20863)
+++ ruby_1_8/lib/webrick/https.rb	(revision 20864)
@@ -21,6 +21,7 @@
     alias orig_parse parse
 
     def parse(socket=nil)
+      @cipher = @server_cert = @client_cert = nil
       if socket.respond_to?(:cert)
         @server_cert = socket.cert || @config[:SSLCertificate]
         @client_cert = socket.peer_cert
Index: ruby_1_8/lib/xsd/datatypes.rb
===================================================================
--- ruby_1_8/lib/xsd/datatypes.rb	(revision 20863)
+++ ruby_1_8/lib/xsd/datatypes.rb	(revision 20864)
@@ -524,7 +524,7 @@
   end
 
   def to_date
-    Date.new0(@data.class.jd_to_ajd(@data.jd, 0, 0), 0, @data.start)
+    Date.new!(@data.class.jd_to_ajd(@data.jd, 0, 0), 0, @data.start)
   end
 
   def to_datetime
@@ -573,7 +573,7 @@
       fr = DateTime.time_to_day_fraction(t.hour, t.min, [t.sec, 59].min) +
         t.usec.to_r / 1000000 / SecInDay
       of = t.utc_offset.to_r / SecInDay
-      DateTime.new0(DateTime.jd_to_ajd(jd, fr, of), of, DateTime::ITALY)
+      DateTime.new!(DateTime.jd_to_ajd(jd, fr, of), of, DateTime::ITALY)
     else
       screen_data_str(t)
     end
Index: ruby_1_8/lib/xsd/codegen/gensupport.rb
===================================================================
--- ruby_1_8/lib/xsd/codegen/gensupport.rb	(revision 20863)
+++ ruby_1_8/lib/xsd/codegen/gensupport.rb	(revision 20864)
@@ -129,22 +129,22 @@
 private
 
   def trim_eol(str)
-    str.collect { |line|
+    str.lines.collect { |line|
       line.sub(/\r?\n\z/, "") + "\n"
     }.join
   end
 
   def trim_indent(str)
     indent = nil
-    str = str.collect { |line| untab(line) }.join
-    str.each do |line|
+    str = str.lines.collect { |line| untab(line) }.join
+    str.each_line do |line|
       head = line.index(/\S/)
       if !head.nil? and (indent.nil? or head < indent)
         indent = head
       end
     end
     return str unless indent
-    str.collect { |line|
+    str.lines.collect { |line|
       line.sub(/^ {0,#{indent}}/, "")
     }.join
   end
Index: ruby_1_8/lib/soap/property.rb
===================================================================
--- ruby_1_8/lib/soap/property.rb	(revision 20863)
+++ ruby_1_8/lib/soap/property.rb	(revision 20864)
@@ -70,7 +70,7 @@
   LINE_REGEXP = Regexp.new("^#{DEF_REGSRC}$")
   def load(stream)
     key_prefix = ""
-    stream.each_with_index do |line, lineno|
+    stream.lines.each_with_index do |line, lineno|
       line.sub!(/\r?\n\z/, '')
       case line
       when COMMENT_REGEXP
Index: ruby_1_8/lib/soap/attachment.rb
===================================================================
--- ruby_1_8/lib/soap/attachment.rb	(revision 20863)
+++ ruby_1_8/lib/soap/attachment.rb	(revision 20864)
@@ -37,6 +37,7 @@
     @string_or_readable = string_or_readable
     @contenttype = "application/octet-stream"
     @contentid = nil
+    @content = nil
   end
 
   def contentid
Index: ruby_1_8/lib/soap/mimemessage.rb
===================================================================
--- ruby_1_8/lib/soap/mimemessage.rb	(revision 20863)
+++ ruby_1_8/lib/soap/mimemessage.rb	(revision 20864)
@@ -49,7 +49,7 @@
 
     def parse(str)
       header_cache = nil
-      str.each do |line|
+      str.each_line do |line|
 	case line
 	when /^\A[^\: \t]+:\s*.+$/
 	  parse_line(header_cache) if header_cache
@@ -148,6 +148,7 @@
   def initialize
     @parts = []
     @headers = Headers.new
+    @boundary = nil
     @root = nil
   end
 
Index: ruby_1_8/test/webrick/test_cgi.rb
===================================================================
--- ruby_1_8/test/webrick/test_cgi.rb	(revision 20863)
+++ ruby_1_8/test/webrick/test_cgi.rb	(revision 20864)
@@ -46,7 +46,7 @@
         assert_equal("a=1, a=2, b=x", res.body)}
       req = Net::HTTP::Get.new("/")
       http.request(req){|res|
-        ary = res.body.to_a
+        ary = res.body.lines.to_a
         assert_match(%r{/$}, ary[0])
         assert_match(%r{/webrick.cgi$}, ary[1])
       }
Index: ruby_1_8/test/xsd/test_xsd.rb
===================================================================
--- ruby_1_8/test/xsd/test_xsd.rb	(revision 20863)
+++ ruby_1_8/test/xsd/test_xsd.rb	(revision 20864)
@@ -67,7 +67,7 @@
   end
 
   def test_XSDString_NONE
-    XSD::Charset.module_eval { @encoding_backup = @encoding; @encoding = "NONE" }
+    XSD::Charset.module_eval { @encoding_backup = @internal_encoding; @internal_encoding = "NONE" }
     begin
       o = XSD::XSDString.new
       assert_equal(XSD::Namespace, o.type.namespace)
@@ -85,7 +85,7 @@
 	p XSD::XSDString.new("\xC0\xC0").to_s
       end
     ensure
-      XSD::Charset.module_eval { @encoding = @encoding_backup }
+      XSD::Charset.module_eval { @internal_encoding = @encoding_backup }
     end
   end
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]