diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2006-09-21 09:41:04 +0000 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2006-09-21 09:41:04 +0000 |
commit | 3c809eac6656d257676438d8adb7bd58d9a18a43 (patch) | |
tree | bbafb5c21a54647e174cc1a2908445a2c9718c90 /otherlibs/win32unix/channels.c | |
parent | 840e64f9b15d5f34b44ffb7417180f3cd030163b (diff) |
Continuation of tentative fix for PR#4098
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@7629 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/win32unix/channels.c')
-rw-r--r-- | otherlibs/win32unix/channels.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/otherlibs/win32unix/channels.c b/otherlibs/win32unix/channels.c index 523013142..ed961910b 100644 --- a/otherlibs/win32unix/channels.c +++ b/otherlibs/win32unix/channels.c @@ -16,13 +16,14 @@ #include <mlvalues.h> #include <alloc.h> #include <io.h> +#include <memory.h> #include "unixsupport.h" #include <fcntl.h> extern long _get_osfhandle(int); extern int _open_osfhandle(long, int); -static int CRT_fd_of_filedescr(value handle) +int win_CRT_fd_of_filedescr(value handle) { if (CRT_fd_val(handle) != NO_CRT_FD) { return CRT_fd_val(handle); @@ -39,7 +40,7 @@ CAMLprim value win_inchannel_of_filedescr(value handle) CAMLlocal1(vchan); struct channel * chan; - chan = caml_open_descriptor_in(CRT_fd_of_filedescr(handle)); + chan = caml_open_descriptor_in(win_CRT_fd_of_filedescr(handle)); if (Descr_kind_val(handle) == KIND_SOCKET) chan->flags |= CHANNEL_FLAG_FROM_SOCKET; vchan = caml_alloc_channel(chan); @@ -53,7 +54,7 @@ CAMLprim value win_outchannel_of_filedescr(value handle) int fd; struct channel * chan; - chan = caml_open_descriptor_out(CRT_fd_of_filedescr(handle)); + chan = caml_open_descriptor_out(win_CRT_fd_of_filedescr(handle)); if (Descr_kind_val(handle) == KIND_SOCKET) chan->flags |= CHANNEL_FLAG_FROM_SOCKET; vchan = caml_alloc_channel(chan); @@ -68,13 +69,13 @@ CAMLprim value win_filedescr_of_channel(value vchan) HANDLE h; chan = Channel(vchan); - if (channel->fd == -1) uerror("descr_of_channel", Nothing); - h = (HANDLE) _get_osfhandle(channel->fd); + if (chan->fd == -1) uerror("descr_of_channel", Nothing); + h = (HANDLE) _get_osfhandle(chan->fd); if (chan->flags & CHANNEL_FLAG_FROM_SOCKET) - fd = win_alloc_socket(h); + fd = win_alloc_socket((SOCKET) h); else fd = win_alloc_handle(h); - CRT_fd_val(fd) = channel->fd; + CRT_fd_val(fd) = chan->fd; CAMLreturn(fd); } |