Skip to content

Commit 4e06241

Browse files
peffdscho
authored andcommitted
curl: fix integer variable typechecks with curl_easy_setopt()
As discussed in the previous commit, 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. That patch fixed integer constants by adding an "L". This one deals with actual variables. Arguably these variables could just be declared as "long" in the first place. But it's actually kind of awkward due to other code which uses them: - port is conceptually a short, and we even call htons() on it (though weirdly it is defined as a regular int). - ssl_verify is conceptually a bool, and we assign to it from git_config_bool(). So I think we could probably switch these out for longs without hurting anything, but it just feels a bit weird. Doubly so because if you don't set USE_CURL_FOR_IMAP_SEND set, then the current types are fine! So let's just cast these to longs in the curl calls, which makes what's going on obvious. There aren't that many spots to modify (and as you can see from the context, we already have some similar casts). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3f3bea5 commit 4e06241

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

0 commit comments

Comments
 (0)