cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: removing winsock 2 dependence

From: Gisle Vanem <gvanem_at_broadpark.no>
Date: Tue, 2 Mar 2004 21:12:35 +0100

"David Byron" <DByron_at_everdreamcorp.com> said:

Looks oaky at first sight, except:

@@ -1079,7 +1175,8 @@
   objs[1] = event_handle;

   /* Tell winsock what events we want to listen to */
- if(WSAEventSelect(sockfd, event_handle, FD_READ|FD_CLOSE) == SOCKET_ERROR) {
+ if(event_select_func(sockfd, event_handle, FD_READ|FD_CLOSE) == SOCKET_ERROR) {
+ FreeLibrary(wsock2);
     return 0;
   }

Shouldn't the event-handle be closed here and some other places below?
Looks like WSACloseEvent() was omitted by mistake(?) in the original code.

And calling a func-ptr like
   event_handle = (WSAEVENT)create_event_func();
should IMHO be written as:
  event_handle = (WSAEVENT) (*create_event_func)();

This is misused in other places in libcurl (ldap.c etc.). I don't know if some
compilers have problems with the syntax, but it's valuable to see it's an
indirect call.

BTW. I think MSVC should have HAVE_LONGLONG defined in it's Makefile
to support large files.

--gv
Received on 2004-03-02