Skip to content

Commit

Permalink
return type for curl_easy_getinfo() must be the one documented by lib…
Browse files Browse the repository at this point in the history
…curl. 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
  • Loading branch information
patrickbr committed Oct 9, 2023
1 parent 6306fb6 commit 8359721
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/qlever-petrimaps/GeomCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion src/qlever-petrimaps/GeomCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/qlever-petrimaps/Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 8359721

Please sign in to comment.