From 835972132e222f309c8791cbf4be8588eb5c86d1 Mon Sep 17 00:00:00 2001 From: Patrick Brosi Date: Mon, 9 Oct 2023 17:00:03 +0200 Subject: [PATCH] return type for curl_easy_getinfo() must be the one documented by libcurl. For HTTP_STATUS, a long pointer is expected. Previously, we used int here. If int is 32 bit, and long is 64 bit (which is the case on my machine), a pointer to 4 bytes is filled with 8 bytes by libcurl --- src/qlever-petrimaps/GeomCache.cpp | 8 ++++---- src/qlever-petrimaps/GeomCache.h | 3 ++- src/qlever-petrimaps/Misc.cpp | 4 ++-- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/qlever-petrimaps/GeomCache.cpp b/src/qlever-petrimaps/GeomCache.cpp index 3831222..c4a667e 100644 --- a/src/qlever-petrimaps/GeomCache.cpp +++ b/src/qlever-petrimaps/GeomCache.cpp @@ -477,7 +477,7 @@ size_t GeomCache::requestSize() { curl_easy_setopt(_curl, CURLOPT_ACCEPT_ENCODING, ""); res = curl_easy_perform(_curl); - int httpCode = 0; + long httpCode = 0; curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &httpCode); curl_slist_free_all(headers); @@ -543,7 +543,7 @@ void GeomCache::requestPart(size_t offset) { curl_easy_setopt(_curl, CURLOPT_ACCEPT_ENCODING, ""); res = curl_easy_perform(_curl); - int httpCode = 0; + long httpCode = 0; curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &httpCode); curl_slist_free_all(headers); @@ -708,7 +708,7 @@ void GeomCache::requestIds() { curl_easy_setopt(_curl, CURLOPT_ACCEPT_ENCODING, ""); curl_easy_perform(_curl); - int httpCode = 0; + long httpCode = 0; curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &httpCode); curl_slist_free_all(headers); @@ -1100,7 +1100,7 @@ std::string GeomCache::requestIndexHash() { return ""; } - int httpCode = 0; + long httpCode = 0; curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &httpCode); if (httpCode != 200) { diff --git a/src/qlever-petrimaps/GeomCache.h b/src/qlever-petrimaps/GeomCache.h index 71072ec..bdaa08b 100644 --- a/src/qlever-petrimaps/GeomCache.h +++ b/src/qlever-petrimaps/GeomCache.h @@ -24,7 +24,8 @@ class GeomCache { GeomCache() : _backendUrl(""), _curl(0) {} explicit GeomCache(const std::string& backendUrl) : _backendUrl(backendUrl), - _curl(curl_easy_init()) {} + _curl(curl_easy_init()) { + } GeomCache& operator=(GeomCache&& o) { _backendUrl = o._backendUrl; diff --git a/src/qlever-petrimaps/Misc.cpp b/src/qlever-petrimaps/Misc.cpp index a364c98..7e3378c 100644 --- a/src/qlever-petrimaps/Misc.cpp +++ b/src/qlever-petrimaps/Misc.cpp @@ -40,7 +40,7 @@ void RequestReader::requestIds(const std::string& query) { curl_easy_setopt(_curl, CURLOPT_ERRORBUFFER, errbuf); res = curl_easy_perform(_curl); - int httpCode = 0; + long httpCode = 0; curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &httpCode); curl_slist_free_all(headers); @@ -110,7 +110,7 @@ void RequestReader::requestRows(const std::string& query, curl_easy_setopt(_curl, CURLOPT_ERRORBUFFER, errbuf); res = curl_easy_perform(_curl); - int httpCode = 0; + long httpCode = 0; curl_easy_getinfo(_curl, CURLINFO_RESPONSE_CODE, &httpCode); curl_slist_free_all(headers);