Browse Source

Quality of code improvements - got rid of all warnings;

main v0.2.2
Unbewohnte 3 years ago
parent
commit
902a579c8d
  1. 10
      build/CMakeLists.txt
  2. 5
      src/broom.cpp
  3. 3
      src/broom.hpp
  4. 4
      src/entry.cpp
  5. 1
      src/entry.hpp
  6. 4
      src/main.cpp

10
build/CMakeLists.txt

@ -5,16 +5,20 @@ project(broom)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
find_package(Threads REQUIRED)
IF(MSVC)
# to be made, probably...
else()
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)
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)

5
src/broom.cpp

@ -24,6 +24,7 @@ along with broom. If not, see <https://www.gnu.org/licenses/>.
#include <chrono>
#include <stdexcept>
#include <future>
#include <string>
#include "entry.hpp"
#include "broom.hpp"
@ -161,14 +162,14 @@ void Broom::create_scan_results_list(const std::map<std::string, std::vector<ent
auto now = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
outfile << ">> 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;
}

3
src/broom.hpp

@ -23,6 +23,9 @@ along with broom. If not, see <https://www.gnu.org/licenses/>.
#include <cstdint>
#include <vector>
#include <map>
#include <string>
#include "entry.hpp"
namespace broom {

4
src/entry.cpp

@ -21,7 +21,7 @@ along with broom. If not, see <https://www.gnu.org/licenses/>.
#include <iostream>
#include <cerrno>
#include <cstring>
#include <string>
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];

1
src/entry.hpp

@ -24,6 +24,7 @@ along with broom. If not, see <https://www.gnu.org/licenses/>.
#include <fstream>
#include <sstream>
#include <iomanip>
#include <string>
#include "group.hpp"

4
src/main.cpp

@ -28,7 +28,7 @@ along with broom. If not, see <https://www.gnu.org/licenses/>.
#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) {

Loading…
Cancel
Save