Skip to content

Commit 6792aa8

Browse files
committed
curl: pass long values where expected
Repeat after me: `int` is not the same as `long`. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 2b65033 commit 6792aa8

File tree

4 files changed

+37
-37
lines changed

4 files changed

+37
-37
lines changed

http-push.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static char *xml_entities(const char *s)
195195
static void curl_setup_http_get(CURL *curl, const char *url,
196196
const char *custom_req)
197197
{
198-
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
198+
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1l);
199199
curl_easy_setopt(curl, CURLOPT_URL, url);
200200
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, custom_req);
201201
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite_null);
@@ -205,17 +205,17 @@ static void curl_setup_http(CURL *curl, const char *url,
205205
const char *custom_req, struct buffer *buffer,
206206
curl_write_callback write_fn)
207207
{
208-
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
208+
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1l);
209209
curl_easy_setopt(curl, CURLOPT_URL, url);
210210
curl_easy_setopt(curl, CURLOPT_INFILE, buffer);
211211
curl_easy_setopt(curl, CURLOPT_INFILESIZE, buffer->buf.len);
212212
curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread_buffer);
213213
curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, seek_buffer);
214214
curl_easy_setopt(curl, CURLOPT_SEEKDATA, buffer);
215215
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_fn);
216-
curl_easy_setopt(curl, CURLOPT_NOBODY, 0);
216+
curl_easy_setopt(curl, CURLOPT_NOBODY, 0l);
217217
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, custom_req);
218-
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
218+
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1l);
219219
}
220220

221221
static struct curl_slist *get_dav_token_headers(struct remote_lock *lock, enum dav_header_flag options)

http.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,13 +1044,13 @@ static CURL *get_curl_handle(void)
10441044
die("curl_easy_init failed");
10451045

10461046
if (!curl_ssl_verify) {
1047-
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0);
1048-
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 0);
1047+
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0l);
1048+
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 0l);
10491049
} else {
10501050
/* Verify authenticity of the peer's certificate */
1051-
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 1);
1051+
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 1l);
10521052
/* The name in the cert must match whom we tried to connect */
1053-
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2);
1053+
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2l);
10541054
}
10551055

10561056
if (curl_http_version) {
@@ -1153,8 +1153,8 @@ static CURL *get_curl_handle(void)
11531153
curl_low_speed_time);
11541154
}
11551155

1156-
curl_easy_setopt(result, CURLOPT_MAXREDIRS, 20);
1157-
curl_easy_setopt(result, CURLOPT_POSTREDIR, CURL_REDIR_POST_ALL);
1156+
curl_easy_setopt(result, CURLOPT_MAXREDIRS, 20l);
1157+
curl_easy_setopt(result, CURLOPT_POSTREDIR, (long)CURL_REDIR_POST_ALL);
11581158

11591159
#ifdef GIT_CURL_HAVE_CURLOPT_PROTOCOLS_STR
11601160
{
@@ -1187,7 +1187,7 @@ static CURL *get_curl_handle(void)
11871187
user_agent ? user_agent : git_user_agent());
11881188

11891189
if (curl_ftp_no_epsv)
1190-
curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);
1190+
curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0l);
11911191

11921192
if (curl_ssl_try)
11931193
curl_easy_setopt(result, CURLOPT_USE_SSL, CURLUSESSL_TRY);
@@ -1229,18 +1229,18 @@ static CURL *get_curl_handle(void)
12291229

12301230
if (starts_with(curl_http_proxy, "socks5h"))
12311231
curl_easy_setopt(result,
1232-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5_HOSTNAME);
1232+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS5_HOSTNAME);
12331233
else if (starts_with(curl_http_proxy, "socks5"))
12341234
curl_easy_setopt(result,
1235-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
1235+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS5);
12361236
else if (starts_with(curl_http_proxy, "socks4a"))
12371237
curl_easy_setopt(result,
1238-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4A);
1238+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS4A);
12391239
else if (starts_with(curl_http_proxy, "socks"))
12401240
curl_easy_setopt(result,
1241-
CURLOPT_PROXYTYPE, CURLPROXY_SOCKS4);
1241+
CURLOPT_PROXYTYPE, (long)CURLPROXY_SOCKS4);
12421242
else if (starts_with(curl_http_proxy, "https")) {
1243-
curl_easy_setopt(result, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
1243+
curl_easy_setopt(result, CURLOPT_PROXYTYPE, (long)CURLPROXY_HTTPS);
12441244

12451245
if (http_proxy_ssl_cert)
12461246
curl_easy_setopt(result, CURLOPT_PROXY_SSLCERT, http_proxy_ssl_cert);
@@ -1290,7 +1290,7 @@ static CURL *get_curl_handle(void)
12901290
}
12911291
init_curl_proxy_auth(result);
12921292

1293-
curl_easy_setopt(result, CURLOPT_TCP_KEEPALIVE, 1);
1293+
curl_easy_setopt(result, CURLOPT_TCP_KEEPALIVE, 1l);
12941294

12951295
if (curl_tcp_keepidle > -1)
12961296
curl_easy_setopt(result, CURLOPT_TCP_KEEPIDLE,
@@ -1576,9 +1576,9 @@ struct active_request_slot *get_active_slot(void)
15761576
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, NULL);
15771577
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, NULL);
15781578
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, -1L);
1579-
curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0);
1580-
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
1581-
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1);
1579+
curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0l);
1580+
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1l);
1581+
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1l);
15821582
curl_easy_setopt(slot->curl, CURLOPT_RANGE, NULL);
15831583

