Skip to contentSkip to conversation

erofs-utils: s3: use CURLINFO_CONTENT_LENGTH_DOWNLOAD_T if possible

PATCH New Gao Xiang 1 participant 1 message Jun 3

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: s3: use CURLINFO_CONTENT_LENGTH_DOWNLOAD_T if possible

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,
      |         ^~~
---
 lib/remotes/s3.c | 8 ++++++++
 1 file changed, 8 insertions(+)
lib/remotes/s3.c +8 -0
index 870e0971b6ee..245efe5c77d8 100644
@@ -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;
Signature · 1 line
2.43.5