fix Resolv::LOC::Coord.create.
* lib/resolv.rb (Resolv::LOC::Coord.create): fixed. [ruby-core:72567] [Bug #11912] fixed by Eric Wong and Kazuhiro NISHIYAMA. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56604 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
825e191296
commit
7d27c0a2d8
@ -1,3 +1,9 @@
|
||||
Sun Nov 6 00:06:38 2016 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/resolv.rb (Resolv::LOC::Coord.create): fixed.
|
||||
[ruby-core:72567] [Bug #11912] fixed by Eric Wong and Kazuhiro
|
||||
NISHIYAMA.
|
||||
|
||||
Sun Nov 6 00:03:09 2016 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* configure.in (-Wimplicit-fallthrough): gcc7 introduces case
|
||||
|
@ -2699,10 +2699,12 @@ class Resolv
|
||||
return arg
|
||||
when String
|
||||
coordinates = ''
|
||||
if Regex =~ arg && $1<180
|
||||
hemi = ($4[/([NE])/,1]) || ($4[/([SW])/,1]) ? 1 : -1
|
||||
coordinates = [(($1.to_i*(36e5))+($2.to_i*(6e4))+($3.to_f*(1e3)))*hemi+(2**31)].pack("N")
|
||||
(orientation ||= '') << $4[[/NS/],1] ? 'lat' : 'lon'
|
||||
if Regex =~ arg && $1.to_f < 180
|
||||
m = $~
|
||||
hemi = (m[4][/[NE]/]) || (m[4][/[SW]/]) ? 1 : -1
|
||||
coordinates = [ ((m[1].to_i*(36e5)) + (m[2].to_i*(6e4)) +
|
||||
(m[3].to_f*(1e3))) * hemi+(2**31) ].pack("N")
|
||||
orientation = m[4][/[NS]/] ? 'lat' : 'lon'
|
||||
else
|
||||
raise ArgumentError.new("not a properly formed Coord string: " + arg)
|
||||
end
|
||||
|
@ -19,4 +19,8 @@ class TestResolvResource < Test::Unit::TestCase
|
||||
bug10857 = '[ruby-core:68128] [Bug #10857]'
|
||||
assert_equal(@name1.hash, @name2.hash, bug10857)
|
||||
end
|
||||
|
||||
def test_coord
|
||||
Resolv::LOC::Coord.create('1 2 1.1 N')
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user