15841584
/*
@@ -1587,9 +1587,9 @@ struct active_request_slot *get_active_slot(void)
15871587
* HTTP_FOLLOW_* cases themselves.
15881588
*/
15891589
if (http_follow_config == HTTP_FOLLOW_ALWAYS)
1590-
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1);
1590+
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1l);
15911591
else
1592-
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 0);
1592+
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 0l);
15931593

15941594
curl_easy_setopt(slot->curl, CURLOPT_IPRESOLVE, git_curl_ipresolve);
15951595
curl_easy_setopt(slot->curl, CURLOPT_HTTPAUTH, http_auth_methods);
@@ -2156,12 +2156,12 @@ static int http_request(const char *url,
21562156
int ret;
21572157

21582158
slot = get_active_slot();
2159-
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
2159+
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1l);
21602160

21612161
if (!result) {
2162-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 1);
2162+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 1l);
21632163
} else {
2164-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
2164+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0l);
21652165
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, result);
21662166

21672167
if (target == HTTP_REQUEST_FILE) {
@@ -2187,7 +2187,7 @@ static int http_request(const char *url,
21872187
strbuf_addstr(&buf, " no-cache");
21882188
if (options && options->initial_request &&
21892189
http_follow_config == HTTP_FOLLOW_INITIAL)
2190-
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1);
2190+
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1l);
21912191

21922192
headers = curl_slist_append(headers, buf.buf);
21932193

@@ -2206,7 +2206,7 @@ static int http_request(const char *url,
22062206
curl_easy_setopt(slot->curl, CURLOPT_URL, url);
22072207
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
22082208
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
2209-
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0);
2209+
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0l);
22102210

22112211
ret = run_one_slot(slot, &results);
22122212

@@ -2786,7 +2786,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
27862786
freq->headers = object_request_headers();
27872787

27882788
curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEDATA, freq);
2789-
curl_easy_setopt(freq->slot->curl, CURLOPT_FAILONERROR, 0);
2789+
curl_easy_setopt(freq->slot->curl, CURLOPT_FAILONERROR, 0l);
27902790
curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEFUNCTION, fwrite_sha1_file);
27912791
curl_easy_setopt(freq->slot->curl, CURLOPT_ERRORBUFFER, freq->errorstr);
27922792
curl_easy_setopt(freq->slot->curl, CURLOPT_URL, freq->url);

imap-send.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,7 +1420,7 @@ static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
14201420

14211421
curl_easy_setopt(curl, CURLOPT_URL, path.buf);
14221422
strbuf_release(&path);
1423-
curl_easy_setopt(curl, CURLOPT_PORT, srvc->port);
1423+
curl_easy_setopt(curl, CURLOPT_PORT, (long)srvc->port);
14241424

14251425
if (srvc->auth_method) {
14261426
struct strbuf auth = STRBUF_INIT;
@@ -1433,8 +1433,8 @@ static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
14331433
if (!srvc->use_ssl)
14341434
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_TRY);
14351435

1436-
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, srvc->ssl_verify);
1437-
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, srvc->ssl_verify);
1436+
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, (long)srvc->ssl_verify);
1437+
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, (long)srvc->ssl_verify);
14381438

14391439
curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread_buffer);
14401440

remote-curl.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -877,12 +877,12 @@ static int probe_rpc(struct rpc_state *rpc, struct slot_results *results)
877877
headers = curl_slist_append(headers, rpc->hdr_content_type);
878878
headers = curl_slist_append(headers, rpc->hdr_accept);
879879

880-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
881-
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
880+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0l);
881+
curl_easy_setopt(slot->curl, CURLOPT_POST, 1l);
882882
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
883883
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, NULL);
884884
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, "0000");
885-
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4);
885+
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4l);
886886
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
887887
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
888888
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &buf);
@@ -970,8 +970,8 @@ static int post_rpc(struct rpc_state *rpc, int stateless_connect, int flush_rece
970970

971971
slot = get_active_slot();
972972

973-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
974-
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
973+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0l);
974+
curl_easy_setopt(slot->curl, CURLOPT_POST, 1l);
975975
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
976976
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
977977

@@ -1058,7 +1058,7 @@ static int post_rpc(struct rpc_state *rpc, int stateless_connect, int flush_rece
10581058
rpc_in_data.check_pktline = stateless_connect;
10591059
memset(&rpc_in_data.pktline_state, 0, sizeof(rpc_in_data.pktline_state));
10601060
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &rpc_in_data);
1061-
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0);
1061+
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0l);
10621062

10631063

10641064
rpc->any_written = 0;

0 commit comments

Comments
 (0)