Bug #11912
closed[WIP] resolv: attempt to fix Resolv::LOC::Coord.create
Description
This seems to have never worked in the first place:
- "$1 < 180" where $1 is a string raises ArgumentError
- regexps in the assignment for "hemi" reset $1 and clobber $2, $3, $4
- orientation is a frozen string literal which we append to
- "$4[[/NS/],1]" has extra braces
I'm not sure if I'm fixing this properly, extra eyes appreciated.
Files
Updated by znz (Kazuhiro NISHIYAMA) over 10 years ago
Updated by normalperson (Eric Wong) over 10 years ago
zn@mbf.nifty.com wrote:
()is required, or use0instead of1.
Thanks, we can omit the second arg entirely.
Will squash the following changes in on top of my previous:
diff --git a/lib/resolv.rb b/lib/resolv.rb
index f598779..3b3f710 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -2701,10 +2701,10 @@ def self.create(arg)
coordinates = ''
if Regex =~ arg && $1.to_f < 180
m = $~
coordinates = [ ((m[1].to_i*(36e5)) + (m[2].to_i*(6e4)) +
(m[3].to_f*(1e3))) * hemi+(2**31) ].pack("N")
else
raise ArgumentError.new("not a properly formed Coord string: " + arg)
end
I guess the square brackets in the orientation assignment were
misplaced. I don't go outside much, but I don't think the
"NS" denotes a valid direction :x
Full diff here:
http://80x24.org/spew/20151231192303.26488-1-e@80x24.org/raw
Unsubscribe: mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe
http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core
Updated by akr (Akira Tanaka) almost 10 years ago
- Status changed from Open to Closed
Applied in changeset r56604.
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.