diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-29 15:02:25 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-29 15:02:25 +0000 |
commit | b4c3c3171f4a8b9c39b68bf5e545d8853b84ff77 (patch) | |
tree | 4e5d4c6676fde6eb77cd8a98c061a7937992e4bb /ruby.c | |
parent | 11e75ca5e571e0e346d727833150b91e376b04cd (diff) |
ruby.c: translit_char_bin
* ruby.c (translit_char_bin): should not use code page dependent
CharNext on UTF-8 string. [ruby-dev:48752] [Bug #10555]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ruby.c')
-rw-r--r-- | ruby.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -329,6 +329,16 @@ rb_libruby_handle(void) return libruby; } +static inline void +translit_char_bin(char *p, int from, int to) +{ + while (*p) { + if ((unsigned char)*p == from) + *p = to; + p++; + } +} + # define UTF8_PATH 1 #endif @@ -1338,7 +1348,10 @@ process_options(int argc, char **argv, struct cmdline_options *opt) opt->script_name = rb_str_new_cstr(opt->script); opt->script = RSTRING_PTR(opt->script_name); -#if defined DOSISH || defined __CYGWIN__ + +#if _WIN32 + translit_char_bin(RSTRING_PTR(opt->script_name), '\\', '/'); +#elif defined DOSISH translit_char(RSTRING_PTR(opt->script_name), '\\', '/'); #endif |