Commit 6e306cb5 authored by Rashad Kanavath's avatar Rashad Kanavath
Browse files

COMP: fix compiler error on otbSamplingTestDriver

parent 563fb161
...@@ -129,11 +129,9 @@ int otbImageSampleExtractorFilterUpdate(int argc, char* argv[]) ...@@ -129,11 +129,9 @@ int otbImageSampleExtractorFilterUpdate(int argc, char* argv[])
otb::ogr::Layer dstLayer = output->GetLayer(0); otb::ogr::Layer dstLayer = output->GetLayer(0);
OGRFieldDefn labelField(classFieldName.c_str(),OFTString); OGRFieldDefn labelField(classFieldName.c_str(),OFTString);
dstLayer.CreateField(labelField, true); dstLayer.CreateField(labelField, true);
OGRErr err = dstLayer.ogr().StartTransaction(); const OGRErr err = dstLayer.ogr().StartTransaction();
if (err != OGRERR_NONE) { if (err == OGRERR_NONE) {
itkExceptionMacro(<< "Unable to start transaction for OGR layer " << dstLayer.ogr().GetName() << ".");
}
otb::ogr::Layer::const_iterator featIt = inLayer.begin(); otb::ogr::Layer::const_iterator featIt = inLayer.begin();
for(; featIt!=inLayer.end(); ++featIt) for(; featIt!=inLayer.end(); ++featIt)
...@@ -143,11 +141,9 @@ int otbImageSampleExtractorFilterUpdate(int argc, char* argv[]) ...@@ -143,11 +141,9 @@ int otbImageSampleExtractorFilterUpdate(int argc, char* argv[])
dstLayer.CreateFeature( dstFeature ); dstLayer.CreateFeature( dstFeature );
} }
err = dstLayer.ogr().CommitTransaction(); const OGRErr err2 = dstLayer.ogr().CommitTransaction();
if (err != OGRERR_NONE) if (err2 == OGRERR_NONE)
{ {
itkExceptionMacro(<< "Unable to commit transaction for OGR layer " << dstLayer.ogr().GetName() << ".");
}
output->Clear(); output->Clear();
...@@ -175,6 +171,17 @@ int otbImageSampleExtractorFilterUpdate(int argc, char* argv[]) ...@@ -175,6 +171,17 @@ int otbImageSampleExtractorFilterUpdate(int argc, char* argv[])
chrono.Stop(); chrono.Stop();
std::cout << "Extraction took "<< chrono.GetTotal() << " sec" << std::endl; std::cout << "Extraction took "<< chrono.GetTotal() << " sec" << std::endl;
}
else {
std::cout<< "Unable to commit transaction for OGR layer " << dstLayer.ogr().GetName() << "." << std::endl;
return EXIT_FAILURE;
}
}
else {
std::cout << "Unable to start transaction for OGR layer " << dstLayer.ogr().GetName() << "." << std::endl;
return EXIT_FAILURE;
}
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
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