diff --git a/ChangeLog b/ChangeLog index d7b6be11ac..7a370f393d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Thu Feb 26 10:56:48 2009 NAKAMURA Usaku + + * include/ruby/win32.h (rb_w32_wopen): prototype forgotten. + + * io.c (rb_sysopen_internal): shouldn't replace undefined chars in this + case. + Thu Feb 26 01:34:38 2009 Tanaka Akira * ext/socket/mkconstants.rb: more MSG_* constants. diff --git a/include/ruby/win32.h b/include/ruby/win32.h index 46388a3ae2..ea5fe6132c 100644 --- a/include/ruby/win32.h +++ b/include/ruby/win32.h @@ -532,6 +532,7 @@ HANDLE GetCurrentThreadHandle(void); int rb_w32_sleep(unsigned long msec); int rb_w32_putc(int, FILE*); int rb_w32_getc(FILE*); +int rb_w32_wopen(const WCHAR *, int, ...); int rb_w32_open(const char *, int, ...); int rb_w32_close(int); int rb_w32_fclose(FILE*); diff --git a/io.c b/io.c index a41d75b06e..654669abc9 100644 --- a/io.c +++ b/io.c @@ -4185,7 +4185,8 @@ sysopen_func(void *ptr) struct sysopen_struct *data = ptr; #ifdef _WIN32 if (data->wchar) - return (VALUE)rb_w32_wopen(data->fname, data->oflags, data->perm); + return (VALUE)rb_w32_wopen((WCHAR *)data->fname, data->oflags, + data->perm); #endif return (VALUE)open(data->fname, data->oflags, data->perm); } @@ -4207,15 +4208,8 @@ rb_sysopen_internal(VALUE fname, int oflags, mode_t perm) utf16 = NULL; } if (utf16) { - VALUE wfname; - VALUE opthash = rb_hash_new(); - int ecflags; - VALUE ecopts; - rb_hash_aset(opthash, ID2SYM(rb_intern("undef")), - ID2SYM(rb_intern("replace"))); - ecflags = rb_econv_prepare_opts(opthash, &ecopts); - wfname = rb_str_encode(fname, rb_enc_from_encoding(utf16), ecflags, - ecopts); + VALUE wfname = rb_str_encode(fname, rb_enc_from_encoding(utf16), 0, + Qnil); rb_enc_str_buf_cat(wfname, "", 1, utf16); /* workaround */ data.fname = RSTRING_PTR(wfname); data.wchar = 1;