Skip to content

Commit

Permalink
Merge branch 'fix-generic-hash-parse' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
ohler55 committed Apr 7, 2023
2 parents 5dd6f03 + 0e590dc commit 896d8f2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 3.14.3 - 2023-04-06

- Fixed compat parse with optimized Hash when parsing a JSON::GenericObject.

## 3.14.2 - 2023-02-10

- Fixed check for \0 in strings.
Expand Down
2 changes: 1 addition & 1 deletion ext/oj/compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static void add_num(ParseInfo pi, NumInfo ni) {
static void hash_set_num(struct _parseInfo *pi, Val parent, NumInfo ni) {
volatile VALUE rval = oj_num_as_value(ni);

if (!oj_use_hash_alt && rb_cHash != rb_obj_class(parent->val)) {
if (rb_cHash != rb_obj_class(parent->val)) {
// The rb_hash_set would still work but the unit tests for the
// json gem require the less efficient []= method be called to set
// values. Even using the store method to set the values will fail
Expand Down
2 changes: 1 addition & 1 deletion ext/oj/dump_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static void dump_array(VALUE a, int depth, Out out, bool as_ok) {
raise_json_err("Too deeply nested", "NestingError");
return;
}
if (as_ok && !oj_use_hash_alt && rb_obj_class(a) != rb_cArray && rb_respond_to(a, oj_to_json_id)) {
if (as_ok && !oj_use_array_alt && rb_obj_class(a) != rb_cArray && rb_respond_to(a, oj_to_json_id)) {
dump_to_json(a, out);
return;
}
Expand Down
7 changes: 3 additions & 4 deletions ext/oj/mimic_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -349,12 +349,11 @@ static VALUE mimic_load(int argc, VALUE *argv, VALUE self) {
static VALUE mimic_dump_load(int argc, VALUE *argv, VALUE self) {
if (1 > argc) {
rb_raise(rb_eArgError, "wrong number of arguments (0 for 1)");
} else if (T_STRING == rb_type(*argv)) {
}
if (T_STRING == rb_type(*argv)) {
return mimic_load(argc, argv, self);
} else {
return mimic_dump(argc, argv, self);
}
return Qnil;
return mimic_dump(argc, argv, self);
}

static VALUE mimic_generate_core(int argc, VALUE *argv, Options copts) {
Expand Down

0 comments on commit 896d8f2

Please sign in to comment.