зеркало из https://github.com/github/ruby.git
win32/file.c: refine fix_string_encoding
* win32/file.c (fix_string_encoding): simplify with rb_str_conv_enc(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
45fbfd0a81
Коммит
320a0dd218
|
@ -1,4 +1,6 @@
|
||||||
Fri Jul 26 13:00:24 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Fri Jul 26 13:01:04 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* win32/file.c (fix_string_encoding): simplify with rb_str_conv_enc().
|
||||||
|
|
||||||
* win32/file.c (convert_mb_to_wchar): use bare pointer instead of
|
* win32/file.c (convert_mb_to_wchar): use bare pointer instead of
|
||||||
VALUE, and remove useless argument.
|
VALUE, and remove useless argument.
|
||||||
|
|
11
win32/file.c
11
win32/file.c
|
@ -235,16 +235,7 @@ code_page(rb_encoding *enc)
|
||||||
return INVALID_CODE_PAGE;
|
return INVALID_CODE_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline VALUE
|
#define fix_string_encoding(str, encoding) rb_str_conv_enc((str), NULL, (encoding))
|
||||||
fix_string_encoding(VALUE str, rb_encoding *encoding)
|
|
||||||
{
|
|
||||||
VALUE result, tmp;
|
|
||||||
|
|
||||||
tmp = rb_enc_str_new(RSTRING_PTR(str), RSTRING_LEN(str), encoding);
|
|
||||||
result = rb_str_encode(tmp, rb_enc_from_encoding(rb_utf8_encoding()), 0, Qnil);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Replace the last part of the path to long name.
|
Replace the last part of the path to long name.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче