Skip to content

Commit 9022eb3

Browse files
committed
Merge branch 'build-fixes'
The `maint-2.46` branch has not seen any build fixes. This resulted in a ton of build errors in the CI builds. Backported fixes help that. Signed-off-by: Johannes Schindelin <[email protected]>
2 parents 71f887d + 3f6ae18 commit 9022eb3

File tree

5 files changed

+75
-80
lines changed

5 files changed

+75
-80
lines changed

http-push.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static char *xml_entities(const char *s)
194194
static void curl_setup_http_get(CURL *curl, const char *url,
195195
const char *custom_req)
196196
{
197-
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1);
197+
curl_easy_setopt(curl, CURLOPT_HTTPGET, 1L);
198198
curl_easy_setopt(curl, CURLOPT_URL, url);
199199
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, custom_req);
200200
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, fwrite_null);
@@ -204,17 +204,17 @@ static void curl_setup_http(CURL *curl, const char *url,
204204
const char *custom_req, struct buffer *buffer,
205205
curl_write_callback write_fn)
206206
{
207-
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
207+
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
208208
curl_easy_setopt(curl, CURLOPT_URL, url);
209209
curl_easy_setopt(curl, CURLOPT_INFILE, buffer);
210210
curl_easy_setopt(curl, CURLOPT_INFILESIZE, buffer->buf.len);
211211
curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread_buffer);
212212
curl_easy_setopt(curl, CURLOPT_SEEKFUNCTION, seek_buffer);
213213
curl_easy_setopt(curl, CURLOPT_SEEKDATA, buffer);
214214
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_fn);
215-
curl_easy_setopt(curl, CURLOPT_NOBODY, 0);
215+
curl_easy_setopt(curl, CURLOPT_NOBODY, 0L);
216216
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, custom_req);
217-
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
217+
curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L);
218218
}
219219

220220
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
@@ -744,7 +744,7 @@ static int has_proxy_cert_password(void)
744744
#ifdef GITCURL_HAVE_CURLOPT_TCP_KEEPALIVE
745745
static void set_curl_keepalive(CURL *c)
746746
{
747-
curl_easy_setopt(c, CURLOPT_TCP_KEEPALIVE, 1);
747+
curl_easy_setopt(c, CURLOPT_TCP_KEEPALIVE, 1L);
748748
}
749749

750750
#else
@@ -1071,13 +1071,13 @@ static CURL *get_curl_handle(void)
10711071
die("curl_easy_init failed");
10721072

10731073
if (!curl_ssl_verify) {
1074-
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0);
1075-
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 0);
1074+
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 0L);
1075+
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 0L);
10761076
} else {
10771077
/* Verify authenticity of the peer's certificate */
1078-
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 1);
1078+
curl_easy_setopt(result, CURLOPT_SSL_VERIFYPEER, 1L);
10791079
/* The name in the cert must match whom we tried to connect */
1080-
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2);
1080+
curl_easy_setopt(result, CURLOPT_SSL_VERIFYHOST, 2L);
10811081
}
10821082

10831083
#ifdef GIT_CURL_HAVE_CURL_HTTP_VERSION_2
@@ -1192,8 +1192,8 @@ static CURL *get_curl_handle(void)
11921192
curl_low_speed_time);
11931193
}
11941194

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

11981198
#ifdef GIT_CURL_HAVE_CURLOPT_PROTOCOLS_STR
11991199
{
@@ -1226,7 +1226,7 @@ static CURL *get_curl_handle(void)
12261226
user_agent ? user_agent : git_user_agent());
12271227

12281228
if (curl_ftp_no_epsv)
1229-
curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);
1229+
curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0L);
12301230

12311231
if (curl_ssl_try)
12321232
curl_easy_setopt(result, CURLOPT_USE_SSL, CURLUSESSL_TRY);
@@ -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);
@@ -1588,9 +1588,9 @@ struct active_request_slot *get_active_slot(void)
15881588
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, NULL);
15891589
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, NULL);
15901590
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, -1L);
1591-
curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0);
1592-
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
1593-
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1);
1591+
curl_easy_setopt(slot->curl, CURLOPT_UPLOAD, 0L);
1592+
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1L);
1593+
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 1L);
15941594
curl_easy_setopt(slot->curl, CURLOPT_RANGE, NULL);
15951595

