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

* include/ruby/win32.h (rb_w32_wopen): prototype forgotten.

* io.c (rb_sysopen_internal): shouldn't replace undefined chars in this
	  case.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2009-02-26 01:58:20 +00:00
parent 2276b2f904
commit 2c288bf91f
3 changed files with 12 additions and 10 deletions

View file

@ -1,3 +1,10 @@
Thu Feb 26 10:56:48 2009 NAKAMURA Usaku <usa@ruby-lang.org>
* 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 <akr@fsij.org>
* ext/socket/mkconstants.rb: more MSG_* constants.

View file

@ -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*);

14
io.c
View file

@ -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;