diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-30 11:06:52 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-30 11:06:52 +0000 |
commit | 7b2f9d923875b1b70032192554a3aae3276ce5b6 (patch) | |
tree | edf32c7ab86e821067bffd8d1d4660a2bf016e75 | |
parent | 29c7201262b1ee135b5ab9f07c99f7cc06bfabcd (diff) | |
download | ruby-7b2f9d923875b1b70032192554a3aae3276ce5b6.tar.gz |
* win32/win32.c (rb_w32_open, rb_w32_read, rb_w32_write): fallback to
MSVCRT if text mode is specified. this case will not be used from
ruby itself.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18951 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | win32/win32.c | 17 |
2 files changed, 23 insertions, 0 deletions
@@ -1,3 +1,9 @@ +Sat Aug 30 20:05:41 2008 NAKAMURA Usaku <usa@ruby-lang.org> + + * win32/win32.c (rb_w32_open, rb_w32_read, rb_w32_write): fallback to + MSVCRT if text mode is specified. this case will not be used from + ruby itself. + Sat Aug 30 19:49:38 2008 NAKAMURA Usaku <usa@ruby-lang.org> * win32/win32.c (rb_w32_read): EOF is not error. diff --git a/win32/win32.c b/win32/win32.c index 761014057e..c06aeffff2 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -4007,6 +4007,15 @@ rb_w32_open(const char *file, int oflag, ...) SECURITY_ATTRIBUTES sec; HANDLE h; + if ((oflag & O_TEXT) || !(oflag & ~O_BINARY)) { + va_list arg; + int pmode; + va_start(arg, oflag); + pmode = va_arg(arg, int); + va_end(arg); + return _open(file, oflag, pmode); + } + sec.nLength = sizeof(sec); sec.lpSecurityDescriptor = NULL; if (oflag & O_NOINHERIT) { @@ -4313,6 +4322,10 @@ rb_w32_read(int fd, void *buf, size_t size) return -1; } + if (_osfile(fd) & FTEXT) { + return _read(fd, buf, size); + } + MTHREAD_ONLY(EnterCriticalSection(&(_pioinfo(fd)->lock))); if (!size || _osfile(fd) & FEOFLAG) { @@ -4423,6 +4436,10 @@ rb_w32_write(int fd, const void *buf, size_t size) return -1; } + if (_osfile(fd) & FTEXT) { + return _write(fd, buf, size); + } + MTHREAD_ONLY(EnterCriticalSection(&(_pioinfo(fd)->lock))); if (!size || _osfile(fd) & FEOFLAG) { |