In article [email protected],
Tanaka A. [email protected] writes:
- [ruby-core:13026] String#inspect e$B$Ge(B \OOO e$B$8$c$J$/$Fe(B \xHH e$B$r;H$&e(B
String#inspect e$B$@$1$8$c$J$/$F!"JR$CC<$+$iJQ$($k$H$3$s$J$H$3e(B
e$B$m$G$9$+$M!#e(B
e$BH4$1$,$"$k$+$b$7$l$^$;$s$,!#e(B
Index: re.c
— re.c (revision 14161)
+++ re.c (working copy)
@@ -259,7 +259,7 @@ rb_reg_expr_str(VALUE str, const char *s
else if (!rb_enc_isspace(c, enc)) {
char b[8];
- sprintf(b, “\x%02x”, c);
rb_str_buf_cat(str, b, 4);
}
else {
Index: regerror.c
===================================================================
— regerror.c (revision 14161)
+++ regerror.c (working copy)
@@ -197,7 +197,7 @@ static int to_ascii(OnigEncoding enc, UC
code = ONIGENC_MBC_TO_CODE(enc, p, end);
if (code >= 0x80) {
if (len + 5 <= buf_size) {
- sprintf((char* )(&(buf[len])), “\%03o”,
-
sprintf((char* )(&(buf[len])), “\x%02x”,
(unsigned int )(code & 0377));
len += 5;
}
@@ -346,7 +346,7 @@ onig_snprintf_with_pattern(buf, bufsize,
int blen;
while (len-- > 0) {
-
sprintf((char* )bs, "\\x%02x", *p++ & 0377);
blen = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
bp = bs;
while (blen-- > 0) *s++ = *bp++;
@@ -355,7 +355,7 @@ onig_snprintf_with_pattern(buf, bufsize,
}
else if (!ONIGENC_IS_CODE_PRINT(enc, *p) &&
!ONIGENC_IS_CODE_SPACE(enc, *p)) {
- sprintf((char* )bs, “\%03o”, *p++ & 0377);
- sprintf((char* )bs, “\x%02x”, *p++ & 0377);
len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
bp = bs;
while (len-- > 0) *s++ = *bp++;
Index: string.c
===================================================================
— string.c (revision 14161)
+++ string.c (working copy)
@@ -2971,7 +2971,7 @@ rb_str_inspect(VALUE str)
escape_codepoint:
for (q = p-n; q < p; q++) {
s = buf;
-
sprintf(buf, "\\x%02x", *q & 0377);
while (*s) {
str_cat_char(result, *s++, enc);
}
@@ -3083,7 +3083,7 @@ rb_str_dump(VALUE str)
}
else {
*q++ = ‘\’;
-
sprintf(q, "x%02x", c&0xff);
q += 3;
}
}
Index: parse.y
===================================================================
— parse.y (revision 14161)
+++ parse.y (working copy)
@@ -7094,7 +7094,7 @@ parser_yylex(struct parser_params *parse
default:
if (!parser_is_identchar()) {
expression", c);
expression", c);
goto retry;
}
Index: ruby.c
— ruby.c (revision 14161)
+++ ruby.c (working copy)
@@ -863,7 +863,7 @@ proc_options(int argc, char **argv, stru
}
else {
rb_raise(rb_eRuntimeError,
-
"invalid option -\\x%02x (-h will show valid options)",
(int)(unsigned char)*s);
}
}
Index: test/ruby/test_regexp.rb
===================================================================
— test/ruby/test_regexp.rb (revision 14161)
+++ test/ruby/test_regexp.rb (working copy)
@@ -35,7 +35,7 @@ class TestRegexp < Test::Unit::TestCase
end
def test_to_s
- assert_equal ‘(?-mix:\000)’, Regexp.new(“\0”).to_s
- assert_equal ‘(?-mix:\x00)’, Regexp.new(“\0”).to_s
end
def test_union
Index: test/ruby/test_string.rb
— test/ruby/test_string.rb (revision 14161)
+++ test/ruby/test_string.rb (working copy)
@@ -444,7 +444,7 @@ class TestString < Test::Unit::TestCase
def test_dump
a= S(“Test”) << 1 << 2 << 3 << 9 << 13 << 10
- assert_equal(S(‘“Test\001\002\003\t\r\n”’), a.dump)
- assert_equal(S(‘“Test\x01\x02\x03\t\r\n”’), a.dump)
end
def test_dup
Index: file.c
— file.c (revision 14161)
+++ file.c (working copy)
@@ -3486,7 +3486,7 @@ rb_f_test(int argc, VALUE *argv)
rb_raise(rb_eArgError, “unknown command ?%c”, cmd);
}
else {
- rb_raise(rb_eArgError, “unknown command ?\%03o”, cmd);
- rb_raise(rb_eArgError, “unknown command ?\x%02x”, cmd);
}
return Qnil; /* not reached */
}