diff --git a/build/CMakeLists.txt b/build/CMakeLists.txt index b36d2aa..52d0e11 100755 --- a/build/CMakeLists.txt +++ b/build/CMakeLists.txt @@ -5,16 +5,20 @@ project(broom) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) -set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") -set(BUILD_SHARED_LIBS OFF) -set(CMAKE_EXE_LINKER_FLAGS "-static") - find_package(Threads REQUIRED) -set(CMAKE_THREAD_PREFER_PTHREAD TRUE) -set(THREADS_PREFER_PTHREAD_FLAG TRUE) +IF(MSVC) + # to be made, probably... +else() + set(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + set(BUILD_SHARED_LIBS OFF) + set(CMAKE_EXE_LINKER_FLAGS "-static") + + set(CMAKE_THREAD_PREFER_PTHREAD TRUE) + set(THREADS_PREFER_PTHREAD_FLAG TRUE) -set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -Wall -Werror -O2") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror -O2") +endif() set(EXECUTABLE_OUTPUT_PATH ../bin) diff --git a/src/broom.cpp b/src/broom.cpp index 717203e..23a7eb3 100755 --- a/src/broom.cpp +++ b/src/broom.cpp @@ -24,6 +24,7 @@ along with broom. If not, see . #include #include #include +#include #include "entry.hpp" #include "broom.hpp" @@ -161,14 +162,14 @@ void Broom::create_scan_results_list(const std::map> Broom scan results file from " << std::ctime(&now) << std::endl << std::endl << std::endl; - for (const auto record : grouped_duplicates) { + for (const auto& record : grouped_duplicates) { if (record.first == "") { outfile << "[EMPTY FILES]" << std::endl; } else { outfile << "[DUPLICATE GROUP]" << std::endl; } - for (const auto duplicate_entry : record.second) { + for (const auto& duplicate_entry : record.second) { outfile << duplicate_entry.path << std::endl; } diff --git a/src/broom.hpp b/src/broom.hpp index 313ed04..89ef2d2 100755 --- a/src/broom.hpp +++ b/src/broom.hpp @@ -23,6 +23,9 @@ along with broom. If not, see . #include #include #include +#include + +#include "entry.hpp" namespace broom { diff --git a/src/entry.cpp b/src/entry.cpp index 31d176a..ad194dd 100755 --- a/src/entry.cpp +++ b/src/entry.cpp @@ -21,7 +21,7 @@ along with broom. If not, see . #include #include -#include +#include namespace entry { @@ -45,7 +45,7 @@ void Entry::get_pieces() { entry_file.open(path); if (!entry_file.is_open()) { - throw std::ifstream::failure("Could not open \"" + path.string() + "\"; reason: " + std::string(std::strerror(errno)) + "\n"); + throw std::ifstream::failure("Could not open \"" + path.string() + "\""); } char pieces_buffer[PIECE_SIZE * PIECES_AMOUNT]; diff --git a/src/entry.hpp b/src/entry.hpp index a1ef9db..211475e 100755 --- a/src/entry.hpp +++ b/src/entry.hpp @@ -24,6 +24,7 @@ along with broom. If not, see . #include #include #include +#include #include "group.hpp" diff --git a/src/main.cpp b/src/main.cpp index f95a860..6ba537b 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,7 +28,7 @@ along with broom. If not, see . #include "broom.hpp" // Broom version number -#define VERSION "v0.2.1" +#define VERSION "v0.2.2" void print_help() { std::cout @@ -79,7 +79,7 @@ int main(int argc, char* argv[]) { }; // process command line arguments - for (unsigned int i = 1; i < argc; i++) { + for (unsigned int i = 1; i < (unsigned int) argc; i++) { // flags -> command -> directory if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { @@ -170,7 +170,7 @@ int main(int argc, char* argv[]) { // now only files with a non-unique size and contents are being tracked // are they REALLY duplicates ? // better to leave the REALL cleanup for the user, saving these entries in a file, than doing a blind and possibly destructive purge - broom.create_scan_results_list(grouped_duplicates ); + broom.create_scan_results_list(grouped_duplicates); std::cout << "[INFO] Created scan results file" << std::endl; } catch(const std::exception& e) {