Skip to content

Commit 7aed048

Browse files
authored
Replace deprecated CURLINFO_CONTENT_LENGTH_DOWNLOAD (#8659)
* Replace deprecated CURLINFO_CONTENT_LENGTH_DOWNLOAD * Force CURL > 7.55.0
1 parent 79800bd commit 7aed048

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,9 @@ message (STATUS "Searching dependent libraries. This may take a few minutes...")
139139
find_package (NETCDF REQUIRED)
140140
include_directories (${NETCDF_INCLUDE_DIR})
141141

142-
# libcurl is required since 5.4
143-
find_package (CURL REQUIRED)
142+
# libcurl is required since GMT 5.4
143+
# At least version 7.55.0 is needed for src/gmt_remote.c
144+
find_package (CURL 7.55.0 REQUIRED)
144145
include_directories (${CURL_INCLUDE_DIRS})
145146
list (APPEND GMT_OPTIONAL_LIBRARIES ${CURL_LIBRARIES})
146147
set (CURL_LIBRARY ${CURL_LIBRARIES} CACHE INTERNAL "")

src/gmt_remote.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ GMT_LOCAL size_t gmtremote_skip_large_files (struct GMT_CTRL *GMT, char * URL, s
648648
/* Get the remote file's size and if too large we refuse to download */
649649
CURL *curl = NULL;
650650
CURLcode res;
651-
double filesize = 0.0;
651+
curl_off_t filesize = 0;
652652
size_t action = 0;
653653
char curl_useragent[GMT_LEN64];
654654

@@ -677,10 +677,10 @@ GMT_LOCAL size_t gmtremote_skip_large_files (struct GMT_CTRL *GMT, char * URL, s
677677
res = curl_easy_perform (curl);
678678

679679
if ((res = curl_easy_perform (curl)) == CURLE_OK) {
680-
res = curl_easy_getinfo (curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &filesize);
680+
res = curl_easy_getinfo (curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD_T, &filesize);
681681
if ((res == CURLE_OK) && (filesize > 0.0)) { /* Got the size */
682682
GMT_Report (GMT->parent, GMT_MSG_INFORMATION, "Remote file %s: Size is %0.0f bytes\n", URL, filesize);
683-
action = (filesize < (double)limit) ? 0 : (size_t)filesize;
683+
action = ((size_t)filesize < limit) ? 0 : (size_t)filesize;
684684
}
685685
}
686686
else /* We failed */

0 commit comments

Comments
 (0)