1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* file.c (rb_file_s_basename, rb_file_s_dirname, rb_file_s_extname):

copy encoding.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15978 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-04-11 18:12:18 +00:00
parent 3734fd0e79
commit 23bb4d7898
3 changed files with 11 additions and 3 deletions

View file

@ -1,3 +1,8 @@
Sat Apr 12 03:12:16 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (rb_file_s_basename, rb_file_s_dirname, rb_file_s_extname):
copy encoding.
Fri Apr 11 17:35:06 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* enum.c (count_i): modified to shut warning up.

3
file.c
View file

@ -2880,6 +2880,7 @@ rb_file_s_basename(int argc, VALUE *argv)
}
}
basename = rb_str_new(p, f);
rb_enc_copy(basename, fname);
OBJ_INFECT(basename, fname);
return basename;
}
@ -2931,6 +2932,7 @@ rb_file_s_dirname(VALUE klass, VALUE fname)
if (has_drive_letter(name) && root == name + 2 && p - name == 2)
rb_str_cat(dirname, ".", 1);
#endif
rb_enc_copy(dirname, fname);
OBJ_INFECT(dirname, fname);
return dirname;
}
@ -2967,6 +2969,7 @@ rb_file_s_extname(VALUE klass, VALUE fname)
if (!e || e == p || !e[1]) /* no dot, or the only dot is first or end? */
return rb_str_new(0, 0);
extname = rb_str_new(e, chompdirsep(e) - e); /* keep the dot, too! */
rb_enc_copy(extname, fname);
OBJ_INFECT(extname, fname);
return extname;
}

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2008-04-11"
#define RUBY_RELEASE_DATE "2008-04-12"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20080411
#define RUBY_RELEASE_CODE 20080412
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 4
#define RUBY_RELEASE_DAY 11
#define RUBY_RELEASE_DAY 12
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];