Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quick fix to make geohash work on ruby 1.9.3 #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion ext/geohash_native.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
#include "ruby.h"
#include <ctype.h>

#ifndef RUBY_19
#ifndef RFLOAT_VALUE
#define RFLOAT_VALUE(v) (RFLOAT(v)->value)
#endif
#endif


static VALUE rb_cGeoHash;

#define BASE32 "0123456789bcdefghjkmnpqrstuvwxyz"
Expand Down Expand Up @@ -120,7 +127,7 @@ static VALUE encode(VALUE self, VALUE lat, VALUE lon, VALUE precision)
if (digits <3 || digits > 12)
digits = 12;

encode_geohash(RFLOAT(lat)->value, RFLOAT(lon)->value, digits, str);
encode_geohash(RFLOAT_VALUE(lat), RFLOAT_VALUE(lon), digits, str);

geohash = rb_str_new2(str);
return geohash;
Expand Down
2 changes: 1 addition & 1 deletion geohash.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ jruby = !!()

Gem::Specification.new do |s|
s.name = "geohash"
s.version = '1.1.1'
s.version = '1.1.2'
s.date = "2010-09-14"
s.summary = "GeoHash Library for Ruby, per http://geohash.org implementation."
s.email = "[email protected]"
Expand Down