mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* file.c (file_expand_path): use rb_enc_associate_index and
rb_filesystem_encindex. Strings related FileSystem should have filesystem_encoding. * file.c (SET_EXTERNAL_ENCODING): removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f39ad4cab2
commit
ac8346c4c3
2 changed files with 10 additions and 7 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
Thu May 27 23:07:45 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* file.c (file_expand_path): use rb_enc_associate_index and
|
||||||
|
rb_filesystem_encindex. Strings related FileSystem should
|
||||||
|
have filesystem_encoding.
|
||||||
|
|
||||||
|
* file.c (SET_EXTERNAL_ENCODING): removed.
|
||||||
|
|
||||||
Thu May 27 23:03:19 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
Thu May 27 23:03:19 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* include/ruby/encoding.h (rb_filesystem_encindex): defined.
|
* include/ruby/encoding.h (rb_filesystem_encindex): defined.
|
||||||
|
|
9
file.c
9
file.c
|
@ -2788,10 +2788,6 @@ ntfs_tail(const char *path)
|
||||||
buflen = RSTRING_LEN(result),\
|
buflen = RSTRING_LEN(result),\
|
||||||
pend = p + buflen)
|
pend = p + buflen)
|
||||||
|
|
||||||
#define SET_EXTERNAL_ENCODING() (\
|
|
||||||
(void)(extenc || (extenc = rb_default_external_encoding())),\
|
|
||||||
rb_enc_associate(result, extenc))
|
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_home_dir(const char *user, VALUE result)
|
rb_home_dir(const char *user, VALUE result)
|
||||||
{
|
{
|
||||||
|
@ -2842,7 +2838,6 @@ file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE result)
|
||||||
char *buf, *p, *pend, *root;
|
char *buf, *p, *pend, *root;
|
||||||
size_t buflen, dirlen, bdiff;
|
size_t buflen, dirlen, bdiff;
|
||||||
int tainted;
|
int tainted;
|
||||||
rb_encoding *extenc = 0;
|
|
||||||
|
|
||||||
s = StringValuePtr(fname);
|
s = StringValuePtr(fname);
|
||||||
BUFINIT();
|
BUFINIT();
|
||||||
|
@ -2898,7 +2893,7 @@ file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE result)
|
||||||
BUFCHECK(dirlen > buflen);
|
BUFCHECK(dirlen > buflen);
|
||||||
strcpy(buf, dir);
|
strcpy(buf, dir);
|
||||||
xfree(dir);
|
xfree(dir);
|
||||||
SET_EXTERNAL_ENCODING();
|
rb_enc_associate_index(result, rb_filesystem_encindex());
|
||||||
}
|
}
|
||||||
p = chompdirsep(skiproot(buf));
|
p = chompdirsep(skiproot(buf));
|
||||||
s += 2;
|
s += 2;
|
||||||
|
@ -2918,7 +2913,7 @@ file_expand_path(VALUE fname, VALUE dname, int abs_mode, VALUE result)
|
||||||
BUFCHECK(dirlen > buflen);
|
BUFCHECK(dirlen > buflen);
|
||||||
strcpy(buf, dir);
|
strcpy(buf, dir);
|
||||||
xfree(dir);
|
xfree(dir);
|
||||||
SET_EXTERNAL_ENCODING();
|
rb_enc_associate_index(result, rb_filesystem_encindex());
|
||||||
}
|
}
|
||||||
#if defined DOSISH || defined __CYGWIN__
|
#if defined DOSISH || defined __CYGWIN__
|
||||||
if (isdirsep(*s)) {
|
if (isdirsep(*s)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue