Commit f29e512d authored by Victor Poughon's avatar Victor Poughon

Merge branch 'coverity-fixes' into release-6.2

parents 3332bf1c 2aea6018
......@@ -195,11 +195,18 @@ std::string MapProjectionAdapter::GetParameter(const std::string& key) const
if (projectionName.compare("ossimTransMercatorProjection") == 0)
{
const ossimTransMercatorProjection* tmProjection = dynamic_cast<const ossimTransMercatorProjection*>(this->GetMapProjection());
if (!tmProjection)
{
itkExceptionMacro("Error casting object to ossimTransMercatorProjection.");
}
else
{
if (key.compare("ScaleFactor") == 0)
{
return Utils::ConvertToString(tmProjection->getScaleFactor());
}
}
}
// Apply parameters to Utm
if (projectionName.compare("ossimUtmProjection") == 0)
......
......@@ -249,7 +249,7 @@ int otbGenericRSTransformGenericTest(int argc, char * argv[])
if(inRes>inThreshold)
{
failed = true;
std::cerr<<"Input residual ("<<outRes<<") outpasses the threshold ("<<inThreshold<<")"<<std::endl;
std::cerr<<"Input residual ("<<inRes<<") outpasses the threshold ("<<inThreshold<<")"<<std::endl;
std::cerr<<std::endl;
}
......
......@@ -49,7 +49,7 @@ public:
typedef struct Parameter
{
/** Maximum size of the internal patterns */
unsigned long MaxPatternSize;
unsigned long MaxPatternSize = 0;
/** First sampling pattern */
std::vector<bool> Pattern1;
......@@ -59,7 +59,7 @@ public:
std::vector<bool> Pattern2;
/** Seed used to randomly generate patterns (used only if greater than 0) */
unsigned int Seed;
unsigned int Seed = 0;
bool operator!=(const struct Parameter & param) const;
} ParameterType;
......
......@@ -114,7 +114,7 @@ int parseCommandLine(int ac, char * av[], std::vector<char *>& remainingArgs)
if (oldenv2)
{
libpath64 += KWSYS_SHARED_FORWARD_PATH_SEP;
libpath64 += oldenv;
libpath64 += oldenv2;
}
itksys::SystemTools::PutEnv(libpath64.c_str());
}
......
......@@ -94,7 +94,7 @@ int otbImageToImageRCC8Calculator(int itkNotUsed(argc), char* argv[])
{
std::cout << "Test failed: Result with level3AprioriKnowledge ";
std::cout << "different from result without a priori knowledge" << std::endl;
std::cout << calc->GetValue() << "!=" << calc1->GetValue() << std::endl;
std::cout << calc->GetValue() << "!=" << calc2->GetValue() << std::endl;
return EXIT_FAILURE;
}
}
......
......@@ -34,7 +34,7 @@ namespace otb
/** Constructor */
SailModel
::SailModel() : m_LAI(2), m_Angl(50), m_PSoil(1), m_Skyl(70), m_HSpot(0.2),
m_TTS(30), m_TTO(0), m_PSI(0), m_FCoverView(0.0), m_UseSoilFile(false)
m_TTS(30), m_TTO(0), m_PSI(0), m_FCoverView(0.0), m_UseSoilFile(false), m_SoilIndex(0)
{
this->ProcessObject::SetNumberOfRequiredInputs(2);
this->ProcessObject::SetNumberOfRequiredOutputs(4);
......
......@@ -622,9 +622,9 @@ public:
{ \
Image##Type::Pointer ret; \
Parameter* param = GetParameterByKey(parameter); \
if (dynamic_cast<ComplexInputImageParameter*>(param)) \
{ \
ComplexInputImageParameter* paramDown = dynamic_cast<ComplexInputImageParameter*>(param); \
if (paramDown) \
{ \
ret = paramDown->Get##Image(); \
} \
return ret; \
......
......@@ -817,8 +817,11 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer &
if (type == ParameterType_Choice)
{
std::vector<std::string> keys = dynamic_cast<ChoiceParameter*>(param.GetPointer())->GetChoiceKeys();
std::vector<std::string> names = dynamic_cast<ChoiceParameter*>(param.GetPointer())->GetChoiceNames();
ChoiceParameter* paramDown = dynamic_cast<ChoiceParameter*>(param.GetPointer());
if (paramDown)
{
std::vector<std::string> keys = paramDown->GetChoiceKeys();
std::vector<std::string> names = paramDown->GetChoiceNames();
oss << "[";
for(unsigned int i=0; i<keys.size(); i++)
......@@ -830,6 +833,7 @@ std::string CommandLineLauncher::DisplayParameterHelp(const Parameter::Pointer &
oss << "]";
}
}
if(m_Application->IsMandatory(paramKey))
{
......
......@@ -62,11 +62,13 @@ QtProgressBar::ProcessEvent( itk::Object * caller,
::itk::ProcessObject::Pointer process =
dynamic_cast< itk::ProcessObject *>( caller );
if (process)
{
const int value2 = static_cast<int>(
process->GetProgress() * this->maximum() );
emit SetValueChanged( value2 );
}
}
}
void
......@@ -78,11 +80,14 @@ QtProgressBar::ConstProcessEvent( const itk::Object * caller,
itk::ProcessObject::ConstPointer process =
dynamic_cast< const itk::ProcessObject *>( caller );
if (process)
{
const int v = static_cast<int>(
process->GetProgress() * this->maximum() );
emit SetValueChanged( v );
}
}
}
/** Manage a Progress event */
......
......@@ -109,7 +109,7 @@ int main(int argc, char* argv[])
int ret = qtApp.exec();
// Clean resources
if (mainWindow) delete mainWindow;
delete mainWindow;
app = ITK_NULLPTR;
ApplicationRegistry::CleanRegistry();
......
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