Fixed curl type warnings - callback function signature and timeout parameter casting

This commit is contained in:
Laan Tungir 2025-08-15 09:12:55 -04:00
parent c569c0c346
commit f50384962d
4 changed files with 4 additions and 4 deletions

View File

@ -1 +1 @@
0.1.31 0.1.32

Binary file not shown.

View File

@ -249,7 +249,7 @@ typedef struct {
/** /**
* Callback function for curl to write HTTP response data * Callback function for curl to write HTTP response data
*/ */
static size_t nip05_write_callback(void* contents, size_t size, size_t nmemb, nip05_http_response_t* response) { static size_t nip05_write_callback(char* contents, size_t size, size_t nmemb, nip05_http_response_t* response) {
size_t total_size = size * nmemb; size_t total_size = size * nmemb;
// Check if we need to expand the buffer // Check if we need to expand the buffer
@ -346,7 +346,7 @@ static int nip05_http_get(const char* url, int timeout_seconds, char** response_
curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, nip05_write_callback); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, nip05_write_callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout_seconds > 0 ? timeout_seconds : NIP05_DEFAULT_TIMEOUT); curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)(timeout_seconds > 0 ? timeout_seconds : NIP05_DEFAULT_TIMEOUT));
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 0L); // NIP-05 forbids redirects curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 0L); // NIP-05 forbids redirects
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 2L);
@ -935,7 +935,7 @@ int nostr_nip11_fetch_relay_info(const char* relay_url, nostr_relay_info_t** inf
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, nip05_write_callback); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, nip05_write_callback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response); curl_easy_setopt(curl, CURLOPT_WRITEDATA, &response);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout_seconds > 0 ? timeout_seconds : NIP11_DEFAULT_TIMEOUT); curl_easy_setopt(curl, CURLOPT_TIMEOUT, (long)(timeout_seconds > 0 ? timeout_seconds : NIP11_DEFAULT_TIMEOUT));
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); // NIP-11 allows redirects curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); // NIP-11 allows redirects
curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3L); curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1L);

Binary file not shown.