From e879f71115c6123e99871062c77163713aead6d9 Mon Sep 17 00:00:00 2001 From: Paolo Infante Date: Wed, 9 Feb 2022 16:29:05 +0100 Subject: [PATCH] fixes --- CMakeLists.txt | 3 +-- include/archive.h | 2 +- include/unlocker.h | 1 + src/archive.cpp | 1 + src/network.cpp | 1 + src/unlocker.cpp | 14 +++++++------- tests/test.h | 1 + 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0865d1b..5d3d7f6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -138,8 +138,7 @@ set (TESTTAR_SOURCES tests/test_tar.cpp / src/installinfo.cpp / src/winservices.cpp / src/tar.cpp / - src/ziparchive.cpp / - src/toolsdownloader.cpp) + src/ziparchive.cpp) add_executable( TestTar ${TESTTAR_SOURCES} "include/unlocker.h") diff --git a/include/archive.h b/include/archive.h index cdd779b..7cbf581 100644 --- a/include/archive.h +++ b/include/archive.h @@ -16,7 +16,7 @@ class Archive public: static bool extractZip(fs::path from, std::string filename, fs::path to); static bool extractTar(fs::path from, std::string filename, fs::path to); - static void Archive::extractionProgress(float progress); + static void extractionProgress(float progress); }; #endif // ARCHIVEUTILS_H diff --git a/include/unlocker.h b/include/unlocker.h index 5d0839e..31b8098 100644 --- a/include/unlocker.h +++ b/include/unlocker.h @@ -4,6 +4,7 @@ #include #include "filesystem.hpp" #include +#include #include diff --git a/src/archive.cpp b/src/archive.cpp index c8e8364..c24760e 100644 --- a/src/archive.cpp +++ b/src/archive.cpp @@ -39,4 +39,5 @@ bool Archive::extractZip(fs::path from, std::string filename, fs::path to) void Archive::extractionProgress(float progress) { printf("Extraction progress: %.0f %% \r", progress*100); + fflush(stdout); } \ No newline at end of file diff --git a/src/network.cpp b/src/network.cpp index 91cf393..84f542e 100644 --- a/src/network.cpp +++ b/src/network.cpp @@ -47,6 +47,7 @@ int Network::progress_callback(void* clientp, double dltotal, double dlnow, doub printf("Download progress: %d %%, %.2f MB / %.2f MB, %.3f MB/s \r", (std::min)(100, (std::max)(0, int(dlnow * 100 / dltotal))), mBytesNow, mBytesTotal, downloadRate); + fflush(stdout); networkProgress->mBytesDownloadedLastTime = mBytesNow; networkProgress->lastProgressUpdateTime = nowTime; diff --git a/src/unlocker.cpp b/src/unlocker.cpp index 96f95e7..cdfdd5d 100644 --- a/src/unlocker.cpp +++ b/src/unlocker.cpp @@ -107,7 +107,7 @@ void uninstall() logerr("Error while restoring \"" + file.path().string() + "\"."); } } - catch (fs::filesystem_error ex) + catch (const fs::filesystem_error& ex) { logerr(ex.what()); } @@ -129,7 +129,7 @@ void uninstall() logerr("Error while restoring \"" + file.path().string() + "\"."); } } - catch (fs::filesystem_error ex) + catch (const fs::filesystem_error& ex) { logerr(ex.what()); } @@ -185,7 +185,7 @@ void uninstall() logerr("Error while restoring \"" + (backup / file).string() + "\"."); } } - catch (fs::filesystem_error ex) + catch (const fs::filesystem_error& ex) { logerr(ex.what()); } @@ -206,7 +206,7 @@ void uninstall() logerr("Error while restoring \"" + (backup / fs::path(lib).filename()).string() + "\"."); } } - catch (fs::filesystem_error ex) + catch (const fs::filesystem_error& ex) { logerr(ex.what()); } @@ -356,15 +356,15 @@ void doPatch() if (!fs::exists(vmx)) { - throw std::runtime_error(logerr("Vmx file not found"); + throw std::runtime_error("Vmx file not found"); } if (!fs::exists(vmx_debug)) { - throw std::runtime_error(logerr("Vmx-debug file not found"); + throw std::runtime_error("Vmx-debug file not found"); } if (!fs::exists(vmlib)) { - throw std::runtime_error(logerr("Vmlib file not found"); + throw std::runtime_error("Vmlib file not found"); } logd("File: " + vmx.filename().string()); diff --git a/tests/test.h b/tests/test.h index 376afe5..5476080 100644 --- a/tests/test.h +++ b/tests/test.h @@ -3,6 +3,7 @@ #include #include +#include #include "colors.h" #include