15961596
/*
@@ -1599,9 +1599,9 @@ struct active_request_slot *get_active_slot(void)
15991599
* HTTP_FOLLOW_* cases themselves.
16001600
*/
16011601
if (http_follow_config == HTTP_FOLLOW_ALWAYS)
1602-
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1);
1602+
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1L);
16031603
else
1604-
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 0);
1604+
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 0L);
16051605

16061606
curl_easy_setopt(slot->curl, CURLOPT_IPRESOLVE, git_curl_ipresolve);
16071607
curl_easy_setopt(slot->curl, CURLOPT_HTTPAUTH, http_auth_methods);
@@ -2170,12 +2170,12 @@ static int http_request(const char *url,
21702170
int ret;
21712171

21722172
slot = get_active_slot();
2173-
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1);
2173+
curl_easy_setopt(slot->curl, CURLOPT_HTTPGET, 1L);
21742174

21752175
if (!result) {
2176-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 1);
2176+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 1L);
21772177
} else {
2178-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
2178+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0L);
21792179
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, result);
21802180

21812181
if (target == HTTP_REQUEST_FILE) {
@@ -2201,7 +2201,7 @@ static int http_request(const char *url,
22012201
strbuf_addstr(&buf, " no-cache");
22022202
if (options && options->initial_request &&
22032203
http_follow_config == HTTP_FOLLOW_INITIAL)
2204-
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1);
2204+
curl_easy_setopt(slot->curl, CURLOPT_FOLLOWLOCATION, 1L);
22052205

22062206
headers = curl_slist_append(headers, buf.buf);
22072207

@@ -2220,7 +2220,7 @@ static int http_request(const char *url,
22202220
curl_easy_setopt(slot->curl, CURLOPT_URL, url);
22212221
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
22222222
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
2223-
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0);
2223+
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0L);
22242224

22252225
ret = run_one_slot(slot, &results);
22262226

@@ -2782,7 +2782,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
27822782
freq->headers = object_request_headers();
27832783

27842784
curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEDATA, freq);
2785-
curl_easy_setopt(freq->slot->curl, CURLOPT_FAILONERROR, 0);
2785+
curl_easy_setopt(freq->slot->curl, CURLOPT_FAILONERROR, 0L);
27862786
curl_easy_setopt(freq->slot->curl, CURLOPT_WRITEFUNCTION, fwrite_sha1_file);
27872787
curl_easy_setopt(freq->slot->curl, CURLOPT_ERRORBUFFER, freq->errorstr);
27882788
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
@@ -1414,7 +1414,7 @@ static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
14141414

14151415
curl_easy_setopt(curl, CURLOPT_URL, path.buf);
14161416
strbuf_release(&path);
1417-
curl_easy_setopt(curl, CURLOPT_PORT, srvc->port);
1417+
curl_easy_setopt(curl, CURLOPT_PORT, (long)srvc->port);
14181418

14191419
if (srvc->auth_method) {
14201420
#ifndef GIT_CURL_HAVE_CURLOPT_LOGIN_OPTIONS
@@ -1431,8 +1431,8 @@ static CURL *setup_curl(struct imap_server_conf *srvc, struct credential *cred)
14311431
if (!srvc->use_ssl)
14321432
curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_TRY);
14331433

1434-
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, srvc->ssl_verify);
1435-
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, srvc->ssl_verify);
1434+
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, (long)srvc->ssl_verify);
1435+
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, (long)srvc->ssl_verify);
14361436

14371437
curl_easy_setopt(curl, CURLOPT_READFUNCTION, fread_buffer);
14381438

object-file.c

Lines changed: 38 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -44,43 +44,40 @@
4444
/* The maximum size for an object header. */
4545
#define MAX_HEADER_LEN 32
4646

