mirror of
https://github.com/curl/curl.git
synced 2026-08-24 23:23:32 +03:00
build: update to not need _CRT_NONSTDC_NO_DEPRECATE with MSVC
Use non-deprecated CRT function variants on Windows. - introduce `curlx_fdopen()`, `curlx_close()` and use them. Map them to non-deprecated, underscored, CRT functions on Windows. - replace `close()` uses with either `sclose()` (for sockets) or `curlx_close()` (for files). - map `fileno`, `unlink`, `isatty` to their non-deprecated, underscored, versions on Windows. - tool_dirhie: map `mkdir` to `_mkdir` on Windows. - easy: use `_strdup()` on Windows, regardless of how `HAVE_STRDUP` is set. - cmake: assume `HAVE_STRDUP` on Windows. To allow dropping a detection hack using `_CRT_NONSTDC_NO_DEPRECATE` with MSVC. Windows always has `_strdup()` which the code uses, but also needs `HAVE_STRDUP` defined to disable curl's own `strdup()` implementation. - curl_setup.h: drop `_CRT_NONSTDC_NO_DEPRECATE` as no longer necessary. Closes #20212
This commit is contained in:
parent
dbc4603b09
commit
e50aa46fb2
25 changed files with 54 additions and 49 deletions
|
|
@ -64,8 +64,8 @@ static int wakeup_pipe(curl_socket_t socks[2], bool nonblocking)
|
|||
#ifdef HAVE_FCNTL
|
||||
if(fcntl(socks[0], F_SETFD, FD_CLOEXEC) ||
|
||||
fcntl(socks[1], F_SETFD, FD_CLOEXEC)) {
|
||||
close(socks[0]);
|
||||
close(socks[1]);
|
||||
sclose(socks[0]);
|
||||
sclose(socks[1]);
|
||||
socks[0] = socks[1] = CURL_SOCKET_BAD;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -73,8 +73,8 @@ static int wakeup_pipe(curl_socket_t socks[2], bool nonblocking)
|
|||
if(nonblocking) {
|
||||
if(curlx_nonblock(socks[0], TRUE) < 0 ||
|
||||
curlx_nonblock(socks[1], TRUE) < 0) {
|
||||
close(socks[0]);
|
||||
close(socks[1]);
|
||||
sclose(socks[0]);
|
||||
sclose(socks[1]);
|
||||
socks[0] = socks[1] = CURL_SOCKET_BAD;
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -107,8 +107,8 @@ static int wakeup_socketpair(curl_socket_t socks[2], bool nonblocking)
|
|||
if(nonblocking) {
|
||||
if(curlx_nonblock(socks[0], TRUE) < 0 ||
|
||||
curlx_nonblock(socks[1], TRUE) < 0) {
|
||||
close(socks[0]);
|
||||
close(socks[1]);
|
||||
sclose(socks[0]);
|
||||
sclose(socks[1]);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue