diff options
-rw-r--r-- | ext/json/ext/generator/generator.c | 10 | ||||
-rw-r--r-- | java/src/json/ext/GeneratorState.java | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/ext/json/ext/generator/generator.c b/ext/json/ext/generator/generator.c index ad7dfe3..2c7fa61 100644 --- a/ext/json/ext/generator/generator.c +++ b/ext/json/ext/generator/generator.c @@ -522,7 +522,7 @@ static VALUE cState_configure(VALUE self, VALUE opts) unsigned long len; Check_Type(tmp, T_STRING); len = RSTRING_LEN(tmp); - state->indent = fstrndup(RSTRING_PTR(tmp), len); + state->indent = fstrndup(RSTRING_PTR(tmp), len + 1); state->indent_len = len; } tmp = rb_hash_aref(opts, ID2SYM(i_space)); @@ -530,7 +530,7 @@ static VALUE cState_configure(VALUE self, VALUE opts) unsigned long len; Check_Type(tmp, T_STRING); len = RSTRING_LEN(tmp); - state->space = fstrndup(RSTRING_PTR(tmp), len); + state->space = fstrndup(RSTRING_PTR(tmp), len + 1); state->space_len = len; } tmp = rb_hash_aref(opts, ID2SYM(i_space_before)); @@ -538,7 +538,7 @@ static VALUE cState_configure(VALUE self, VALUE opts) unsigned long len; Check_Type(tmp, T_STRING); len = RSTRING_LEN(tmp); - state->space_before = fstrndup(RSTRING_PTR(tmp), len); + state->space_before = fstrndup(RSTRING_PTR(tmp), len + 1); state->space_before_len = len; } tmp = rb_hash_aref(opts, ID2SYM(i_array_nl)); @@ -546,7 +546,7 @@ static VALUE cState_configure(VALUE self, VALUE opts) unsigned long len; Check_Type(tmp, T_STRING); len = RSTRING_LEN(tmp); - state->array_nl = fstrndup(RSTRING_PTR(tmp), len); + state->array_nl = fstrndup(RSTRING_PTR(tmp), len + 1); state->array_nl_len = len; } tmp = rb_hash_aref(opts, ID2SYM(i_object_nl)); @@ -554,7 +554,7 @@ static VALUE cState_configure(VALUE self, VALUE opts) unsigned long len; Check_Type(tmp, T_STRING); len = RSTRING_LEN(tmp); - state->object_nl = fstrndup(RSTRING_PTR(tmp), len); + state->object_nl = fstrndup(RSTRING_PTR(tmp), len + 1); state->object_nl_len = len; } tmp = ID2SYM(i_max_nesting); diff --git a/java/src/json/ext/GeneratorState.java b/java/src/json/ext/GeneratorState.java index 14d5431..58904ee 100644 --- a/java/src/json/ext/GeneratorState.java +++ b/java/src/json/ext/GeneratorState.java @@ -445,7 +445,7 @@ public class GeneratorState extends RubyObject { * @param vOpts The options hash * @return The receiver */ - @JRubyMethod + @JRubyMethod(alias = "merge") public IRubyObject configure(ThreadContext context, IRubyObject vOpts) { OptionsReader opts = new OptionsReader(context, vOpts); |