From 92bbd046011c688324b15f27cba2f7e9f125a5cb Mon Sep 17 00:00:00 2001 From: Markus Frank Date: Thu, 23 May 2024 18:40:52 +0200 Subject: [PATCH] The battle agains coverity --- DDCore/src/plugins/VisDensityProcessor.cpp | 6 +++--- DDParsers/src/Evaluator/Evaluator.cpp | 9 +++------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/DDCore/src/plugins/VisDensityProcessor.cpp b/DDCore/src/plugins/VisDensityProcessor.cpp index 0e79a76e0..8cea652da 100644 --- a/DDCore/src/plugins/VisDensityProcessor.cpp +++ b/DDCore/src/plugins/VisDensityProcessor.cpp @@ -110,12 +110,12 @@ static void* create_object(Detector& description, int argc, char** argv) { if ( argv[i] ) { if ( ::strncmp(argv[i],"-vis",6) == 0 ) { VisAttr vis = description.visAttributes(argv[++i]); - if ( vis.isValid() ) proc->minVis = vis; + if ( vis.isValid() ) proc->minVis = std::move(vis); continue; } else if ( ::strncmp(argv[i],"-min-vis",6) == 0 ) { VisAttr vis = description.visAttributes(argv[++i]); - if ( vis.isValid() ) proc->minVis = vis; + if ( vis.isValid() ) proc->minVis = std::move(vis); continue; } else if ( ::strncmp(argv[i],"-min-density",6) == 0 ) { @@ -125,7 +125,7 @@ static void* create_object(Detector& description, int argc, char** argv) { } else if ( ::strncmp(argv[i],"-name",4) == 0 ) { std::string name = argv[++i]; - proc->name = name; + proc->name = std::move(name); continue; } else if ( ::strncmp(argv[i],"-show",4) == 0 ) { diff --git a/DDParsers/src/Evaluator/Evaluator.cpp b/DDParsers/src/Evaluator/Evaluator.cpp index 979ceff4a..69a9a9cec 100644 --- a/DDParsers/src/Evaluator/Evaluator.cpp +++ b/DDParsers/src/Evaluator/Evaluator.cpp @@ -807,8 +807,7 @@ int Evaluator::Object::setVariable(const char * name, const char * expression) void Evaluator::Object::setVariableNoLock(const char * name, double value) { std::string item_name = name; - Item item(value); - imp->theDictionary[item_name] = item; + imp->theDictionary[item_name] = Item(value); } int Evaluator::Object::setFunction(const char * name,double (*fun)()) { @@ -837,14 +836,12 @@ int Evaluator::Object::setFunction(const char * name, double (*fun)(double,doubl void Evaluator::Object::setFunctionNoLock(const char * name,double (*fun)(double)) { std::string item_name = "1"+std::string(name); - Item item(FCN(fun).ptr); - imp->theDictionary[item_name] = item; + imp->theDictionary[item_name] = Item(FCN(fun).ptr); } void Evaluator::Object::setFunctionNoLock(const char * name, double (*fun)(double,double)) { std::string item_name = "2"+std::string(name); - Item item(FCN(fun).ptr); - imp->theDictionary[item_name] = item; + imp->theDictionary[item_name] = Item(FCN(fun).ptr); }