From be2ef507b17f62f465117c9f9a6d6489a597e3bf Mon Sep 17 00:00:00 2001 From: JesseMckinzie <72471813+JesseMckinzie@users.noreply.github.com> Date: Thu, 29 Feb 2024 07:49:18 -0700 Subject: [PATCH 1/9] Fix compiler warnings --- src/filepattern/cpp/external/external_filepattern.cpp | 5 +---- src/filepattern/cpp/external/external_pattern.cpp | 8 +++++--- src/filepattern/cpp/external/external_stringpattern.cpp | 2 -- src/filepattern/cpp/external/external_stringpattern.hpp | 1 - src/filepattern/cpp/internal/filepattern.cpp | 3 +-- src/filepattern/cpp/internal/internal_pattern.cpp | 5 ++--- src/filepattern/cpp/pattern.cpp | 1 - src/filepattern/cpp/util/util.hpp | 2 +- 8 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/filepattern/cpp/external/external_filepattern.cpp b/src/filepattern/cpp/external/external_filepattern.cpp index 7c7013c5..65fd7bad 100644 --- a/src/filepattern/cpp/external/external_filepattern.cpp +++ b/src/filepattern/cpp/external/external_filepattern.cpp @@ -48,7 +48,7 @@ ExternalFilePattern::~ExternalFilePattern(){ void ExternalFilePattern::printFiles(){ - bool after = false; + vector files; while(true){ @@ -66,7 +66,6 @@ void ExternalFilePattern::printFiles(){ cout << endl; } - after = true; if (this->stream_.endOfValidFiles()) break; } @@ -93,7 +92,6 @@ void ExternalFilePattern::matchFilesOneDir(){ string file; smatch sm; - int count = 0; // iterate over files while(!this->stream_.isEmpty()){ block = this->stream_.getBlock(); @@ -104,7 +102,6 @@ void ExternalFilePattern::matchFilesOneDir(){ if(regex_match(file, sm, pattern_regex)){ this->stream_.writeValidFiles(getVariableMap(file_path, sm)); // write to txt file - ++count; } } diff --git a/src/filepattern/cpp/external/external_pattern.cpp b/src/filepattern/cpp/external/external_pattern.cpp index 163d9a66..5c09fcd0 100644 --- a/src/filepattern/cpp/external/external_pattern.cpp +++ b/src/filepattern/cpp/external/external_pattern.cpp @@ -96,6 +96,10 @@ void ExternalPattern::getMatchingInit(const vector>> bool created = fs::create_directory(this->fp_tmpdir_); + if (!created) { + std::cerr << "WARNING: temporary directory " << this->fp_tmpdir_ << " could not be created."; + } + fs::permissions(this->fp_tmpdir_, fs::perms::all); // create a path to store matching files @@ -164,7 +168,7 @@ vector ExternalPattern::getMatchingBlock(){ void ExternalPattern::groupByHelper(){ std::vector> , std::vector>> temp_group; - int group_idx; + vector temp_vec; vector> grouped_variables; string group_by; @@ -173,8 +177,6 @@ void ExternalPattern::groupByHelper(){ for(int j = 1; j < this->group_.size(); ++j){ group_by = this->group_[j]; - group_idx = 0; - for(auto& vec: this->current_group_){ diff --git a/src/filepattern/cpp/external/external_stringpattern.cpp b/src/filepattern/cpp/external/external_stringpattern.cpp index af516f7d..d66858c7 100644 --- a/src/filepattern/cpp/external/external_stringpattern.cpp +++ b/src/filepattern/cpp/external/external_stringpattern.cpp @@ -47,7 +47,6 @@ void ExternalStringPattern::matchFiles(){ string file; smatch sm; - int count = 0; // iterate over files while(!this->stream_.isEmpty()){ @@ -57,7 +56,6 @@ void ExternalStringPattern::matchFiles(){ if(regex_match(file, sm, pattern_regex)){ this->stream_.writeValidFiles(getVariableMap(file, sm)); // write to txt file - ++count; } } } diff --git a/src/filepattern/cpp/external/external_stringpattern.hpp b/src/filepattern/cpp/external/external_stringpattern.hpp index d98daad8..fe62be8c 100644 --- a/src/filepattern/cpp/external/external_stringpattern.hpp +++ b/src/filepattern/cpp/external/external_stringpattern.hpp @@ -59,7 +59,6 @@ class ExternalStringPattern : public ExternalPattern { fs::directory_iterator iterator_; // File iterator for given path fs::recursive_directory_iterator recursive_iterator_; // Recursive iterator bool end_of_file_; // True if end of temp file is reached - bool recursive_; // True if recursive iterator through subdirectories int total_files_; // Total number of matched files (will be deleted) diff --git a/src/filepattern/cpp/internal/filepattern.cpp b/src/filepattern/cpp/internal/filepattern.cpp index 05236c2e..55af1bd1 100644 --- a/src/filepattern/cpp/internal/filepattern.cpp +++ b/src/filepattern/cpp/internal/filepattern.cpp @@ -58,7 +58,7 @@ FilePatternObject::FilePatternObject(const string& path, const string& file_patt void FilePatternObject::printFiles(){ for(const auto& file: this->iterator_){ - //cout << file << endl; + cout << file << endl; } } @@ -67,7 +67,6 @@ void FilePatternObject::matchFilesOneDir(){ Map mapping; vector parsed_regex; - int i, j; string s; string file, file_path; Tuple member; diff --git a/src/filepattern/cpp/internal/internal_pattern.cpp b/src/filepattern/cpp/internal/internal_pattern.cpp index 0f1c6d16..58be1746 100644 --- a/src/filepattern/cpp/internal/internal_pattern.cpp +++ b/src/filepattern/cpp/internal/internal_pattern.cpp @@ -9,14 +9,13 @@ void InternalPattern::nextGroup() {} void InternalPattern::groupByHelper(const vector& groups){ std::vector> , std::vector>> temp; - int group_idx; vector temp_vec; vector> grouped_variables; - for(const auto& group_by: groups){ - group_idx = 0; + for(const auto& group_by: groups){ for(auto& vec: this->valid_grouped_files_){ + grouped_variables.clear(); for(auto& g: vec.first) grouped_variables.push_back(g); // Sort the matched files by the group_by parameter diff --git a/src/filepattern/cpp/pattern.cpp b/src/filepattern/cpp/pattern.cpp index 8d349842..b70efb62 100644 --- a/src/filepattern/cpp/pattern.cpp +++ b/src/filepattern/cpp/pattern.cpp @@ -95,7 +95,6 @@ tuple, vector> Pattern::getRegex(string& pattern, std::smatch sm, m; // regex matches string temp; - wchar_t last; // extract bracket expressions from pattern and store regex while (regex_search(patternCopy, m, e)){ temp = m[0]; diff --git a/src/filepattern/cpp/util/util.hpp b/src/filepattern/cpp/util/util.hpp index a34b2572..6a2b40cc 100644 --- a/src/filepattern/cpp/util/util.hpp +++ b/src/filepattern/cpp/util/util.hpp @@ -523,7 +523,7 @@ namespace d { if (s::endsWith(path_to_dir, ".txt")) path_to_dir = path_to_dir.substr(0, path_to_dir.find_last_of('/')); fs::path path = path_to_dir; try { - uintmax_t n = fs::remove_all(path); + fs::remove_all(path); } catch (fs::filesystem_error& e) {} } From fa2a79a93c50580d9de6f2388385de8a13c21397 Mon Sep 17 00:00:00 2001 From: JesseMckinzie <72471813+JesseMckinzie@users.noreply.github.com> Date: Thu, 29 Feb 2024 07:56:40 -0700 Subject: [PATCH 2/9] Remove unused method --- src/filepattern/cpp/internal/filepattern.cpp | 6 ------ src/filepattern/cpp/internal/filepattern.hpp | 6 ------ 2 files changed, 12 deletions(-) diff --git a/src/filepattern/cpp/internal/filepattern.cpp b/src/filepattern/cpp/internal/filepattern.cpp index 55af1bd1..a5617cc9 100644 --- a/src/filepattern/cpp/internal/filepattern.cpp +++ b/src/filepattern/cpp/internal/filepattern.cpp @@ -56,12 +56,6 @@ FilePatternObject::FilePatternObject(const string& path, const string& file_patt this->sortFiles(); } -void FilePatternObject::printFiles(){ - for(const auto& file: this->iterator_){ - cout << file << endl; - } -} - void FilePatternObject::matchFilesOneDir(){ Map mapping; diff --git a/src/filepattern/cpp/internal/filepattern.hpp b/src/filepattern/cpp/internal/filepattern.hpp index eb915dea..942cda5f 100644 --- a/src/filepattern/cpp/internal/filepattern.hpp +++ b/src/filepattern/cpp/internal/filepattern.hpp @@ -35,12 +35,6 @@ class FilePatternObject : public InternalPattern { */ void matchFiles(); - /** - * @brief Print the valid files to the console. - * - */ - void printFiles(); - private: //std::string path; // path to directory fs::directory_iterator iterator_; // File iterator for given path From cad3a21af7f1aa976ce9468a21c424853891b6da Mon Sep 17 00:00:00 2001 From: JesseMckinzie <72471813+JesseMckinzie@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:49:00 -0700 Subject: [PATCH 3/9] Fix additional warnings --- pom.xml | 2 ++ src/filepattern/cpp/external/external_pattern.cpp | 4 ++-- src/filepattern/cpp/internal/internal_pattern.cpp | 6 +++--- src/filepattern/cpp/internal/internal_pattern.hpp | 2 +- src/filepattern/cpp/pattern.cpp | 4 ++-- src/filepattern/cpp/pattern_object.hpp | 2 +- src/filepattern/cpp/util/fs_stream.hpp | 2 +- src/filepattern/cpp/util/util.hpp | 4 ++-- 8 files changed, 14 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 8414a942..9354f34f 100644 --- a/pom.xml +++ b/pom.xml @@ -9,6 +9,8 @@ 1.7 1.7 + UTF-8 + UTF-8 diff --git a/src/filepattern/cpp/external/external_pattern.cpp b/src/filepattern/cpp/external/external_pattern.cpp index 5c09fcd0..4624a13e 100644 --- a/src/filepattern/cpp/external/external_pattern.cpp +++ b/src/filepattern/cpp/external/external_pattern.cpp @@ -174,7 +174,7 @@ void ExternalPattern::groupByHelper(){ string group_by; //for(const auto& group_by: this->group){ - for(int j = 1; j < this->group_.size(); ++j){ + for(unsigned int j = 1; j < this->group_.size(); ++j){ group_by = this->group_[j]; for(auto& vec: this->current_group_){ @@ -191,7 +191,7 @@ void ExternalPattern::groupByHelper(){ Types current_value = get<0>(vec.second[0])[group_by]; // get the value of variable vector empty_vec; - int i = 0; + unsigned int i = 0; int group_ptr = 0; //group files into vectors based on group_by variable diff --git a/src/filepattern/cpp/internal/internal_pattern.cpp b/src/filepattern/cpp/internal/internal_pattern.cpp index 58be1746..55af8e0a 100644 --- a/src/filepattern/cpp/internal/internal_pattern.cpp +++ b/src/filepattern/cpp/internal/internal_pattern.cpp @@ -25,7 +25,7 @@ void InternalPattern::groupByHelper(const vector& groups){ Types current_value = get<0>(vec.second[0])[group_by]; // get the value of variable vector empty_vec; - int i = 0; + unsigned int i = 0; int group_ptr = 0; //group files into vectors based on group_by variable @@ -89,7 +89,7 @@ void InternalPattern::groupBy(vector& groups) { Types current_value = get<0>(this->valid_files_[0])[group_by]; // get the value of variable vector empty_vec; - int i = 0; + unsigned int i = 0; int group_ptr = 0; //group files into vectors based on group_by variable @@ -221,7 +221,7 @@ void InternalPattern::sortFiles(){ }); } -Tuple InternalPattern::getItem(int key){ +Tuple InternalPattern::getItem(unsigned int key){ if(key < 0) { if(this->valid_files_.size() + key < 0) throw out_of_range("Index " + std::to_string(key) + " is out of range."); return this->valid_files_[this->valid_files_.size()+key]; diff --git a/src/filepattern/cpp/internal/internal_pattern.hpp b/src/filepattern/cpp/internal/internal_pattern.hpp index cc698131..fd5882fe 100644 --- a/src/filepattern/cpp/internal/internal_pattern.hpp +++ b/src/filepattern/cpp/internal/internal_pattern.hpp @@ -83,7 +83,7 @@ class InternalPattern : public Pattern { */ std::string outputName(std::vector& vec); - Tuple getItem(int key); + Tuple getItem(unsigned int key); std::vector getItemList(std::vector& key); diff --git a/src/filepattern/cpp/pattern.cpp b/src/filepattern/cpp/pattern.cpp index b70efb62..8b499624 100644 --- a/src/filepattern/cpp/pattern.cpp +++ b/src/filepattern/cpp/pattern.cpp @@ -157,7 +157,7 @@ Tuple Pattern::getVariableMapMultDir(const string& filePath, const smatch& sm){ string basename; string file = s::getBaseName(filePath); // iterate over matched files, checking if filename already exists - for(int i = 0; i < this->valid_files_.size(); i++){ + for(unsigned int i = 0; i < this->valid_files_.size(); i++){ #ifdef JAVA_BINDING basename = s::getBaseName(s::to_string(get<1>(this->valid_files_[i])[0])); // store the basename #else @@ -187,7 +187,7 @@ Tuple Pattern::getVariableMap(const string& filePath, const smatch& sm){ string str; // Extract capture groups from filename and store in mapping - for(int i = 1; i < sm.size(); ++i){ + for(unsigned int i = 1; i < sm.size(); ++i){ str = sm[i]; diff --git a/src/filepattern/cpp/pattern_object.hpp b/src/filepattern/cpp/pattern_object.hpp index d6973b15..ba77aae2 100644 --- a/src/filepattern/cpp/pattern_object.hpp +++ b/src/filepattern/cpp/pattern_object.hpp @@ -88,7 +88,7 @@ class PatternObject { size_t length() const {return valid_files_.size();}; - const std::pair> , std::vector>& get_grouped_file_by_idx(int idx) { + const std::pair> , std::vector>& get_grouped_file_by_idx(unsigned int idx) { if (idx < 0 || idx >= this->valid_grouped_files_.size()) { diff --git a/src/filepattern/cpp/util/fs_stream.hpp b/src/filepattern/cpp/util/fs_stream.hpp index bf42329d..06ea8122 100644 --- a/src/filepattern/cpp/util/fs_stream.hpp +++ b/src/filepattern/cpp/util/fs_stream.hpp @@ -32,7 +32,7 @@ class FilesystemStream { public: int counter_; // for debugging (to be removed) - int map_size_; // size of maps in stream + unsigned int map_size_; // size of maps in stream /** * @brief Construct a new Filesystem Stream object. diff --git a/src/filepattern/cpp/util/util.hpp b/src/filepattern/cpp/util/util.hpp index 6a2b40cc..003ab996 100644 --- a/src/filepattern/cpp/util/util.hpp +++ b/src/filepattern/cpp/util/util.hpp @@ -370,7 +370,7 @@ namespace m { * @return true The end of the file has not been reached and the map is modified * @return false The end of the file has been reached and the mao is not modified */ - inline bool getMap(std::ifstream& infile, Tuple& member, int map_size) { + inline bool getMap(std::ifstream& infile, Tuple& member, long unsigned int map_size) { std::string str; Map map; @@ -562,7 +562,7 @@ namespace f { file.seekg(std::ios::beg); - for(int i=0; i < num - 1; ++i){ + for(unsigned int i=0; i < num - 1; ++i){ file.ignore(std::numeric_limits::max(),'\n'); } From 29a76374a5c093d18f4cb4db4883d8a073243eb9 Mon Sep 17 00:00:00 2001 From: JesseMckinzie <72471813+JesseMckinzie@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:54:07 -0700 Subject: [PATCH 4/9] Update getItem argument type --- src/filepattern/cpp/external/external_pattern.hpp | 2 +- src/filepattern/cpp/pattern_object.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/filepattern/cpp/external/external_pattern.hpp b/src/filepattern/cpp/external/external_pattern.hpp index b5d4d6b1..a5d31acd 100644 --- a/src/filepattern/cpp/external/external_pattern.hpp +++ b/src/filepattern/cpp/external/external_pattern.hpp @@ -230,7 +230,7 @@ class ExternalPattern : public Pattern { void sortFiles(); - Tuple getItem(int key); + Tuple getItem(unsigned int key); std::vector getItemList(std::vector& key); diff --git a/src/filepattern/cpp/pattern_object.hpp b/src/filepattern/cpp/pattern_object.hpp index ba77aae2..56ae6d1a 100644 --- a/src/filepattern/cpp/pattern_object.hpp +++ b/src/filepattern/cpp/pattern_object.hpp @@ -82,7 +82,7 @@ class PatternObject { virtual std::vector getMatchingBlock() = 0; - virtual Tuple getItem(int key) = 0; + virtual Tuple getItem(unsigned int key) = 0; virtual std::vector getItemList(std::vector& key) = 0; From d615399b33e9261799f2f7c598a72f7f9ea94618 Mon Sep 17 00:00:00 2001 From: JesseMckinzie <72471813+JesseMckinzie@users.noreply.github.com> Date: Thu, 29 Feb 2024 12:55:39 -0700 Subject: [PATCH 5/9] Update external_pattern.cpp --- src/filepattern/cpp/external/external_pattern.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filepattern/cpp/external/external_pattern.cpp b/src/filepattern/cpp/external/external_pattern.cpp index 4624a13e..cfd8af22 100644 --- a/src/filepattern/cpp/external/external_pattern.cpp +++ b/src/filepattern/cpp/external/external_pattern.cpp @@ -423,7 +423,7 @@ void ExternalPattern::sortFiles(){ } -Tuple ExternalPattern::getItem(int key){ +Tuple ExternalPattern::getItem(unsigned int key){ if(key < 0) { if(this->stream_.getValidFilesSize() + key < 0) throw out_of_range("Index " + std::to_string(key) + " is out of range."); From 98fa3ecccc2b6847c3cc904dd72bec23d63da480 Mon Sep 17 00:00:00 2001 From: JesseMckinzie <72471813+JesseMckinzie@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:01:03 -0700 Subject: [PATCH 6/9] Update valid_files_size_ type --- src/filepattern/cpp/util/fs_stream.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/filepattern/cpp/util/fs_stream.hpp b/src/filepattern/cpp/util/fs_stream.hpp index 06ea8122..d212cf6a 100644 --- a/src/filepattern/cpp/util/fs_stream.hpp +++ b/src/filepattern/cpp/util/fs_stream.hpp @@ -170,7 +170,7 @@ class FilesystemStream { bool empty_; // no more files remaining bool valid_files_empty_; // no more matched files long double block_size_; // max amount of memory to use - int valid_files_size_; + unsigned int valid_files_size_; /** * @brief Updates the amount of memory being used From 70dc705f96e0f67fcf65f5e9da76b38d81c41fc2 Mon Sep 17 00:00:00 2001 From: JesseMckinzie <72471813+JesseMckinzie@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:15:58 -0700 Subject: [PATCH 7/9] Update return type for getValidFilesSize --- src/filepattern/cpp/util/fs_stream.cpp | 2 +- src/filepattern/cpp/util/fs_stream.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/filepattern/cpp/util/fs_stream.cpp b/src/filepattern/cpp/util/fs_stream.cpp index 892bb6ee..9acfa25d 100644 --- a/src/filepattern/cpp/util/fs_stream.cpp +++ b/src/filepattern/cpp/util/fs_stream.cpp @@ -344,7 +344,7 @@ Tuple FilesystemStream::getFileByIndex(int i) { return temp; } -int FilesystemStream::getValidFilesSize(){ +unsigned int FilesystemStream::getValidFilesSize(){ return this->valid_files_size_; } diff --git a/src/filepattern/cpp/util/fs_stream.hpp b/src/filepattern/cpp/util/fs_stream.hpp index d212cf6a..1392599d 100644 --- a/src/filepattern/cpp/util/fs_stream.hpp +++ b/src/filepattern/cpp/util/fs_stream.hpp @@ -145,7 +145,7 @@ class FilesystemStream { Tuple getFileByIndex(int i); - int getValidFilesSize(); + unsigned int getValidFilesSize(); std::vector getValidFilesSlice(int i, int j, int step); From 53a21e4afe51e3ab25af30f351642aecfe62934f Mon Sep 17 00:00:00 2001 From: JesseMckinzie <72471813+JesseMckinzie@users.noreply.github.com> Date: Thu, 29 Feb 2024 13:23:37 -0700 Subject: [PATCH 8/9] Update datatypes --- .../cpp/external/external_pattern.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/filepattern/cpp/external/external_pattern.cpp b/src/filepattern/cpp/external/external_pattern.cpp index cfd8af22..fbad8b92 100644 --- a/src/filepattern/cpp/external/external_pattern.cpp +++ b/src/filepattern/cpp/external/external_pattern.cpp @@ -461,18 +461,18 @@ vector ExternalPattern::getSlice(vector& key){ string key2 = s::to_string(key[2]); if(s::is_number(key0) && key1 == "None" && key2 == "None"){ - int i = stoi(key0); + unsigned int i = stoi(key0); if(i >= this->stream_.getValidFilesSize()) throw out_of_range("Index " + std::to_string(i) + " is out of range."); - int j = this->stream_.getValidFilesSize(); - int step = 1; + unsigned int j = this->stream_.getValidFilesSize(); + unsigned int step = 1; return this->stream_.getValidFilesSlice(i, j, step); } // A start and stop index is provided with no step size, i.e. valid_files[i:j] if(s::is_number(key0) && s::is_number(key1) && key2 == "None"){ - int i = stoi(key0); - int j = stoi(key1); + unsigned int i = stoi(key0); + unsigned int j = stoi(key1); if(i > this->stream_.getValidFilesSize()) throw out_of_range("Index " + std::to_string(i) + " is out of range."); if(j > this->stream_.getValidFilesSize()) throw out_of_range("Index " + std::to_string(j) + " is out of range."); @@ -485,8 +485,8 @@ vector ExternalPattern::getSlice(vector& key){ // A start, stop, and step is provided if(s::is_number(key0) && s::is_number(key1) && s::is_number(key2)){ - int i = stoi(key0); - int j = stoi(key1); + unsigned int i = stoi(key0); + unsigned int j = stoi(key1); if(i > this->stream_.getValidFilesSize()) throw out_of_range("Index " + std::to_string(i) + " is out of range."); if(j > this->stream_.getValidFilesSize()) throw out_of_range("Index " + std::to_string(j) + " is out of range."); @@ -496,10 +496,10 @@ vector ExternalPattern::getSlice(vector& key){ } if(s::is_number(key0) && key1 == "None" && s::is_number(key2)){ - int i = stoi(key0); + unsigned int i = stoi(key0); if(i > this->stream_.getValidFilesSize()) throw out_of_range("Index " + std::to_string(i) + " is out of range."); - int j = this->stream_.getValidFilesSize(); + unsigned int j = this->stream_.getValidFilesSize(); int step = stoi(key2); return this->stream_.getValidFilesSlice(i, j, step); } From eba8d1d59d3cf78e48e35e15b1a29f74958f8eb4 Mon Sep 17 00:00:00 2001 From: JesseMckinzie <72471813+JesseMckinzie@users.noreply.github.com> Date: Fri, 1 Mar 2024 07:58:23 -0700 Subject: [PATCH 9/9] Update to range based for loop --- src/filepattern/cpp/pattern.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/filepattern/cpp/pattern.cpp b/src/filepattern/cpp/pattern.cpp index 8b499624..a8c6b3ca 100644 --- a/src/filepattern/cpp/pattern.cpp +++ b/src/filepattern/cpp/pattern.cpp @@ -157,16 +157,16 @@ Tuple Pattern::getVariableMapMultDir(const string& filePath, const smatch& sm){ string basename; string file = s::getBaseName(filePath); // iterate over matched files, checking if filename already exists - for(unsigned int i = 0; i < this->valid_files_.size(); i++){ + for (auto& valid_file: this->valid_files_) { #ifdef JAVA_BINDING - basename = s::getBaseName(s::to_string(get<1>(this->valid_files_[i])[0])); // store the basename + basename = s::getBaseName(s::to_string(get<1>(valid_file)[0])); // store the basename #else - basename = s::getBaseName(get<1>(this->valid_files_[i])[0].string()); // store the basename + basename = s::getBaseName(get<1>(valid_file)[0].string()); // store the basename #endif // if the filename is found, add the filepath to the vector in the second member of the tuple if(basename == file){ matched = true; - get<1>(this->valid_files_[i]).push_back(filePath); // Add path to existing mapping + get<1>(valid_file).push_back(filePath); // Add path to existing mapping break; } }