1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Reduce indentation of HTTPFetchOngoing

Also clean up some related things.
This commit is contained in:
ShadowNinja 2014-09-14 20:46:45 -04:00
parent 18bfa1c785
commit 86a3c8ce56
8 changed files with 318 additions and 321 deletions

View file

@ -528,27 +528,26 @@ bool GUIEngine::setTexture(texture_layer layer, std::string texturepath,
}
/******************************************************************************/
bool GUIEngine::downloadFile(std::string url,std::string target)
bool GUIEngine::downloadFile(std::string url, std::string target)
{
#if USE_CURL
std::ofstream targetfile(target.c_str(), std::ios::out | std::ios::binary);
std::ofstream target_file(target.c_str(), std::ios::out | std::ios::binary);
if (!targetfile.good()) {
if (!target_file.good()) {
return false;
}
HTTPFetchRequest fetchrequest;
HTTPFetchResult fetchresult;
fetchrequest.url = url;
fetchrequest.caller = HTTPFETCH_SYNC;
fetchrequest.timeout = g_settings->getS32("curl_file_download_timeout");
httpfetch_sync(fetchrequest, fetchresult);
HTTPFetchRequest fetch_request;
HTTPFetchResult fetch_result;
fetch_request.url = url;
fetch_request.caller = HTTPFETCH_SYNC;
fetch_request.timeout = g_settings->getS32("curl_file_download_timeout");
httpfetch_sync(fetch_request, fetch_result);
if (fetchresult.succeeded) {
targetfile << fetchresult.data;
} else {
if (!fetch_result.succeeded) {
return false;
}
target_file << fetch_result.data;
return true;
#else