зеркало из https://github.com/github/ruby.git
* string.c (rb_str_buf_cat_ascii): codepoint is unsigned int.
* string.c (rb_str_concat): ditto. * string.c (str_cat_char): ditto. * string.c (prefix_escape): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
9e10d51c40
Коммит
b0c70a8856
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
Tue Sep 16 02:02:56 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* string.c (rb_str_buf_cat_ascii): codepoint is unsigned int.
|
||||
|
||||
* string.c (rb_str_concat): ditto.
|
||||
|
||||
* string.c (str_cat_char): ditto.
|
||||
|
||||
* string.c (prefix_escape): ditto.
|
||||
|
||||
Tue Sep 16 00:57:56 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* re.c (rb_reg_quote): use rb_enc_mbcput to generate ASCII
|
||||
|
|
10
string.c
10
string.c
|
@ -1625,7 +1625,7 @@ rb_str_buf_cat_ascii(VALUE str, const char *ptr)
|
|||
else {
|
||||
char *buf = ALLOCA_N(char, rb_enc_mbmaxlen(enc));
|
||||
while (*ptr) {
|
||||
int c = (unsigned char)*ptr;
|
||||
unsigned int c = (unsigned char)*ptr;
|
||||
int len = rb_enc_codelen(c, enc);
|
||||
rb_enc_mbcput(c, buf, enc);
|
||||
rb_enc_cr_str_buf_cat(str, buf, len,
|
||||
|
@ -1697,9 +1697,9 @@ rb_str_append(VALUE str, VALUE str2)
|
|||
VALUE
|
||||
rb_str_concat(VALUE str1, VALUE str2)
|
||||
{
|
||||
if (FIXNUM_P(str2)) {
|
||||
if (FIXNUM_P(str2) || TYPE(str2) == T_BIGNUM) {
|
||||
rb_encoding *enc = STR_ENC_GET(str1);
|
||||
int c = FIX2INT(str2);
|
||||
unsigned int c = NUM2UINT(str2);
|
||||
int pos = RSTRING_LEN(str1);
|
||||
int len = rb_enc_codelen(c, enc);
|
||||
int cr = ENC_CODERANGE(str1);
|
||||
|
@ -3790,7 +3790,7 @@ rb_str_to_s(VALUE str)
|
|||
}
|
||||
|
||||
static void
|
||||
str_cat_char(VALUE str, int c, rb_encoding *enc)
|
||||
str_cat_char(VALUE str, unsigned int c, rb_encoding *enc)
|
||||
{
|
||||
char s[RUBY_MAX_CHAR_LEN];
|
||||
int n = rb_enc_codelen(c, enc);
|
||||
|
@ -3800,7 +3800,7 @@ str_cat_char(VALUE str, int c, rb_encoding *enc)
|
|||
}
|
||||
|
||||
static void
|
||||
prefix_escape(VALUE str, int c, rb_encoding *enc)
|
||||
prefix_escape(VALUE str, unsigned int c, rb_encoding *enc)
|
||||
{
|
||||
str_cat_char(str, '\\', enc);
|
||||
str_cat_char(str, c, enc);
|
||||
|
|
Загрузка…
Ссылка в новой задаче