* re.c, regerror.c, string.c, parse.y, ruby.c, file.c:
use capital letter for \xHH notation. [ruby-dev:32511] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14202 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
098ca00175
commit
b92cee1ddb
@ -1,3 +1,8 @@
|
|||||||
|
Wed Dec 12 23:22:58 2007 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* re.c, regerror.c, string.c, parse.y, ruby.c, file.c:
|
||||||
|
use capital letter for \xHH notation. [ruby-dev:32511]
|
||||||
|
|
||||||
Wed Dec 12 22:21:34 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
Wed Dec 12 22:21:34 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* io.c (rb_io_mode_enc): allow specifying external encoding in
|
* io.c (rb_io_mode_enc): allow specifying external encoding in
|
||||||
|
2
file.c
2
file.c
@ -3486,7 +3486,7 @@ rb_f_test(int argc, VALUE *argv)
|
|||||||
rb_raise(rb_eArgError, "unknown command ?%c", cmd);
|
rb_raise(rb_eArgError, "unknown command ?%c", cmd);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_raise(rb_eArgError, "unknown command ?\\x%02x", cmd);
|
rb_raise(rb_eArgError, "unknown command ?\\x%02X", cmd);
|
||||||
}
|
}
|
||||||
return Qnil; /* not reached */
|
return Qnil; /* not reached */
|
||||||
}
|
}
|
||||||
|
2
parse.y
2
parse.y
@ -7070,7 +7070,7 @@ parser_yylex(struct parser_params *parser)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
if (!parser_is_identchar()) {
|
if (!parser_is_identchar()) {
|
||||||
rb_compile_error(PARSER_ARG "Invalid char `\\x%02x' in expression", c);
|
rb_compile_error(PARSER_ARG "Invalid char `\\x%02X' in expression", c);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
re.c
6
re.c
@ -264,7 +264,7 @@ rb_reg_expr_str(VALUE str, const char *s, long len)
|
|||||||
else if (!rb_enc_isspace(c, enc)) {
|
else if (!rb_enc_isspace(c, enc)) {
|
||||||
char b[8];
|
char b[8];
|
||||||
|
|
||||||
sprintf(b, "\\x%02x", c);
|
sprintf(b, "\\x%02X", c);
|
||||||
rb_str_buf_cat(str, b, 4);
|
rb_str_buf_cat(str, b, 4);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1671,7 +1671,7 @@ unescape_escaped_nonascii(const char **pp, const char *end, rb_encoding *enc,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char escbuf[5];
|
char escbuf[5];
|
||||||
snprintf(escbuf, sizeof(escbuf), "\\x%02x", chbuf[0]&0xff);
|
snprintf(escbuf, sizeof(escbuf), "\\x%02X", chbuf[0]&0xff);
|
||||||
rb_str_buf_cat(buf, escbuf, 4);
|
rb_str_buf_cat(buf, escbuf, 4);
|
||||||
}
|
}
|
||||||
*pp = p;
|
*pp = p;
|
||||||
@ -1697,7 +1697,7 @@ append_utf8(unsigned long uv,
|
|||||||
return -1;
|
return -1;
|
||||||
if (uv < 0x80) {
|
if (uv < 0x80) {
|
||||||
char escbuf[5];
|
char escbuf[5];
|
||||||
snprintf(escbuf, sizeof(escbuf), "\\x%02x", (int)uv);
|
snprintf(escbuf, sizeof(escbuf), "\\x%02X", (int)uv);
|
||||||
rb_str_buf_cat(buf, escbuf, 4);
|
rb_str_buf_cat(buf, escbuf, 4);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -197,7 +197,7 @@ static int to_ascii(OnigEncoding enc, UChar *s, UChar *end,
|
|||||||
code = ONIGENC_MBC_TO_CODE(enc, p, end);
|
code = ONIGENC_MBC_TO_CODE(enc, p, end);
|
||||||
if (code >= 0x80) {
|
if (code >= 0x80) {
|
||||||
if (len + 5 <= buf_size) {
|
if (len + 5 <= buf_size) {
|
||||||
sprintf((char* )(&(buf[len])), "\\x%02x",
|
sprintf((char* )(&(buf[len])), "\\x%02X",
|
||||||
(unsigned int )(code & 0377));
|
(unsigned int )(code & 0377));
|
||||||
len += 5;
|
len += 5;
|
||||||
}
|
}
|
||||||
@ -346,7 +346,7 @@ onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist)
|
|||||||
int blen;
|
int blen;
|
||||||
|
|
||||||
while (len-- > 0) {
|
while (len-- > 0) {
|
||||||
sprintf((char* )bs, "\\x%02x", *p++ & 0377);
|
sprintf((char* )bs, "\\x%02X", *p++ & 0377);
|
||||||
blen = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
|
blen = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
|
||||||
bp = bs;
|
bp = bs;
|
||||||
while (blen-- > 0) *s++ = *bp++;
|
while (blen-- > 0) *s++ = *bp++;
|
||||||
@ -355,7 +355,7 @@ onig_snprintf_with_pattern(buf, bufsize, enc, pat, pat_end, fmt, va_alist)
|
|||||||
}
|
}
|
||||||
else if (!ONIGENC_IS_CODE_PRINT(enc, *p) &&
|
else if (!ONIGENC_IS_CODE_PRINT(enc, *p) &&
|
||||||
!ONIGENC_IS_CODE_SPACE(enc, *p)) {
|
!ONIGENC_IS_CODE_SPACE(enc, *p)) {
|
||||||
sprintf((char* )bs, "\\x%02x", *p++ & 0377);
|
sprintf((char* )bs, "\\x%02X", *p++ & 0377);
|
||||||
len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
|
len = onigenc_str_bytelen_null(ONIG_ENCODING_ASCII, bs);
|
||||||
bp = bs;
|
bp = bs;
|
||||||
while (len-- > 0) *s++ = *bp++;
|
while (len-- > 0) *s++ = *bp++;
|
||||||
|
2
ruby.c
2
ruby.c
@ -863,7 +863,7 @@ proc_options(int argc, char **argv, struct cmdline_options *opt)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_raise(rb_eRuntimeError,
|
rb_raise(rb_eRuntimeError,
|
||||||
"invalid option -\\x%02x (-h will show valid options)",
|
"invalid option -\\x%02X (-h will show valid options)",
|
||||||
(int)(unsigned char)*s);
|
(int)(unsigned char)*s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
string.c
4
string.c
@ -3001,7 +3001,7 @@ rb_str_inspect(VALUE str)
|
|||||||
escape_codepoint:
|
escape_codepoint:
|
||||||
for (q = p-n; q < p; q++) {
|
for (q = p-n; q < p; q++) {
|
||||||
s = buf;
|
s = buf;
|
||||||
sprintf(buf, "\\x%02x", *q & 0377);
|
sprintf(buf, "\\x%02X", *q & 0377);
|
||||||
while (*s) {
|
while (*s) {
|
||||||
str_cat_char(result, *s++, enc);
|
str_cat_char(result, *s++, enc);
|
||||||
}
|
}
|
||||||
@ -3113,7 +3113,7 @@ rb_str_dump(VALUE str)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
*q++ = '\\';
|
*q++ = '\\';
|
||||||
sprintf(q, "x%02x", c&0xff);
|
sprintf(q, "x%02X", c&0xff);
|
||||||
q += 3;
|
q += 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user