Skip to content

Commit ef9ee38

Browse files
dschogitster
authored andcommitted
curl: pass long values where expected
A set of patches posted by Jeff King earlier covered some fallouts coming from new typecheck warnings cURL 8.14.0. Here are to fix some more instances of the same new compile errors observed in the `osx-gcc` job of Git's CI builds. Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c807604 commit ef9ee38

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
@@ -1540,9 +1540,9 @@ struct active_request_slot *get_active_slot(void)
15401540
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, NULL);
15411541
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, NULL);
15421542
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, -1L);
1543-
curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0);
1544-
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
1545-
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1);
1543+
curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0L);
1544+
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1L);
1545+
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1L);
15461546
curl_easy_setopt(slot->curl, CURLOPT_RANGE, NULL);
15471547

15481548
/*
@@ -1551,9 +1551,9 @@ struct active_request_slot *get_active_slot(void)
15511551
* HTTP_FOLLOW_* cases themselves.
15521552
*/
15531553
if (http_follow_config == HTTP_FOLLOW_ALWAYS)
1554-
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1);
1554+
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1L);
15551555
else
1556-
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 0);
1556+
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 0L);
15571557

15581558
curl_easy_setopt(slot->curl, CURLOPT_IPRESOLVE, git_curl_ipresolve);
15591559
curl_easy_setopt(slot->curl, CURLOPT_HTTPAUTH, http_auth_methods);
@@ -2120,12 +2120,12 @@ static int http_request(const char *url,
21202120
int ret;
21212121

21222122
slot = get_active_slot();
2123-
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
2123+
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1L);
21242124

21252125
if (!result) {
2126-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 1);
2126+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 1L);
21272127
} else {
2128-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
2128+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0L);
21292129
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, result);
21302130

21312131
if (target == HTTP_REQUEST_FILE) {
@@ -2151,7 +2151,7 @@ static int http_request(const char *url,
21512151
strbuf_addstr(&buf, " no-cache");
21522152
if (options && options->initial_request &&
21532153
http_follow_config == HTTP_FOLLOW_INITIAL)
2154-
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1);
2154+
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1L);
21552155

21562156
headers = curl_slist_append(headers, buf.buf);
21572157

@@ -2170,7 +2170,7 @@ static int http_request(const char *url,
21702170
curl_easy_setopt(slot->curl, CURLOPT_URL, url);
21712171
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
21722172
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
2173-
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0);
2173+
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0L);
21742174

21752175
ret = run_one_slot(slot, &results);
21762176

@@ -2750,7 +2750,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
27502750
freq->headers = object_request_headers();
27512751

27522752
curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEDATA, freq);
2753-
curl_easy_setopt(freq->slot->curl, CURLOPT_FAILONERROR, 0);
2753+
curl_easy_setopt(freq->slot->curl, CURLOPT_FAILONERROR, 0L);
27542754
curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEFUNCTION, fwrite_sha1_file);
27552755
curl_easy_setopt(freq->slot->curl, CURLOPT_ERRORBUFFER, freq->errorstr);
27562756
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)