mtodd-geoip 0.5.3 → 0.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/geoip.c +1 -1
  3. data/test.rb +6 -0
  4. metadata +1 -1
data/Rakefile CHANGED
@@ -22,7 +22,7 @@ end
22
22
 
23
23
  spec = Gem::Specification.new do |s|
24
24
  s.name = 'geoip'
25
- s.version = "0.5.3"
25
+ s.version = "0.5.4"
26
26
 
27
27
  s.authors = ['Ryah Dahl', 'Matt Todd', 'Charles Brian Quinn']
28
28
  s.email = 'mtodd@highgroove.com'
data/geoip.c CHANGED
@@ -178,7 +178,7 @@ VALUE rb_geoip_org_look_up(VALUE self, VALUE addr) {
178
178
  */
179
179
  VALUE rb_geoip_addr_to_num(VALUE self, VALUE addr) {
180
180
  Check_Type(addr, T_STRING);
181
- return INT2NUM(_GeoIP_addr_to_num(STR2CSTR(addr)));
181
+ return UINT2NUM((unsigned long)_GeoIP_addr_to_num(STR2CSTR(addr)));
182
182
  }
183
183
 
184
184
  void Init_geoip()
data/test.rb CHANGED
@@ -22,6 +22,12 @@ class GeoIPTest < Test::Unit::TestCase
22
22
  assert_equal ipnum, GeoIP.addr_to_num(ip)
23
23
  end
24
24
 
25
+ def test_addr_to_num_converts_large_ips_to_an_ipnum_correctly
26
+ ip = "245.245.245.245"
27
+ ipnum = 16777216*245 + 65536*245 + 256*245 + 245
28
+ assert_equal ipnum, GeoIP.addr_to_num(ip)
29
+ end
30
+
25
31
  def test_addr_to_num_expects_an_ip_string
26
32
  assert_raises TypeError do
27
33
  GeoIP.addr_to_num(nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtodd-geoip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Dahl