From 11672146b9bf67cae05e8e3207c9bd1e47d52220 Mon Sep 17 00:00:00 2001 From: bigfoot547 Date: Fri, 5 Jan 2024 04:53:20 -0600 Subject: extracts natives --- src/assets.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/assets.c') diff --git a/src/assets.c b/src/assets.c index 7699d33..695e0ab 100644 --- a/src/assets.c +++ b/src/assets.c @@ -28,7 +28,9 @@ struct l2_assets__download_info { l2_sha1_state_t digest_state; size_t recv_size; +#ifndef NDEBUG char errbuf[CURL_ERROR_SIZE]; +#endif struct l2_assets__download_info *next; }; @@ -64,12 +66,14 @@ int l2_assets__download_asset_init(CURL *curl, void *user) return -1; } - CMD_DEBUG("asset url %s", info->url); - curl_easy_setopt(curl, CURLOPT_URL, info->url); curl_easy_setopt(curl, CURLOPT_WRITEDATA, info); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &l2_assets__download_asset_dlcb); + +#ifndef NDEBUG + memset(&info->errbuf, 0, sizeof(info->errbuf)); curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, info->errbuf); +#endif return 0; } @@ -84,7 +88,9 @@ int l2_assets__download_asset_complete(CURL *curl, CURLcode code, void *user) if (code != CURLE_OK) { CMD_WARN("Failed to download asset %s: %s", info->name, curl_easy_strerror(code)); - CMD_DEBUG("Info for %s: %s", info->name, info->errbuf); +#ifndef NDEBUG + CMD_DEBUG("Debug info for %s: %s", info->name, info->errbuf); +#endif return -1; } @@ -238,6 +244,7 @@ int l2_assets__download_assets(json_t *asset_index, char **path) res = -1; goto cleanup; } + CMD_INFO0("Successfully downloaded assets."); } else { CMD_INFO0("No assets to download."); res = 0; @@ -261,7 +268,6 @@ int l2_assets__download_assets(json_t *asset_index, char **path) *path = resbasepath; resbasepath = NULL; /* prevent out variable from being freed */ - CMD_INFO0("Successfully downloaded assets."); res = 0; cleanup: -- cgit v1.2.3-70-g09d2