Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ohler55/oj
Browse files Browse the repository at this point in the history
  • Loading branch information
ohler55 committed Nov 16, 2015
2 parents b0b75cf + 0177cd2 commit 447d2ad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions ext/oj/dump.c
Original file line number Diff line number Diff line change
Expand Up @@ -1786,9 +1786,12 @@ dump_struct_obj(VALUE obj, int depth, Out out) {
size = d3 * out->indent + 2;
#ifdef RSTRUCT_LEN
{
VALUE *vp;
const VALUE *vp;

for (i = (int)RSTRUCT_LEN(obj), vp = RSTRUCT_PTR(obj); 0 < i; i--, vp++) {
#ifndef RSTRUCT_CONST_PTR
# define RSTRUCT_CONST_PTR(st) (const VALUE *)RSTRUCT_PTR(st)
#endif
for (i = (int)RSTRUCT_LEN(obj), vp = RSTRUCT_CONST_PTR(obj); 0 < i; i--, vp++) {
if (out->end - out->cur <= (long)size) {
grow(out, size);
}
Expand Down
2 changes: 1 addition & 1 deletion ext/oj/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ read_num(ParseInfo pi) {
}
// TBD move size check here
ni.i = ni.i * 10 + d;
if (LONG_MAX <= ni.i || DEC_MAX < ni.dec_cnt - zero_cnt) {
if (LONG_MAX <= ni.i || DEC_MAX < ni.dec_cnt) {
ni.big = 1;
}
}
Expand Down
2 changes: 2 additions & 0 deletions test/test_various.rb
Original file line number Diff line number Diff line change
Expand Up @@ -899,8 +899,10 @@ def test_bignum_compat
b = Oj.load(json, :mode => :strict)
assert_equal(30226801971775055948247051683954096612865741943, b)
end

def test_bignum_object
dump_and_load(7 ** 55, false)
dump_and_load(10 ** 19, false)
end

# BigDecimal
Expand Down

0 comments on commit 447d2ad

Please sign in to comment.