diff options
| author | 2023-12-28 22:01:38 -0600 | |
|---|---|---|
| committer | 2023-12-28 22:01:38 -0600 | |
| commit | 56ae85a352d8909014240e69290dfe69d747210e (patch) | |
| tree | b472f6430c8a80e99aea71e5ce7540f508138fbf /src/launcherutil.c | |
| parent | [wip] version stuff (diff) | |
download (but not parse) version manifest
Diffstat (limited to 'src/launcherutil.c')
| -rw-r--r-- | src/launcherutil.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/launcherutil.c b/src/launcherutil.c index f73428a..446bff9 100644 --- a/src/launcherutil.c +++ b/src/launcherutil.c @@ -176,7 +176,7 @@ size_t l2_launcher__download_callback(char *data, size_t size, size_t nmemb, voi if (buf->size + realsz > buf->capacity) { size_t newcap = 16; - while (newcap && buf->size + realsz < newcap) + while (newcap && buf->size + realsz > newcap) newcap <<= 1; if (!newcap) return CURLE_WRITE_ERROR; @@ -212,9 +212,10 @@ void l2_launcher_download_cleanup(struct l2_dlbuf *buf) const curl_write_callback l2_dlcb = &l2_launcher__download_callback; -int l2_launcher_download(CURL *cd, const char *url, void **odata, size_t *osize) +CURLcode l2_launcher_download(CURL *cd, const char *url, void **odata, size_t *osize) { struct l2_dlbuf db; + CURLcode code; l2_launcher_download_init(&db); @@ -222,13 +223,13 @@ int l2_launcher_download(CURL *cd, const char *url, void **odata, size_t *osize) curl_easy_setopt(cd, CURLOPT_WRITEDATA, &db); curl_easy_setopt(cd, CURLOPT_WRITEFUNCTION, l2_dlcb); - if (curl_easy_perform(cd) != CURLE_OK) { + if ((code = curl_easy_perform(cd)) != CURLE_OK) { l2_launcher_download_cleanup(&db); - return -1; + return code; } *odata = l2_launcher_download_finalize(&db, osize); l2_launcher_download_cleanup(&db); /* not strictly necessary but ok */ - return 0; + return CURLE_OK; } |
