From bdf7c213291b9d785c3e8c76a736e25c695cd0e1 Mon Sep 17 00:00:00 2001 From: scott snyder <sss@karma> Date: Fri, 16 Oct 2020 23:37:49 -0400 Subject: [PATCH] LArRecUtils: Fix cppcheck warnings. - Prefer pre-increment (or range-for) to postincrement. - Testing the start of a string. --- LArCalorimeter/LArRecUtils/src/LArFlatConditionSvc.cxx | 4 ++-- LArCalorimeter/LArRecUtils/src/LArShapePeakRecoTool.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/LArCalorimeter/LArRecUtils/src/LArFlatConditionSvc.cxx b/LArCalorimeter/LArRecUtils/src/LArFlatConditionSvc.cxx index 19730d4931b..8869252a773 100644 --- a/LArCalorimeter/LArRecUtils/src/LArFlatConditionSvc.cxx +++ b/LArCalorimeter/LArRecUtils/src/LArFlatConditionSvc.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #include "LArFlatConditionSvc.h" @@ -468,7 +468,7 @@ void LArFlatConditionSvc::printCheckSums(const objInfo_t& objInfo, const CondAtt msg(MSG::INFO) << " Gain " << gain; for (const auto& attr : attrList) { const std::string& typeName=attr.specification().typeName(); - if (typeName.find("blob")==0) { + if (typeName.substr(0, 4) == "blob") { //Got a blob: const coral::Blob& blob = attr.data<coral::Blob>(); const std::string& blobName=attr.specification().name(); diff --git a/LArCalorimeter/LArRecUtils/src/LArShapePeakRecoTool.cxx b/LArCalorimeter/LArRecUtils/src/LArShapePeakRecoTool.cxx index 0eba27a20f5..a2923c69032 100644 --- a/LArCalorimeter/LArRecUtils/src/LArShapePeakRecoTool.cxx +++ b/LArCalorimeter/LArRecUtils/src/LArShapePeakRecoTool.cxx @@ -75,7 +75,7 @@ std::vector<float> LArShapePeakRecoTool::peak (const std::vector<float>& samples float adc_2ndmax = 0; int sample_2ndmax = static_cast<int> (sample_max); - for (;it_sample!=it_sample_end;it_sample++) { //Loop over sample vector + for (;it_sample!=it_sample_end;++it_sample) { //Loop over sample vector if((*it_sample>adc_2ndmax) & (*it_sample<=adc_max)) { adc_2ndmax = *it_sample; sample_2ndmax = distance(samples.begin(),it_sample); -- GitLab