mirror of
https://github.com/curl/curl.git
synced 2026-07-27 17:48:55 +03:00
I removed the socklen_t use from the public curl/curl.h header and instead
made it an unsigned int. The type was only used in the curl_sockaddr struct definition (only used by the curl_opensocket_callback). On all platforms I could find information about, socklen_t is 32 unsigned bits large so I don't think this will break the API or ABI. The main reason for this change is of course for all the platforms that don't have a socklen_t definition in their headers to build fine again. Providing our own configure magic and custom definition of socklen_t on those systems proved to work but was a lot of cruft, code and extra magic needed - when this very small change of type seems harmless and still solves the missing socklen_t problem.
This commit is contained in:
parent
a46b40b7fd
commit
193d33fd4a
3 changed files with 15 additions and 19 deletions
|
|
@ -85,23 +85,6 @@ extern "C" {
|
|||
|
||||
typedef void CURL;
|
||||
|
||||
/*
|
||||
* Windows build targets have socklen_t definition in
|
||||
* ws2tcpip.h but some versions of ws2tcpip.h do not
|
||||
* have the definition. It seems that when the socklen_t
|
||||
* definition is missing from ws2tcpip.h the definition
|
||||
* for INET_ADDRSTRLEN is also missing, and that when one
|
||||
* definition is present the other one also is available.
|
||||
*/
|
||||
|
||||
#if defined(WIN32) && !defined(HAVE_SOCKLEN_T)
|
||||
# if ( defined(_MSC_VER) && !defined(INET_ADDRSTRLEN) ) || \
|
||||
(!defined(_MSC_VER) && !defined(_WS2TCPIP_H_) && !defined(_WS2TCPIP_H) )
|
||||
# define socklen_t int
|
||||
# define HAVE_SOCKLEN_T
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Decorate exportable functions for Win32 DLL linking.
|
||||
* This avoids using a .def file for building libcurl.dll.
|
||||
|
|
@ -274,7 +257,9 @@ struct curl_sockaddr {
|
|||
int family;
|
||||
int socktype;
|
||||
int protocol;
|
||||
socklen_t addrlen;
|
||||
unsigned int addrlen; /* addrlen was a socklen_t type before 7.17.2 but it
|
||||
turned really ugly and painful on the systems that
|
||||
lack this type */
|
||||
struct sockaddr addr;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue