summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--include/ruby/encoding.h1
-rw-r--r--transcode.c20
3 files changed, 20 insertions, 6 deletions
@@ -1,3 +1,8 @@
Fri Sep 6 02:37:22 2013 Aaron Patterson <[email protected]>
* ext/psych/lib/psych/visitors/yaml_tree.rb: use double quotes when
@@ -309,6 +309,7 @@ VALUE rb_econv_str_convert(rb_econv_t *ec, VALUE src, int flags);
VALUE rb_econv_substr_convert(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, int flags);
VALUE rb_econv_str_append(rb_econv_t *ec, VALUE src, VALUE dst, int flags);
VALUE rb_econv_substr_append(rb_econv_t *ec, VALUE src, long byteoff, long bytesize, VALUE dst, int flags);
void rb_econv_binmode(rb_econv_t *ec);
@@ -1810,9 +1810,9 @@ rb_econv_asciicompat_encoding(const char *ascii_incompat_name)
}
VALUE
-rb_econv_substr_append(rb_econv_t *ec, VALUE src, long off, long len, VALUE dst, int flags)
{
- unsigned const char *ss, *sp, *se;
unsigned char *ds, *dp, *de;
rb_econv_result_t res;
int max_output;
@@ -1837,18 +1837,26 @@ rb_econv_substr_append(rb_econv_t *ec, VALUE src, long off, long len, VALUE dst,
rb_str_resize(dst, new_capa);
rb_str_set_len(dst, dlen);
}
- ss = sp = (const unsigned char *)RSTRING_PTR(src) + off;
- se = ss + len;
ds = (unsigned char *)RSTRING_PTR(dst);
de = ds + rb_str_capacity(dst);
dp = ds += dlen;
res = rb_econv_convert(ec, &sp, se, &dp, de, flags);
- off += sp - ss;
- len -= sp - ss;
rb_str_set_len(dst, dlen + (dp - ds));
rb_econv_check_error(ec);
} while (res == econv_destination_buffer_full);
RB_GC_GUARD(src);
return dst;
}