ruby-changes:22356
From: tenderlove <ko1@a...>
Date: Wed, 1 Feb 2012 04:10:28 +0900 (JST)
Subject: [ruby-changes:22356] tenderlove:r34405 (ruby_1_9_3): merging r34364 from trunk to ruby_1_9_3
tenderlove 2012-02-01 04:10:15 +0900 (Wed, 01 Feb 2012) New Revision: 34405 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=34405 Log: merging r34364 from trunk to ruby_1_9_3 -- * lib/uri/common.rb (URI.encode_www_form_component): initialize on requiring to support JRuby, which runs parallel multithreads. [ruby-core:42222] [Bug #5925] * lib/uri/common.rb (URI.decode_www_form_component): initialize on Modified files: branches/ruby_1_9_3/ChangeLog branches/ruby_1_9_3/lib/uri/common.rb branches/ruby_1_9_3/version.h Index: ruby_1_9_3/ChangeLog =================================================================== --- ruby_1_9_3/ChangeLog (revision 34404) +++ ruby_1_9_3/ChangeLog (revision 34405) @@ -1,3 +1,11 @@ +Tue Jan 24 11:38:05 2012 NARUSE, Yui <naruse@r...> + + * lib/uri/common.rb (URI.encode_www_form_component): initialize on + requiring to support JRuby, which runs parallel multithreads. + [ruby-core:42222] [Bug #5925] + + * lib/uri/common.rb (URI.decode_www_form_component): initialize on + Sat Jan 28 05:53:34 2012 Nobuyoshi Nakada <nobu@r...> * lib/irb/completion.rb (IRB::InputCompletor::CompletionProc): Index: ruby_1_9_3/lib/uri/common.rb =================================================================== --- ruby_1_9_3/lib/uri/common.rb (revision 34404) +++ ruby_1_9_3/lib/uri/common.rb (revision 34405) @@ -849,7 +849,22 @@ end TBLENCWWWCOMP_ = {} # :nodoc: + 256.times do |i| + TBLENCWWWCOMP_[i.chr] = '%%%02X' % i + end + TBLENCWWWCOMP_[' '] = '+' + TBLENCWWWCOMP_.freeze TBLDECWWWCOMP_ = {} # :nodoc: + 256.times do |i| + h, l = i>>4, i&15 + TBLDECWWWCOMP_['%%%X%X' % [h, l]] = i.chr + TBLDECWWWCOMP_['%%%x%X' % [h, l]] = i.chr + TBLDECWWWCOMP_['%%%X%x' % [h, l]] = i.chr + TBLDECWWWCOMP_['%%%x%x' % [h, l]] = i.chr + end + TBLDECWWWCOMP_['+'] = ' ' + TBLDECWWWCOMP_.freeze + HTML5ASCIIINCOMPAT = [Encoding::UTF_7, Encoding::UTF_16BE, Encoding::UTF_16LE, Encoding::UTF_32BE, Encoding::UTF_32LE] # :nodoc: @@ -863,18 +878,6 @@ # # See URI.decode_www_form_component, URI.encode_www_form def self.encode_www_form_component(str) - if TBLENCWWWCOMP_.empty? - tbl = {} - 256.times do |i| - tbl[i.chr] = '%%%02X' % i - end - tbl[' '] = '+' - begin - TBLENCWWWCOMP_.replace(tbl) - TBLENCWWWCOMP_.freeze - rescue - end - end str = str.to_s if HTML5ASCIIINCOMPAT.include?(str.encoding) str = str.encode(Encoding::UTF_8) @@ -892,22 +895,6 @@ # # See URI.encode_www_form_component, URI.decode_www_form def self.decode_www_form_component(str, enc=Encoding::UTF_8) - if TBLDECWWWCOMP_.empty? - tbl = {} - 256.times do |i| - h, l = i>>4, i&15 - tbl['%%%X%X' % [h, l]] = i.chr - tbl['%%%x%X' % [h, l]] = i.chr - tbl['%%%X%x' % [h, l]] = i.chr - tbl['%%%x%x' % [h, l]] = i.chr - end - tbl['+'] = ' ' - begin - TBLDECWWWCOMP_.replace(tbl) - TBLDECWWWCOMP_.freeze - rescue - end - end raise ArgumentError, "invalid %-encoding (#{str})" unless /\A[^%]*(?:%\h\h[^%]*)*\z/ =~ str str.gsub(/\+|%\h\h/, TBLDECWWWCOMP_).force_encoding(enc) end Index: ruby_1_9_3/version.h =================================================================== --- ruby_1_9_3/version.h (revision 34404) +++ ruby_1_9_3/version.h (revision 34405) @@ -1,5 +1,5 @@ #define RUBY_VERSION "1.9.3" -#define RUBY_PATCHLEVEL 28 +#define RUBY_PATCHLEVEL 29 #define RUBY_RELEASE_DATE "2012-01-28" #define RUBY_RELEASE_YEAR 2012 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/