[PATCH] erofs-utils: s3: use CURLINFO_CONTENT_LENGTH_DOWNLOAD_T if possible

Gao Xiang <[email protected]>
Newsgroups org.ozlabs.lists.linux-erofs
Message-ID <[email protected]>
To resolve the following warning:

remotes/s3.c: In function 's3erofs_get_object_size':
remotes/s3.c:1352:9: warning: 'CURLINFO_CONTENT_LENGTH_DOWNLOAD' is deprecated: since 7.55.0. Use CURLINFO_CONTENT_LENGTH_DOWNLOAD_T [-Wdeprecated-declarations]
 1352 |         ret = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD,
      |         ^~~

Signed-off-by: Gao Xiang <[email protected]>
---
 lib/remotes/s3.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/lib/remotes/s3.c b/lib/remotes/s3.c
index 870e0971b6ee..245efe5c77d8 100644
--- a/lib/remotes/s3.c
+++ b/lib/remotes/s3.c
@@ -1325,7 +1325,11 @@ static int s3erofs_get_object_size(struct s3erofs_vfile *s3vf)
 	struct erofs_s3 *s3 = s3vf->s3;
 	CURL *curl = s3->easy_curl;
 	long http_code = 0;
+#if (LIBCURL_VERSION_NUM >= 0x073700)
+	curl_off_t content_length;
+#else
 	double content_length = 0;
+#endif
 	int ret;
 
 	ret = s3erofs_prepare_url(&req, s3->endpoint, s3vf->bucket,
@@ -1349,7 +1353,11 @@ static int s3erofs_get_object_size(struct s3erofs_vfile *s3vf)
 		return -EIO;
 	}
 
+#if (LIBCURL_VERSION_NUM >= 0x073700)
+	ret = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T,
+#else
 	ret = curl_easy_getinfo(curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD,
+#endif
 				&content_length);
 	if (ret != CURLE_OK)
 		return -EIO;
-- 
2.43.5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.