diff --git a/src/easymode.cpp b/src/easymode.cpp index 2fb49b9..a2d90d1 100755 --- a/src/easymode.cpp +++ b/src/easymode.cpp @@ -391,17 +391,15 @@ int format_handler(void *user, const char *section, const char *name, const char } inline void join_paths(std::filesystem::path &p, std::initializer_list list) -{ - for (const char *item : list) { // Appending null string will cause segfault - if (item == NULL) - return; - } - +{ auto it = list.begin(); p = *it; it++; - for (it; it != list.end(); ++it) + for (it; it != list.end(); ++it) { + if (*it == NULL) + return; p /= *it; + } } static void load_preset(const char *preset) diff --git a/src/easymode.hpp b/src/easymode.hpp index 506a239..3c4d669 100755 --- a/src/easymode.hpp +++ b/src/easymode.hpp @@ -32,7 +32,6 @@ class WorkerThread { std::mutex thread_mutex; std::thread *thread; std::condition_variable thread_cv; - }; void easy_mode(int argc, char *argv[]); diff --git a/src/rsgain.cpp b/src/rsgain.cpp index 38ce895..0c285e7 100755 --- a/src/rsgain.cpp +++ b/src/rsgain.cpp @@ -247,10 +247,6 @@ static void custom_mode(int argc, char *argv[]) case 'o': parse_opus_mode(optarg, config.opus_mode); break; - - case '?': - help_custom(); - quit(EXIT_FAILURE); case 'h': help_custom(); diff --git a/src/scan.cpp b/src/scan.cpp index 5665a05..8fd8471 100755 --- a/src/scan.cpp +++ b/src/scan.cpp @@ -86,7 +86,6 @@ FileType ScanJob::add_directory(std::filesystem::path &path) std::set extensions; std::vector file_list; FileType file_type; - size_t num_extensions; // Determine directory filetype for (const std::filesystem::directory_entry &entry : std::filesystem::directory_iterator(path)) { @@ -97,16 +96,14 @@ FileType ScanJob::add_directory(std::filesystem::path &path) if (file_type != FileType::INVALID) extensions.insert(file_type); } - num_extensions = extensions.size(); - if (num_extensions != 1) + if (extensions.size() != 1) return FileType::INVALID; file_type = *extensions.begin(); // Generate vector of files with directory file type for (const std::filesystem::directory_entry &entry : std::filesystem::directory_iterator(path)) { - if (!entry.is_regular_file() || !entry.path().has_extension()) - continue; - if (determine_filetype(entry.path().extension().string()) == file_type) + if (entry.is_regular_file() && entry.path().has_extension() && + determine_filetype(entry.path().extension().string()) == file_type) tracks.push_back(Track(entry.path().string(), file_type)); } type = file_type;