47-
48-
#define EMPTY_TREE_SHA1_BIN_LITERAL \
49-
"\x4b\x82\x5d\xc6\x42\xcb\x6e\xb9\xa0\x60" \
50-
"\xe5\x4b\xf8\xd6\x92\x88\xfb\xee\x49\x04"
51-
#define EMPTY_TREE_SHA256_BIN_LITERAL \
52-
"\x6e\xf1\x9b\x41\x22\x5c\x53\x69\xf1\xc1" \
53-
"\x04\xd4\x5d\x8d\x85\xef\xa9\xb0\x57\xb5" \
54-
"\x3b\x14\xb4\xb9\xb9\x39\xdd\x74\xde\xcc" \
55-
"\x53\x21"
56-
57-
#define EMPTY_BLOB_SHA1_BIN_LITERAL \
58-
"\xe6\x9d\xe2\x9b\xb2\xd1\xd6\x43\x4b\x8b" \
59-
"\x29\xae\x77\x5a\xd8\xc2\xe4\x8c\x53\x91"
60-
#define EMPTY_BLOB_SHA256_BIN_LITERAL \
61-
"\x47\x3a\x0f\x4c\x3b\xe8\xa9\x36\x81\xa2" \
62-
"\x67\xe3\xb1\xe9\xa7\xdc\xda\x11\x85\x43" \
63-
"\x6f\xe1\x41\xf7\x74\x91\x20\xa3\x03\x72" \
64-
"\x18\x13"
65-
6647
static const struct object_id empty_tree_oid = {
67-
.hash = EMPTY_TREE_SHA1_BIN_LITERAL,
48+
.hash = {
49+
0x4b, 0x82, 0x5d, 0xc6, 0x42, 0xcb, 0x6e, 0xb9, 0xa0, 0x60,
50+
0xe5, 0x4b, 0xf8, 0xd6, 0x92, 0x88, 0xfb, 0xee, 0x49, 0x04
51+
},
6852
.algo = GIT_HASH_SHA1,
6953
};
7054
static const struct object_id empty_blob_oid = {
71-
.hash = EMPTY_BLOB_SHA1_BIN_LITERAL,
55+
.hash = {
56+
0xe6, 0x9d, 0xe2, 0x9b, 0xb2, 0xd1, 0xd6, 0x43, 0x4b, 0x8b,
57+
0x29, 0xae, 0x77, 0x5a, 0xd8, 0xc2, 0xe4, 0x8c, 0x53, 0x91
58+
},
7259
.algo = GIT_HASH_SHA1,
7360
};
7461
static const struct object_id null_oid_sha1 = {
7562
.hash = {0},
7663
.algo = GIT_HASH_SHA1,
7764
};
7865
static const struct object_id empty_tree_oid_sha256 = {
79-
.hash = EMPTY_TREE_SHA256_BIN_LITERAL,
66+
.hash = {
67+
0x6e, 0xf1, 0x9b, 0x41, 0x22, 0x5c, 0x53, 0x69, 0xf1, 0xc1,
68+
0x04, 0xd4, 0x5d, 0x8d, 0x85, 0xef, 0xa9, 0xb0, 0x57, 0xb5,
69+
0x3b, 0x14, 0xb4, 0xb9, 0xb9, 0x39, 0xdd, 0x74, 0xde, 0xcc,
70+
0x53, 0x21
71+
},
8072
.algo = GIT_HASH_SHA256,
8173
};
8274
static const struct object_id empty_blob_oid_sha256 = {
83-
.hash = EMPTY_BLOB_SHA256_BIN_LITERAL,
75+
.hash = {
76+
0x47, 0x3a, 0x0f, 0x4c, 0x3b, 0xe8, 0xa9, 0x36, 0x81, 0xa2,
77+
0x67, 0xe3, 0xb1, 0xe9, 0xa7, 0xdc, 0xda, 0x11, 0x85, 0x43,
78+
0x6f, 0xe1, 0x41, 0xf7, 0x74, 0x91, 0x20, 0xa3, 0x03, 0x72,
79+
0x18, 0x13
80+
},
8481
.algo = GIT_HASH_SHA256,
8582
};
8683
static const struct object_id null_oid_sha256 = {
@@ -313,30 +310,28 @@ int hash_algo_by_length(int len)
313310
* to write them into the object store (e.g. a browse-only
314311
* application).
315312
*/
316-
static struct cached_object {
313+
static struct cached_object_entry {
317314
struct object_id oid;
318-
enum object_type type;
319-
const void *buf;
320-
unsigned long size;
315+
struct cached_object {
316+
enum object_type type;
317+
const void *buf;
318+
unsigned long size;
319+
} value;
321320
} *cached_objects;
322321
static int cached_object_nr, cached_object_alloc;
323322

324-
static struct cached_object empty_tree = {
325-
.oid = {
326-
.hash = EMPTY_TREE_SHA1_BIN_LITERAL,
327-
},
328-
.type = OBJ_TREE,
329-
.buf = "",
330-
};
331-
332-
static struct cached_object *find_cached_object(const struct object_id *oid)
323+
static const struct cached_object *find_cached_object(const struct object_id *oid)
333324
{
325+
static const struct cached_object empty_tree = {
326+
.type = OBJ_TREE,
327+
.buf = "",
328+
};
334329
int i;
335-
struct cached_object *co = cached_objects;
330+
const struct cached_object_entry *co = cached_objects;
336331

337332
for (i = 0; i < cached_object_nr; i++, co++) {
338333
if (oideq(&co->oid, oid))
339-
return co;
334+
return &co->value;
340335
}
341336
if (oideq(oid, the_hash_algo->empty_tree))
342337
return &empty_tree;
@@ -1627,7 +1622,7 @@ static int do_oid_object_info_extended(struct repository *r,
16271622
struct object_info *oi, unsigned flags)
16281623
{
16291624
static struct object_info blank_oi = OBJECT_INFO_INIT;
1630-
struct cached_object *co;
1625+
const struct cached_object *co;
16311626
struct pack_entry e;
16321627
int rtype;
16331628
const struct object_id *real = oid;
@@ -1849,7 +1844,7 @@ int oid_object_info(struct repository *r,
18491844
int pretend_object_file(void *buf, unsigned long len, enum object_type type,
18501845
struct object_id *oid)
18511846
{
1852-
struct cached_object *co;
1847+
struct cached_object_entry *co;
18531848
char *co_buf;
18541849

18551850
hash_object_file(the_hash_algo, buf, len, type, oid);
@@ -1858,11 +1853,11 @@ int pretend_object_file(void *buf, unsigned long len, enum object_type type,
18581853
return 0;
18591854
ALLOC_GROW(cached_objects, cached_object_nr + 1, cached_object_alloc);
18601855
co = &cached_objects[cached_object_nr++];
1861-
co->size = len;
1862-
co->type = type;
1856+
co->value.size = len;
1857+
co->value.type = type;
18631858
co_buf = xmalloc(len);
18641859
memcpy(co_buf, buf, len);
1865-
co->buf = co_buf;
1860+
co->value.buf = co_buf;
18661861
oidcpy(&co->oid, oid);
18671862
return 0;
18681863
}

remote-curl.c

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

879-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
880-
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
879+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0L);
880+
curl_easy_setopt(slot->curl, CURLOPT_POST, 1L);
881881
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
882882
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, NULL);
883883
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDS, "0000");
884-
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4);
884+
curl_easy_setopt(slot->curl, CURLOPT_POSTFIELDSIZE, 4L);
885885
curl_easy_setopt(slot->curl, CURLOPT_HTTPHEADER, headers);
886886
curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite_buffer);
887887
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &buf);
@@ -969,8 +969,8 @@ static int post_rpc(struct rpc_state *rpc, int stateless_connect, int flush_rece
969969

970970
slot = get_active_slot();
971971

972-
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
973-
curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
972+
curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0L);
973+
curl_easy_setopt(slot->curl, CURLOPT_POST, 1L);
974974
curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
975975
curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
976976

@@ -1057,7 +1057,7 @@ static int post_rpc(struct rpc_state *rpc, int stateless_connect, int flush_rece
10571057
rpc_in_data.check_pktline = stateless_connect;
10581058
memset(&rpc_in_data.pktline_state, 0, sizeof(rpc_in_data.pktline_state));
10591059
curl_easy_setopt(slot->curl, CURLOPT_WRITEDATA, &rpc_in_data);
1060-
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0);
1060+
curl_easy_setopt(slot->curl, CURLOPT_FAILONERROR, 0L);
10611061

10621062

10631063
rpc->any_written = 0;

0 commit comments

Comments
 (0)