Skip to content

Commit cc01b3e

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 4f82bdf commit cc01b3e

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

http-push.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -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);

remote-curl.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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)