зеркало из https://github.com/github/ruby.git
cstr.c: nil iff terminated validly
* ext/-test-/string/cstr.c (bug_str_cstr_term_char): return nil only when terminated validly. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49414 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
45e23ec16e
Коммит
7e091d24ce
|
@ -36,8 +36,9 @@ bug_str_cstr_term_char(VALUE str)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
c = rb_enc_mbc_to_codepoint(s, s + len, enc);
|
c = rb_enc_mbc_to_codepoint(s, s + len, enc);
|
||||||
|
if (!c) return Qnil;
|
||||||
}
|
}
|
||||||
return c ? rb_enc_uint_chr((unsigned int)c, enc) : Qnil;
|
return rb_enc_uint_chr((unsigned int)c, enc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
|
Загрузка…
Ссылка в новой задаче