Skip to content

Commit 6edc160

Browse files
peffdscho
authored andcommitted
curl: fix symbolic constant typechecks with curl_easy_setopt()
As with the previous two commits, we should be passing long integers, not regular ones, to curl_easy_setopt(), and compiling against curl 8.14 loudly complains if we don't. This patch catches the remaining cases, which are ones where we pass curl's own symbolic constants. We'll cast them to long manually in each call. It seems kind of weird to me that curl doesn't define these constants as longs, since the point of them is to pass to curl_easy_setopt(). But in the curl documentation and examples, they clearly show casting them as part of the setopt calls. It may be that there is some reason not to push the type into the macro, like backwards compatibility. I didn't dig, as it doesn't really matter: we have to follow what existing curl versions ask for anyway. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4e06241 commit 6edc160

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

http.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,7 +1193,7 @@ static CURL *get_curl_handle(void)
11931193
}
11941194

11951195
curl_easy_setopt(result, CURLOPT_MAXREDIRS, 20L);
1196-
curl_easy_setopt(result, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL);
1196+
curl_easy_setopt(result, CURLOPT_POSTREDIR, (long)CURL_REDIR_POST_ALL);
11971197

11981198
#ifdef GIT_CURL_HAVE_CURLOPT_PROTOCOLS_STR
11991199
{
@@ -1268,19 +1268,19 @@ static CURL *get_curl_handle(void)
12681268

12691269
if (starts_with(curl_http_proxy, "socks5h"))
12701270
curl_easy_setopt(result,
1271-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME);
1271+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS5_HOSTNAME);
12721272
else if (starts_with(curl_http_proxy, "socks5"))
12731273
curl_easy_setopt(result,
1274-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
1274+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS5);
12751275
else if (starts_with(curl_http_proxy, "socks4a"))
12761276
curl_easy_setopt(result,
1277-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A);
1277+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS4A);
12781278
else if (starts_with(curl_http_proxy, "socks"))
12791279
curl_easy_setopt(result,
1280-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
1280+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS4);
12811281
#ifdef GIT_CURL_HAVE_CURLOPT_PROXY_KEYPASSWD
12821282
else if (starts_with(curl_http_proxy, "https")) {
1283-
curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
1283+
curl_easy_setopt(result, CURLOPT_PROXYTYPE, (long)CURLPROXY_HTTPS);
12841284

12851285
if (http_proxy_ssl_cert)
12861286
curl_easy_setopt(result, CURLOPT_PROXY_SSLCERT, http_proxy_ssl_cert);

0 commit comments

Comments
 (0)