rubygem-json/json-1.4.3-for-ruby185.patch
Mamoru Tasaka 28293475dc - Patch for EL-5 ruby 1.8.5 specific issue (bug 634380)
- fix missing symbol issue for ruby 1.8.5
  - fix test_utc_datetime failure
- Enable %check
2010-09-16 16:19:57 +09:00

40 lines
1.3 KiB
Diff

--- 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']