Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ohler55 committed Jul 25, 2023
1 parent 0c27fa1 commit 980aa83
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
1 change: 0 additions & 1 deletion ext/oj/mimic_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,6 @@ static VALUE mimic_parse_core(int argc, VALUE *argv, VALUE self, bool bang) {
if (T_HASH != rb_type(ropts)) {
rb_raise(rb_eArgError, "options must be a hash.");
}

rb_hash_foreach(ropts, parse_options_cb, (VALUE)&pi);
v = rb_hash_lookup(ropts, oj_max_nesting_sym);
if (Qtrue == v) {
Expand Down
4 changes: 3 additions & 1 deletion ext/oj/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ static void read_num(ParseInfo pi) {
struct _numInfo ni;
Val parent = stack_peek(&pi->stack);

ni.pi = pi;
ni.str = pi->cur;
ni.i = 0;
ni.num = 0;
Expand Down Expand Up @@ -874,7 +875,8 @@ oj_num_as_value(NumInfo ni) {
double d = strtod(ni->str, &end);

if ((long)ni->len != (long)(end - ni->str)) {
rb_raise(oj_parse_error_class, "Invalid float");
rb_raise(ni->pi->err_class, "Invalid float");
//rb_raise(oj_parse_error_class, "Invalid float");
}
rnum = rb_float_new(d);
}
Expand Down
30 changes: 16 additions & 14 deletions ext/oj/parse.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,24 @@
#include "val_stack.h"

struct _rxClass;
struct _parseInfo;

typedef struct _numInfo {
int64_t i;
int64_t num;
int64_t div;
int64_t di;
const char *str;
size_t len;
long exp;
int big;
int infinity;
int nan;
int neg;
int has_exp;
int no_big;
int bigdec_load;
int64_t i;
int64_t num;
int64_t div;
int64_t di;
const char *str;
size_t len;
long exp;
struct _parseInfo *pi;
int big;
int infinity;
int nan;
int neg;
int has_exp;
int no_big;
int bigdec_load;
} *NumInfo;

typedef struct _parseInfo {
Expand Down

0 comments on commit 980aa83

Please sign in to comment.