ruby-changes:7850
From: naruse <ko1@a...>
Date: Tue, 16 Sep 2008 02:05:18 +0900 (JST)
Subject: [ruby-changes:7850] Ruby:r19371 (trunk): * string.c (rb_str_buf_cat_ascii): codepoint is unsigned int.
naruse 2008-09-16 02:05:00 +0900 (Tue, 16 Sep 2008) New Revision: 19371 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19371 Log: * 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. Modified files: trunk/ChangeLog trunk/string.c Index: ChangeLog =================================================================== --- ChangeLog (revision 19370) +++ ChangeLog (revision 19371) @@ -1,3 +1,13 @@ +Tue Sep 16 02:02:56 2008 NARUSE, Yui <naruse@r...> + + * 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@f...> * re.c (rb_reg_quote): use rb_enc_mbcput to generate ASCII Index: string.c =================================================================== --- string.c (revision 19370) +++ string.c (revision 19371) @@ -1625,7 +1625,7 @@ 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 @@ 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 @@ } 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 @@ } 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/