mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
9e10d51c40
commit
b0c70a8856
2 changed files with 15 additions and 5 deletions
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>
|
Tue Sep 16 00:57:56 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* re.c (rb_reg_quote): use rb_enc_mbcput to generate ASCII
|
* 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 {
|
else {
|
||||||
char *buf = ALLOCA_N(char, rb_enc_mbmaxlen(enc));
|
char *buf = ALLOCA_N(char, rb_enc_mbmaxlen(enc));
|
||||||
while (*ptr) {
|
while (*ptr) {
|
||||||
int c = (unsigned char)*ptr;
|
unsigned int c = (unsigned char)*ptr;
|
||||||
int len = rb_enc_codelen(c, enc);
|
int len = rb_enc_codelen(c, enc);
|
||||||
rb_enc_mbcput(c, buf, enc);
|
rb_enc_mbcput(c, buf, enc);
|
||||||
rb_enc_cr_str_buf_cat(str, buf, len,
|
rb_enc_cr_str_buf_cat(str, buf, len,
|
||||||
|
@ -1697,9 +1697,9 @@ rb_str_append(VALUE str, VALUE str2)
|
||||||
VALUE
|
VALUE
|
||||||
rb_str_concat(VALUE str1, VALUE str2)
|
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);
|
rb_encoding *enc = STR_ENC_GET(str1);
|
||||||
int c = FIX2INT(str2);
|
unsigned int c = NUM2UINT(str2);
|
||||||
int pos = RSTRING_LEN(str1);
|
int pos = RSTRING_LEN(str1);
|
||||||
int len = rb_enc_codelen(c, enc);
|
int len = rb_enc_codelen(c, enc);
|
||||||
int cr = ENC_CODERANGE(str1);
|
int cr = ENC_CODERANGE(str1);
|
||||||
|
@ -3790,7 +3790,7 @@ rb_str_to_s(VALUE str)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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];
|
char s[RUBY_MAX_CHAR_LEN];
|
||||||
int n = rb_enc_codelen(c, enc);
|
int n = rb_enc_codelen(c, enc);
|
||||||
|
@ -3800,7 +3800,7 @@ str_cat_char(VALUE str, int c, rb_encoding *enc)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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, '\\', enc);
|
||||||
str_cat_char(str, c, enc);
|
str_cat_char(str, c, enc);
|
||||||
|
|
Loading…
Reference in a new issue