* win32/win32.c (rb_w32_open_osfhandle, rb_w32_wopen, rb_w32_pipe):
use uintptr_t instead of long for win64. * win32/win32.c (socketpair_internal): suppress warnings. * win32/win32.c (ftruncate): use HANDLE instead of long for win64. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
85d1cba883
commit
150b4efa55
@ -1,4 +1,11 @@
|
|||||||
Tue Oct 12 23:55:11 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Oct 12 23:58:19 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* win32/win32.c (rb_w32_open_osfhandle, rb_w32_wopen, rb_w32_pipe):
|
||||||
|
use uintptr_t instead of long for win64.
|
||||||
|
|
||||||
|
* win32/win32.c (socketpair_internal): suppress warnings.
|
||||||
|
|
||||||
|
* win32/win32.c (ftruncate): use HANDLE instead of long for win64.
|
||||||
|
|
||||||
* vsnprintf.c (BSD_vfprintf): fix cast.
|
* vsnprintf.c (BSD_vfprintf): fix cast.
|
||||||
|
|
||||||
|
@ -2078,7 +2078,7 @@ rb_w32_open_osfhandle(intptr_t osfhandle, int flags)
|
|||||||
|
|
||||||
/* attempt to allocate a C Runtime file handle */
|
/* attempt to allocate a C Runtime file handle */
|
||||||
hF = CreateFile("NUL", 0, 0, NULL, OPEN_ALWAYS, 0, NULL);
|
hF = CreateFile("NUL", 0, 0, NULL, OPEN_ALWAYS, 0, NULL);
|
||||||
fh = _open_osfhandle((long)hF, 0);
|
fh = _open_osfhandle((intptr_t)hF, 0);
|
||||||
CloseHandle(hF);
|
CloseHandle(hF);
|
||||||
if (fh == -1) {
|
if (fh == -1) {
|
||||||
errno = EMFILE; /* too many open files */
|
errno = EMFILE; /* too many open files */
|
||||||
@ -3434,6 +3434,8 @@ socketpair_internal(int af, int type, int protocol, SOCKET *sv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sv[0] = (SOCKET)INVALID_HANDLE_VALUE;
|
||||||
|
sv[1] = (SOCKET)INVALID_HANDLE_VALUE;
|
||||||
RUBY_CRITICAL({
|
RUBY_CRITICAL({
|
||||||
do {
|
do {
|
||||||
svr = open_ifs_socket(af, type, protocol);
|
svr = open_ifs_socket(af, type, protocol);
|
||||||
@ -4381,16 +4383,16 @@ truncate(const char *path, off_t length)
|
|||||||
int
|
int
|
||||||
ftruncate(int fd, off_t length)
|
ftruncate(int fd, off_t length)
|
||||||
{
|
{
|
||||||
long h;
|
HANDLE h;
|
||||||
|
|
||||||
#ifdef WIN95
|
#ifdef WIN95
|
||||||
if (IsWin95()) {
|
if (IsWin95()) {
|
||||||
return chsize(fd, (unsigned long)length);
|
return chsize(fd, (unsigned long)length);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
h = _get_osfhandle(fd);
|
h = (HANDLE)_get_osfhandle(fd);
|
||||||
if (h == -1) return -1;
|
if (h == (HANDLE)-1) return -1;
|
||||||
return rb_chsize((HANDLE)h, length);
|
return rb_chsize(h, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
@ -4884,7 +4886,7 @@ rb_w32_wopen(const WCHAR *file, int oflag, ...)
|
|||||||
/* allocate a C Runtime file handle */
|
/* allocate a C Runtime file handle */
|
||||||
RUBY_CRITICAL({
|
RUBY_CRITICAL({
|
||||||
h = CreateFile("NUL", 0, 0, NULL, OPEN_ALWAYS, 0, NULL);
|
h = CreateFile("NUL", 0, 0, NULL, OPEN_ALWAYS, 0, NULL);
|
||||||
fd = _open_osfhandle((long)h, 0);
|
fd = _open_osfhandle((intptr_t)h, 0);
|
||||||
CloseHandle(h);
|
CloseHandle(h);
|
||||||
});
|
});
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
@ -4893,7 +4895,7 @@ rb_w32_wopen(const WCHAR *file, int oflag, ...)
|
|||||||
}
|
}
|
||||||
RUBY_CRITICAL({
|
RUBY_CRITICAL({
|
||||||
MTHREAD_ONLY(EnterCriticalSection(&(_pioinfo(fd)->lock)));
|
MTHREAD_ONLY(EnterCriticalSection(&(_pioinfo(fd)->lock)));
|
||||||
_set_osfhnd(fd, (long)INVALID_HANDLE_VALUE);
|
_set_osfhnd(fd, (intptr_t)INVALID_HANDLE_VALUE);
|
||||||
_set_osflags(fd, 0);
|
_set_osflags(fd, 0);
|
||||||
|
|
||||||
h = CreateFileW(file, access, FILE_SHARE_READ | FILE_SHARE_WRITE, &sec,
|
h = CreateFileW(file, access, FILE_SHARE_READ | FILE_SHARE_WRITE, &sec,
|
||||||
@ -4922,7 +4924,7 @@ rb_w32_wopen(const WCHAR *file, int oflag, ...)
|
|||||||
if (!(flags & (FDEV | FPIPE)) && (oflag & O_APPEND))
|
if (!(flags & (FDEV | FPIPE)) && (oflag & O_APPEND))
|
||||||
flags |= FAPPEND;
|
flags |= FAPPEND;
|
||||||
|
|
||||||
_set_osfhnd(fd, (long)h);
|
_set_osfhnd(fd, (intptr_t)h);
|
||||||
_osfile(fd) = flags | FOPEN;
|
_osfile(fd) = flags | FOPEN;
|
||||||
|
|
||||||
MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fd)->lock));
|
MTHREAD_ONLY(LeaveCriticalSection(&_pioinfo(fd)->lock));
|
||||||
@ -5003,7 +5005,7 @@ rb_w32_pipe(int fds[2])
|
|||||||
RUBY_CRITICAL(do {
|
RUBY_CRITICAL(do {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
h = CreateFile("NUL", 0, 0, NULL, OPEN_ALWAYS, 0, NULL);
|
h = CreateFile("NUL", 0, 0, NULL, OPEN_ALWAYS, 0, NULL);
|
||||||
fdRead = _open_osfhandle((long)h, 0);
|
fdRead = _open_osfhandle((intptr_t)h, 0);
|
||||||
CloseHandle(h);
|
CloseHandle(h);
|
||||||
if (fdRead == -1) {
|
if (fdRead == -1) {
|
||||||
errno = EMFILE;
|
errno = EMFILE;
|
||||||
@ -5014,7 +5016,7 @@ rb_w32_pipe(int fds[2])
|
|||||||
}
|
}
|
||||||
|
|
||||||
MTHREAD_ONLY(EnterCriticalSection(&(_pioinfo(fdRead)->lock)));
|
MTHREAD_ONLY(EnterCriticalSection(&(_pioinfo(fdRead)->lock)));
|
||||||
_set_osfhnd(fdRead, (long)hRead);
|
_set_osfhnd(fdRead, (intptr_t)hRead);
|
||||||
_set_osflags(fdRead, FOPEN | FPIPE | FNOINHERIT);
|
_set_osflags(fdRead, FOPEN | FPIPE | FNOINHERIT);
|
||||||
MTHREAD_ONLY(LeaveCriticalSection(&(_pioinfo(fdRead)->lock)));
|
MTHREAD_ONLY(LeaveCriticalSection(&(_pioinfo(fdRead)->lock)));
|
||||||
} while (0));
|
} while (0));
|
||||||
@ -5023,7 +5025,7 @@ rb_w32_pipe(int fds[2])
|
|||||||
|
|
||||||
RUBY_CRITICAL(do {
|
RUBY_CRITICAL(do {
|
||||||
h = CreateFile("NUL", 0, 0, NULL, OPEN_ALWAYS, 0, NULL);
|
h = CreateFile("NUL", 0, 0, NULL, OPEN_ALWAYS, 0, NULL);
|
||||||
fdWrite = _open_osfhandle((long)h, 0);
|
fdWrite = _open_osfhandle((intptr_t)h, 0);
|
||||||
CloseHandle(h);
|
CloseHandle(h);
|
||||||
if (fdWrite == -1) {
|
if (fdWrite == -1) {
|
||||||
errno = EMFILE;
|
errno = EMFILE;
|
||||||
@ -5032,7 +5034,7 @@ rb_w32_pipe(int fds[2])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MTHREAD_ONLY(EnterCriticalSection(&(_pioinfo(fdWrite)->lock)));
|
MTHREAD_ONLY(EnterCriticalSection(&(_pioinfo(fdWrite)->lock)));
|
||||||
_set_osfhnd(fdWrite, (long)hWrite);
|
_set_osfhnd(fdWrite, (intptr_t)hWrite);
|
||||||
_set_osflags(fdWrite, FOPEN | FPIPE | FNOINHERIT);
|
_set_osflags(fdWrite, FOPEN | FPIPE | FNOINHERIT);
|
||||||
MTHREAD_ONLY(LeaveCriticalSection(&(_pioinfo(fdWrite)->lock)));
|
MTHREAD_ONLY(LeaveCriticalSection(&(_pioinfo(fdWrite)->lock)));
|
||||||
} while (0));
|
} while (0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user