diff options
author | ShadowNinja <shadowninja@minetest.net> | 2014-09-14 20:46:45 -0400 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2014-09-18 21:54:22 -0400 |
commit | 86a3c8ce566f28112dc032aa48c40e12fde97be2 (patch) | |
tree | 26b688e66efb45803081537023461c57991ef049 /src/guiEngine.cpp | |
parent | 18bfa1c785a123499ee12d0551a9447a4d32d93b (diff) | |
download | minetest-86a3c8ce566f28112dc032aa48c40e12fde97be2.tar.gz minetest-86a3c8ce566f28112dc032aa48c40e12fde97be2.tar.bz2 minetest-86a3c8ce566f28112dc032aa48c40e12fde97be2.zip |
Reduce indentation of HTTPFetchOngoing
Also clean up some related things.
Diffstat (limited to 'src/guiEngine.cpp')
-rw-r--r-- | src/guiEngine.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/src/guiEngine.cpp b/src/guiEngine.cpp index 0a1d72206..03b2766d8 100644 --- a/src/guiEngine.cpp +++ b/src/guiEngine.cpp @@ -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 |