mirror of
https://github.com/libretro/scummvm.git
synced 2025-05-13 09:36:21 +00:00
BACKENDS: CURL: Fix build with old curl versions
This commit is contained in:
parent
673ff82b8a
commit
1d2ffda577
@ -86,13 +86,26 @@ bool CurlSocket::connect(Common::String url) {
|
||||
}
|
||||
|
||||
// Get the socket, we'll need it for waiting.
|
||||
#if LIBCURL_VERSION_NUM >= 0x072d00 // 7.45.0
|
||||
// Try first using new CURLINFO_ACTIVESOCKET
|
||||
res = curl_easy_getinfo(_easy, CURLINFO_ACTIVESOCKET, &_socket);
|
||||
if (res != CURLE_OK) {
|
||||
warning("libcurl: Failed to extract socket: %s", curl_easy_strerror(res));
|
||||
return false;
|
||||
if (res == CURLE_OK) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Fallback on old and deprecated CURLINFO_LASTSOCKET
|
||||
long socket;
|
||||
res = curl_easy_getinfo(_easy, CURLINFO_LASTSOCKET, &socket);
|
||||
if (res == CURLE_OK) {
|
||||
// curl_socket_t is an int or a SOCKET (Win32) which is a UINT_PTR
|
||||
// A cast should be safe enough as long fits in it
|
||||
_socket = (curl_socket_t)socket;
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
warning("libcurl: Failed to extract socket: %s", curl_easy_strerror(res));
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user