[DRE-commits] [ruby-oj] 01/01: upstream fix for 32bit arches
Cédric Boutillier
boutil at moszumanska.debian.org
Tue May 5 14:28:21 UTC 2015
This is an automated email from the git hooks/post-receive script.
boutil pushed a commit to branch master
in repository ruby-oj.
commit 2504c2aa915e629fea9872e5095cc6856042c8d4
Author: Cédric Boutillier <boutil at debian.org>
Date: Tue May 5 16:20:00 2015 +0200
upstream fix for 32bit arches
---
debian/changelog | 7 +++
debian/patches/90_32bit_fix.patch | 126 ++++++++++++++++++++++++++++++++++++++
debian/patches/series | 1 +
3 files changed, 134 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 03ec82c..345ad54 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ruby-oj (2.12.5-2) unstable; urgency=medium
+
+ * Apply upstream patch 90_32bit_fix.patch for 32 bit architectures
+ + solves a test failure for those architectures because of a wrong type.
+
+ -- Cédric Boutillier <boutil at debian.org> Tue, 05 May 2015 16:18:03 +0200
+
ruby-oj (2.12.5-1) unstable; urgency=medium
* Imported Upstream version 2.12.5
diff --git a/debian/patches/90_32bit_fix.patch b/debian/patches/90_32bit_fix.patch
new file mode 100644
index 0000000..0eb9a45
--- /dev/null
+++ b/debian/patches/90_32bit_fix.patch
@@ -0,0 +1,126 @@
+Description: attempting 32 bit fix
+ solving test failures on non 64bit machines
+Bug: https://github.com/ohler55/oj/issues/233
+Author: Peter Ohler <ohler at mac.com>
+Origin: upstream
+Reviewed-by: Cédric Boutillier <boutil at debian.org>
+Last-Update: 2015-05-04
+
+--- a/ext/oj/dump.c
++++ b/ext/oj/dump.c
+@@ -399,7 +399,7 @@
+ dump_fixnum(VALUE obj, Out out) {
+ char buf[32];
+ char *b = buf + sizeof(buf) - 1;
+- long num = NUM2LONG(obj);
++ long long num = rb_num2ll(obj);
+ int neg = 0;
+
+ if (0 > num) {
+@@ -1031,9 +1031,9 @@
+ #else
+ time_t sec = NUM2LONG(rb_funcall2(obj, oj_tv_sec_id, 0, 0));
+ #if HAS_NANO_TIME
+- long nsec = NUM2LONG(rb_funcall2(obj, oj_tv_nsec_id, 0, 0));
++ long long nsec = rb_num2ll((rb_funcall2(obj, oj_tv_nsec_id, 0, 0));
+ #else
+- long nsec = NUM2LONG(rb_funcall2(obj, oj_tv_usec_id, 0, 0)) * 1000;
++ long long nsec = rb_num2ll(rb_funcall2(obj, oj_tv_usec_id, 0, 0)) * 1000;
+ #endif
+ #endif
+
+@@ -1127,9 +1127,9 @@
+ #else
+ time_t sec = NUM2LONG(rb_funcall2(obj, oj_tv_sec_id, 0, 0));
+ #if HAS_NANO_TIME
+- long nsec = NUM2LONG(rb_funcall2(obj, oj_tv_nsec_id, 0, 0));
++ long long nsec = rb_num2ll(rb_funcall2(obj, oj_tv_nsec_id, 0, 0));
+ #else
+- long nsec = NUM2LONG(rb_funcall2(obj, oj_tv_usec_id, 0, 0)) * 1000;
++ long long nsec = rb_num2ll(rb_funcall2(obj, oj_tv_usec_id, 0, 0)) * 1000;
+ #endif
+ #endif
+ long tzsecs = NUM2LONG(rb_funcall2(obj, oj_utc_offset_id, 0, 0));
+--- a/ext/oj/fast.c
++++ b/ext/oj/fast.c
+@@ -345,7 +345,7 @@
+ if (neg) {
+ n = -n;
+ }
+- leaf->value = LONG2NUM(n);
++ leaf->value = rb_ll2inum(n);
+ }
+ leaf->value_type = RUBY_VAL;
+ }
+--- a/ext/oj/object.c
++++ b/ext/oj/object.c
+@@ -180,7 +180,7 @@
+ char c = *str++;
+
+ if ('.' == c) {
+- long nsec = 0;
++ long long nsec = 0;
+
+ for (; str < end; str++) {
+ c = *str;
+@@ -192,7 +192,7 @@
+ }
+ args[5] = rb_float_new((double)n + ((double)nsec + 0.5) / 1000000000.0);
+ } else {
+- args[5] = LONG2NUM(n);
++ args[5] = rb_ll2inum(n);
+ }
+ if (end < str) {
+ args[6] = LONG2NUM(0);
+--- a/ext/oj/odd.c
++++ b/ext/oj/odd.c
+@@ -64,15 +64,15 @@
+ VALUE rsecs = rb_funcall(obj, sec_id, 0);
+ VALUE rfrac = rb_funcall(obj, sec_fraction_id, 0);
+ long sec = NUM2LONG(rsecs);
+- long num = NUM2LONG(rb_funcall(rfrac, numerator_id, 0));
+- long den = NUM2LONG(rb_funcall(rfrac, denominator_id, 0));
++ long long num = rb_num2ll(rb_funcall(rfrac, numerator_id, 0));
++ long long den = rb_num2ll(rb_funcall(rfrac, denominator_id, 0));
+
+ #if DATETIME_1_8
+- num *= 86400;
++ num *= 86400;
+ #endif
+ num += sec * den;
+
+- return rb_funcall(rb_cObject, rational_id, 2, LONG2FIX(num), LONG2FIX(den));
++ return rb_funcall(rb_cObject, rational_id, 2, rb_ll2inum(num), rb_ll2inum(den));
+ }
+
+ void
+--- a/ext/oj/parse.c
++++ b/ext/oj/parse.c
+@@ -438,6 +438,7 @@
+ } else {
+ zero_cnt = 0;
+ }
++ // TBD move size check here
+ ni.i = ni.i * 10 + d;
+ if (LONG_MAX <= ni.i || DEC_MAX < ni.dec_cnt - zero_cnt) {
+ ni.big = 1;
+@@ -455,6 +456,7 @@
+ zero_cnt = 0;
+ }
+ ni.dec_cnt++;
++ // TBD move size check here
+ ni.num = ni.num * 10 + d;
+ ni.div *= 10;
+ if (LONG_MAX <= ni.div || DEC_MAX < ni.dec_cnt - zero_cnt) {
+@@ -702,9 +704,9 @@
+ }
+ } else {
+ if (ni->neg) {
+- rnum = LONG2NUM(-ni->i);
++ rnum = rb_ll2inum(-ni->i);
+ } else {
+- rnum = LONG2NUM(ni->i);
++ rnum = rb_ll2inum(ni->i);
+ }
+ }
+ } else { // decimal
diff --git a/debian/patches/series b/debian/patches/series
index 50c2cb6..c2d30f0 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
01_dont_mess_with_loadpath.patch
02_avoid_name_conflict_with_ext.patch
03_find_test_helper.patch
+90_32bit_fix.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/ruby-oj.git
More information about the Pkg-ruby-extras-commits
mailing list