From aa29adf237629566da20493998efa23858376d1c Mon Sep 17 00:00:00 2001 From: Sude Date: Tue, 7 Apr 2020 21:33:04 +0300 Subject: [PATCH] Fix return code for Downloader::downloadFileWithId I accidentally reversed the return code for Downloader::downloadFileWithId when rewriting it to use Galaxy API in a884e8c0a3ebb66af43f514bb03e23e67aecead6 This changes the success return code back to 0 like it was previously. --- src/downloader.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/downloader.cpp b/src/downloader.cpp index 3e22799..a7befdb 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -2353,7 +2353,7 @@ int Downloader::downloadFileWithId(const std::string& fileid_string, const std:: if (!gogGalaxy->refreshLogin()) { std::cerr << "Galaxy API failed to refresh login" << std::endl; - return 0; + return 1; } } @@ -2365,7 +2365,7 @@ int Downloader::downloadFileWithId(const std::string& fileid_string, const std:: dlConf.bDLC = true; dlConf.bDuplicateHandler = false; // Disable duplicate handler - int res = 0; + int res = 1; CURLcode result = CURLE_RECV_ERROR; // assume network error size_t pos = fileid_string.find("/"); @@ -2389,7 +2389,7 @@ int Downloader::downloadFileWithId(const std::string& fileid_string, const std:: if (product_id.empty()) { std::cerr << "Failed to get numerical product id" << std::endl; - return 0; + return 1; } } @@ -2397,7 +2397,7 @@ int Downloader::downloadFileWithId(const std::string& fileid_string, const std:: if (productInfo.empty()) { std::cerr << "Failed to get product info" << std::endl; - return 0; + return 1; } gameDetails gd = gogGalaxy->productInfoJsonToGameDetails(productInfo, dlConf); @@ -2418,7 +2418,7 @@ int Downloader::downloadFileWithId(const std::string& fileid_string, const std:: if (!bFoundMatchingFile) { std::cerr << "Failed to find file info (product id: " << product_id << " / file id: " << fileid << ")" << std::endl; - return 0; + return 1; } Json::Value downlinkJson = gogGalaxy->getResponseJson(gf.galaxy_downlink_json_url); @@ -2426,7 +2426,7 @@ int Downloader::downloadFileWithId(const std::string& fileid_string, const std:: if (downlinkJson.empty()) { std::cerr << "Empty JSON response" << std::endl; - return 0; + return 1; } if (downlinkJson.isMember("downlink")) @@ -2436,7 +2436,7 @@ int Downloader::downloadFileWithId(const std::string& fileid_string, const std:: else { std::cerr << "Invalid JSON response" << std::endl; - return 0; + return 1; } std::string xml_url; @@ -2469,7 +2469,7 @@ int Downloader::downloadFileWithId(const std::string& fileid_string, const std:: } if (result == CURLE_OK) - res = 1; + res = 0; return res; }