diff options
-rw-r--r-- | src/common.h | 10 | ||||
-rw-r--r-- | src/dxvk.c | 4 | ||||
-rw-r--r-- | src/net.c | 15 | ||||
-rw-r--r-- | src/net.h | 1 | ||||
-rw-r--r-- | src/wine.c | 4 |
5 files changed, 15 insertions, 19 deletions
diff --git a/src/common.h b/src/common.h index 5916b99..a77d0a2 100644 --- a/src/common.h +++ b/src/common.h @@ -39,6 +39,16 @@ #define UNUSED #endif +#include <json.h> + +// since json-c 0.13 json_object_array_length returns a size_t +#if defined(JSON_C_MINOR_VERSION) && JSON_C_MINOR_VERSION >= 13 +#define JSON_LENGTH_TYPE size_t +#else +#define JSON_LENGTH_TYPE int +#endif + + struct MemoryStruct { uint8_t* memory; size_t size; @@ -36,7 +36,7 @@ COMMAND(dxvk, download) char* choice = argv[1]; - for (size_t i = 0; i < json_object_array_length(runner); ++i) + for (JSON_LENGTH_TYPE i = 0; i < json_object_array_length(runner); ++i) { value = json_object_array_get_idx(runner, i); json_object_object_get_ex(value, "tag_name", &temp); @@ -140,7 +140,7 @@ COMMAND(dxvk, list) int istty = isatty(STDOUT_FILENO); if (istty) puts("Installable DXVK versions:"); - for (size_t i = 0; i < json_object_array_length(runner); ++i) + for (JSON_LENGTH_TYPE i = 0; i < json_object_array_length(runner); ++i) { struct json_object* version = json_object_array_get_idx(runner, i); struct json_object* name; @@ -10,11 +10,6 @@ #include "net.h" #include "common.h" -struct progress { - TIMETYPE lastruntime; - CURL *curl; -}; - static size_t memoryCallback(void* contents, size_t size, size_t nmemb, void* userp) { size_t realsize = size * nmemb; @@ -35,14 +30,8 @@ static size_t memoryCallback(void* contents, size_t size, size_t nmemb, void* us return realsize; } -static int xferinfo(void *p, curl_off_t dltotal, curl_off_t dlnow, UNUSED curl_off_t ultotal, UNUSED curl_off_t ulnow) +static int xferinfo(UNUSED void *p, curl_off_t dltotal, curl_off_t dlnow, UNUSED curl_off_t ultotal, UNUSED curl_off_t ulnow) { - struct progress *myp = (struct progress *)p; - CURL *curl = myp->curl; - TIMETYPE curtime = 0; - - curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME_T, &curtime); - curl_off_t progress = 0; if (dltotal != 0) progress = ((float)dlnow / dltotal) * 100; @@ -58,7 +47,6 @@ struct MemoryStruct* downloadToRam(const char* URL, long noprogress) { CURL* curl_handle; CURLcode res = CURLE_OK; - struct progress prog; if (!isatty(STDERR_FILENO)) noprogress = 1L; @@ -80,7 +68,6 @@ struct MemoryStruct* downloadToRam(const char* URL, long noprogress) curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, USER_AGENT); curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1L); curl_easy_setopt(curl_handle, CURLOPT_XFERINFOFUNCTION, xferinfo); - curl_easy_setopt(curl_handle, CURLOPT_XFERINFODATA, &prog); curl_easy_setopt(curl_handle, CURLOPT_NOPROGRESS, noprogress); res = curl_easy_perform(curl_handle); @@ -4,7 +4,6 @@ #include <curl/curl.h> #include <json.h> -#define TIMETYPE curl_off_t #define TIMEOPT CURLINFO_TOTAL_TIME_T size_t WriteMemoryCallback(void*, size_t, size_t, void*); @@ -45,7 +45,7 @@ COMMAND(wine, download) char* choice = argv[i]; - for (size_t i = 0; i < json_object_array_length(versions); ++i) + for (JSON_LENGTH_TYPE i = 0; i < json_object_array_length(versions); ++i) { value = json_object_array_get_idx(versions, i); json_object_object_get_ex(value, "version", &temp); @@ -165,7 +165,7 @@ COMMAND(wine, list) if(intty) puts("Installable wine versions:"); - for (size_t i = 0; i < json_object_array_length(versions); ++i) + for (JSON_LENGTH_TYPE i = 0; i < json_object_array_length(versions); ++i) { value = json_object_array_get_idx(versions, i); json_object_object_get_ex(value, "version", &val); |