Commit 2b4896d7 authored by Håkan Wennlöf's avatar Håkan Wennlöf
Browse files

Merge branch 'coverity' into 'master'

Fix some Coverity Findings

See merge request allpix-squared/allpix-squared!1081
parents d3708a3e f43b0f38
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ ConfigManager::ConfigManager(std::filesystem::path file_name,
    LOG(TRACE) << "Reading main configuration";

    // Read the file
    ConfigReader reader(file, file_name);
    ConfigReader reader(file, std::move(file_name));

    // Convert all global and ignored names to lower case and store them
    auto lowercase = [](const std::string& in) { return allpix::transform(in, ::tolower); };
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ void ConfigReader::add(std::istream& stream, std::filesystem::path file_name) {
            // Line should be a key / value pair with an equal sign
            try {
                // Parse the key value pair
                auto [key, value] = parseKeyValue(line);
                auto [key, value] = parseKeyValue(std::move(line));

                // Add the config key
                conf.setText(key, value);
+1 −1
Original line number Diff line number Diff line
@@ -284,7 +284,7 @@ std::unique_ptr<Configuration::parse_node> Configuration::parse_value(std::strin
        node->value = str.substr(beg, end - beg);
    } else {
        // Not an array, handle as value instead
        node->value = str;
        node->value = std::move(str);
    }

    // Handle zero level where brackets where explicitly added
+3 −3
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ namespace allpix {
            used_keys_.markUsed(key);

            std::vector<T> array;
            auto node = parse_value(str);
            auto node = parse_value(std::move(str));
            for(auto& child : node->children) {
                try {
                    array.push_back(allpix::from_string<T>(child->value));
@@ -93,7 +93,7 @@ namespace allpix {
            used_keys_.markUsed(key);

            Matrix<T> matrix;
            auto node = parse_value(str);
            auto node = parse_value(std::move(str));
            for(auto& child : node->children) {
                if(child->children.empty()) {
                    throw std::invalid_argument("matrix has less than two dimensions, enclosing brackets might be missing");
@@ -161,7 +161,7 @@ namespace allpix {
            str += ",";
        }
        str.pop_back();
        config_[key] = str;
        config_[key] = std::move(str);
        used_keys_.registerMarker(key);
        if(mark_used) {
            used_keys_.markUsed(key);
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ using namespace allpix;
 */
void OptionParser::parseOption(std::string line) {
    line = allpix::trim(line);
    auto [key, value] = ConfigReader::parseKeyValue(line);
    auto [key, value] = ConfigReader::parseKeyValue(std::move(line));

    auto dot_pos = key.find('.');
    if(dot_pos == std::string::npos) {
Loading