Commit 3e64a77e authored by Victor Poughon's avatar Victor Poughon

Merge branch 'refac-tidy' into 'develop'

Bug fixes and refactors from clang-tidy

See merge request !264
parents af9f0099 72d1d633
......@@ -100,7 +100,7 @@ const ExtensionDriverAssociation k_ExtensionDriverMap[] =
char const* DeduceDriverName(std::string filename)
{
std::transform(filename.begin(), filename.end(), filename.begin(), (int (*)(int))toupper);
if (0 == strncmp(filename.c_str(), "PG:", 3))
if(filename.compare(0, 3, "PG:") == 0)
{
return "PostgreSQL";
}
......
......@@ -135,7 +135,7 @@ private:
StreamingStatisticsVImageFilterType::Pointer statsEstimator = StreamingStatisticsVImageFilterType::New();
std::ostringstream processName;
processName << "Processing Image (" << imageId+1 << "/" << imageList->Size() << ")";
AddProcess(statsEstimator->GetStreamer(), processName.str().c_str());
AddProcess(statsEstimator->GetStreamer(), processName.str());
statsEstimator->SetInput(image);
statsEstimator->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram"));
......
......@@ -212,7 +212,7 @@ private:
if (IsParameterEnabled("initmod"))
{
std::string descModFile = GetParameterString("initmod");
descMod = FuzzyDescriptorsModelManager::Read(descModFile.c_str());
descMod = FuzzyDescriptorsModelManager::Read(descModFile);
descList = FuzzyDescriptorsModelManager::GetDescriptorList(descMod);
}
else
......
......@@ -141,9 +141,9 @@ private:
#ifdef OTB_USE_LIBSVM
clock_t tic = clock();
std::string shapefile = GetParameterString("inshp").c_str();
std::string XMLfile = GetParameterString("instats").c_str();
std::string modelfile = GetParameterString("insvm").c_str();
std::string shapefile = GetParameterString("inshp");
std::string XMLfile = GetParameterString("instats");
std::string modelfile = GetParameterString("insvm");
typedef double ValueType;
typedef itk::VariableLengthVector<ValueType> MeasurementType;
......
......@@ -125,7 +125,7 @@ private:
// Load the descriptors model
std::string descModFile = GetParameterString("descmod");
DescriptorsModelType descMod = FuzzyDescriptorsModelManager::Read(descModFile.c_str());
DescriptorsModelType descMod = FuzzyDescriptorsModelManager::Read(descModFile);
LabelSetType Bhyp, Phyp;
int nbSet;
......
......@@ -282,7 +282,7 @@ private:
std::ostringstream sqloss;
sqloss.str("");
sqloss<<"SELECT * FROM \""<<layername<<"\" ORDER BY label";
otb::ogr::Layer layerTmp=ogrDS->ExecuteSQL(sqloss.str().c_str(), nullptr, nullptr);
otb::ogr::Layer layerTmp=ogrDS->ExecuteSQL(sqloss.str(), nullptr, nullptr);
otb::ogr::Feature firstFeature = layerTmp.ogr().GetNextFeature();
//Geometry fusion
......
......@@ -107,7 +107,7 @@ public:
{ return OutputVectorType(); }
/** Method to transform a vnl_vector. */
virtual OutputVnlVectorType TransforVector(const InputVnlVectorType &) const
OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
{ return OutputVnlVectorType(); }
using Superclass::TransformCovariantVector;
......
......@@ -67,7 +67,6 @@ int otbSparseWvltToAngleMapperListFilterTest ( int argc, char * argv[] )
std::string inputImageName [ nbInputImages ];
for ( unsigned int i = 0; i < nbInputImages; i++ )
inputImageName[i] = parseResult->GetParameterString("--InputImages", i);
//const char * outputImageName = parseResult->GetParameterString("--OutputImages").c_str();
// Parameter (to be changed if necessary)
const double threshold = parseResult->IsOptionPresent("--Threshold") ?
parseResult->GetParameterDouble("--Threshold") : 10.;
......
......@@ -275,7 +275,7 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage>
GenericRSTransformPointerType invTransform = GenericRSTransformType::New();
m_Transform->GetInverse(invTransform);
if(strcmp(map.c_str(),"UTM")== 0)
if(map == "UTM")
{
// Build the UTM transform : Need the zone & the hemisphere
// For this we us the geographic coordinate of the input UL corner
......@@ -310,7 +310,7 @@ GenericRSResampleImageFilter<TInputImage, TOutputImage>
CPLFree(utmRefC);
OSRRelease(oSRS);
}
else if(strcmp(map.c_str(),"WGS84")==0)
else if(map == "WGS84")
{
projectionRef = otb::GeoInformationConversion::ToWKT(4326); //WGS84
}
......
......@@ -539,7 +539,7 @@ void ONERAImageIO::InternalWriteImageInformation()
}
/*-------- This part deals with writing header information ------ */
const std::string DataFileName = System::GetRootName(m_FileName.c_str()) + ".dat";
const std::string DataFileName = System::GetRootName(m_FileName) + ".dat";
m_Headerfile << "# [fichier en-tete produit par les routines de otb (Orfeo ToolBox) ]" <<
std::endl;
......
......@@ -101,7 +101,7 @@ StatisticsXMLFileReader<TMeasurementVector>
unsigned int index = 0;
for(unsigned int idx = 0; idx < m_MeasurementVectorContainer.size() ; ++idx)
{
if(strcmp(m_MeasurementVectorContainer[idx].first.c_str(), statisticName) == 0 )
if(m_MeasurementVectorContainer[idx].first == statisticName)
{
found = true;
index = idx;
......
......@@ -47,7 +47,7 @@ StatisticsXMLFileWriter<TMeasurementVector>
// Check if the statistic name is already added
for(unsigned int idx= 0; idx< m_MeasurementVectorContainer.size(); ++idx)
{
if(strcmp(m_MeasurementVectorContainer[idx].first.c_str(), name) == 0 )
if(m_MeasurementVectorContainer[idx].first == name)
{
itkExceptionMacro(<<"Token selected ("
<<name<<") is already added to the XML file");
......
......@@ -1678,7 +1678,7 @@ std::map<std::string, int> TestHelper::RegressionTestBaselines(char *baselineFil
std::string myPath = itksys::SystemTools::GetFilenamePath(baselineFilename);
itksys::Directory myDir;
myDir.Load(myPath.c_str());
myDir.Load(myPath);
const unsigned int nbFiles = myDir.GetNumberOfFiles();
const std::string originalBaseline = itksys::SystemTools::GetFilenameWithoutLastExtension(baselineFilename);
......
......@@ -29,10 +29,9 @@
#include "itkVariableSizeMatrix.h"
#include "otbCvRTreesWrapper.h"
class CvRTreesWrapper;
namespace otb
{
template <class TInputValue, class TTargetValue>
class ITK_EXPORT RandomForestsMachineLearningModel
: public MachineLearningModel <TInputValue, TTargetValue>
......
......@@ -124,7 +124,7 @@ namespace ossimplugins
_sensor = new SensorParams();
/*
if(strcmp(time_dir_pix.c_str(), "INCREASE") == 0)
if(time_dir_pix == "INCREASE")
{
_sensor->set_col_direction(1);
}
......@@ -138,7 +138,7 @@ namespace ossimplugins
// TODO: Have to verify whether the time direction indicator should be always positive
/*
if(strcmp(time_dir_lin.c_str(), "INCREASE") == 0)
if(time_dir_lin == "INCREASE")
{
_sensor->set_lin_direction(1);
}
......
......@@ -116,7 +116,7 @@ namespace ossimplugins
_sensor = new SensorParams();
if (strcmp(time_dir_pix.c_str(), "INCREASE") == 0)
if (time_dir_pix == "INCREASE")
{
_sensor->set_col_direction(1);
}
......@@ -125,7 +125,7 @@ namespace ossimplugins
_sensor->set_col_direction(-1);
}
if (strcmp(time_dir_lin.c_str(), "INCREASE") == 0)
if (time_dir_lin == "INCREASE")
{
_sensor->set_lin_direction(1);
}
......
......@@ -86,7 +86,8 @@ ossimFormosatDimapSupportData::ossimFormosatDimapSupportData ()
{
}
ossimFormosatDimapSupportData::ossimFormosatDimapSupportData(const ossimFormosatDimapSupportData& rhs)
:ossimErrorStatusInterface(rhs),
:ossimObject(rhs),
ossimErrorStatusInterface(rhs),
theMetadataVersion(rhs.theMetadataVersion),
theImageID(rhs.theImageID),
theMetadataFile (rhs.theMetadataFile),
......
......@@ -47,7 +47,7 @@ namespace ossimplugins
ossimPluginReaderFactory::~ossimPluginReaderFactory()
{
theInstance = 0;
theInstance = nullptr;
}
ossimPluginReaderFactory* ossimPluginReaderFactory::instance()
......@@ -179,10 +179,4 @@ namespace ossimplugins
{
extensionList.push_back(ossimString("xml"));
}
ossimPluginReaderFactory::ossimPluginReaderFactory(){}
ossimPluginReaderFactory::ossimPluginReaderFactory(const ossimPluginReaderFactory&){}
void ossimPluginReaderFactory::operator=(const ossimPluginReaderFactory&){}
}
......@@ -97,21 +97,21 @@ namespace ossimplugins
virtual void getSupportedExtensions(
ossimImageHandlerFactoryBase::UniqueStringList& extensionList)const;
protected:
/** @brief hidden from use default constructor */
ossimPluginReaderFactory();
/** @brief deleted copy constructor */
ossimPluginReaderFactory(const ossimPluginReaderFactory&) = delete;
/** @brief hidden from use copy constructor */
ossimPluginReaderFactory(const ossimPluginReaderFactory&);
/** @brief deleted copy assignment operator */
void operator=(const ossimPluginReaderFactory&) = delete;
/** @brief hidden from use copy constructor */
void operator=(const ossimPluginReaderFactory&);
protected:
/** @brief hidden from use default constructor */
ossimPluginReaderFactory() {}
/** static instance of this class */
static ossimPluginReaderFactory* theInstance;
TYPE_DATA
};
};
}
#endif /* end of #ifndef ossimPluginReaderFactory_HEADER */
......@@ -83,6 +83,7 @@ VectorImageSettings
/***************************************************************************/
VectorImageSettings
::VectorImageSettings( const VectorImageSettings & other ) :
ImageSettings(other),
m_RgbChannels( other.m_RgbChannels ),
m_RgbDynamicsParams( other.m_RgbDynamicsParams ),
m_IsGrayscaleActivated( other.m_IsGrayscaleActivated ),
......
......@@ -146,9 +146,9 @@ DocExampleStructure::GenerateCLExample( unsigned int exId )
res = oss.str();
// Suppress last added space
res.erase( res.size()-1, 1);
res.pop_back();
return res.c_str();
return res;
}
std::string
......
......@@ -46,7 +46,7 @@ int main(int argc, char* argv[])
#endif
ApplicationRegistry::AddApplicationPath(argv[2]);
Application::Pointer appli = ApplicationRegistry::CreateApplicationFaster(module.c_str());
Application::Pointer appli = ApplicationRegistry::CreateApplicationFaster(module);
assert(!appli.IsNull());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment