зеркало из https://github.com/github/ruby.git
transcode.c: do while loop
* transcode.c (rb_econv_substr_append): move loop condition after the conversion. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
a4eae61521
Коммит
a3a7645f19
|
@ -1828,8 +1828,7 @@ rb_econv_substr_append(rb_econv_t *ec, VALUE src, long off, long len, VALUE dst,
|
|||
else
|
||||
max_output = 1;
|
||||
|
||||
res = econv_destination_buffer_full;
|
||||
while (res == econv_destination_buffer_full) {
|
||||
do {
|
||||
long dlen = RSTRING_LEN(dst);
|
||||
if (rb_str_capacity(dst) - dlen < (size_t)len + max_output) {
|
||||
unsigned long new_capa = (unsigned long)dlen + len + max_output;
|
||||
|
@ -1848,7 +1847,7 @@ rb_econv_substr_append(rb_econv_t *ec, VALUE src, long off, long len, VALUE dst,
|
|||
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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче