--- json-1.4.3/ext/json/ext/parser/parser.h.debug 2010-09-16 02:59:45.000000000 +0900 +++ json-1.4.3/ext/json/ext/parser/parser.h 2010-09-16 04:49:41.000000000 +0900 @@ -16,6 +16,15 @@ #define option_given_p(opts, key) RTEST(rb_funcall(opts, i_key_p, 1, key)) +/* see ext/generator/generator.h */ +/* Needed for ruby 1.8.5 */ +#ifndef RSTRING_PTR +#define RSTRING_PTR(string) RSTRING(string)->ptr +#endif +#ifndef RSTRING_LEN +#define RSTRING_LEN(string) RSTRING(string)->len +#endif + /* unicode */ typedef unsigned long UTF32; /* at least 32 bits */ --- json-1.4.3/lib/json/add/core.rb.debug 2010-09-16 02:59:45.000000000 +0900 +++ json-1.4.3/lib/json/add/core.rb 2010-09-16 04:54:14.000000000 +0900 @@ -66,6 +66,19 @@ if of_b and of_b != '0' args << Rational(of_a.to_i, of_b.to_i) else + # + # Only hack for ruby 1.8.5 + # Without the fix below, "rake test_ext (or rake test_pure) fails + # for test_utc_datetime(TC_JSONAddition) at tests/test_json_addition.rb:156 + if RUBY_VERSION == "1.8.5" + if of_a.is_a?(String) + of_a = of_a.to_i + end + end + # The above fix is not needed for ruby 1.8.6 and above due to the change + # on civil() in date.rb + # Fix for ruby 1.8.5 end + # args << of_a end args << object['sg']