Skip to content
Snippets Groups Projects
Commit 9c25be88 authored by Mickael Savinaud's avatar Mickael Savinaud
Browse files

ENH: correct bug of compilation with test on HDF4 during configuration of OTB

parent 0b62dfb0
No related branches found
No related tags found
No related merge requests found
......@@ -183,8 +183,8 @@ IF(OTB_USE_EXTERNAL_GDAL)
#${OTB_DATA_ROOT}/Input/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf -> Test KO
#${OTB_DATA_ROOT}/Input/GSSTF_NCEP.2b.2008.12.31.he5 -> Test OK
IF(OTB_DATA_ROOT)
SET(CMAKE_REQUIRED_INCLUDES ${GEOTIFF_INCLUDE_DIRS};${TIFF_INCLUDE_DIRS})
SET(CMAKE_REQUIRED_LIBRARIES "${GDAL_LIBRARY};${GEOTIFF_LIBRARY};${TIFF_LIBRARY}")
SET(CMAKE_REQUIRED_INCLUDES ${GEOTIFF_INCLUDE_DIRS})
SET(CMAKE_REQUIRED_LIBRARIES "${GDAL_LIBRARY}")
CHECK_CXX_SOURCE_RUNS_ARGS(
${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestHDF4Open.cxx
${OTB_DATA_ROOT}/Input/MOD09Q1G_EVI.A2006233.h07v03.005.2008338190308.hdf
......
......@@ -15,7 +15,7 @@ int main(int argc, char * argv[])
{
if (argc != 2)
{
std::cerr << "Usage : " << argv[0] << " <HDF4_filename> <ID number of the dataset>" << std::endl;
std::cerr << "Usage : " << argv[0] << " <HDF4_filename>" << std::endl;
return 1;
}
......@@ -47,6 +47,7 @@ int main(int argc, char * argv[])
subDatasetName.erase ( subDatasetName.begin(), subDatasetName.begin() + found +1);
}
GDALClose(poDataset);
poDatasetSubDS = (GDALDataset *) GDALOpen(subDatasetName.c_str(), GA_ReadOnly);
if (poDatasetSubDS == NULL)
{
......@@ -65,6 +66,7 @@ int main(int argc, char * argv[])
int xSizeROI = xSize ;
int ySizeROI = ySize ;
int ret = 0;
if (pxlType == GDT_Byte)
{
typedef unsigned char UCHAR;
......@@ -72,10 +74,10 @@ int main(int argc, char * argv[])
CPLErr lCrGdal = rb->RasterIO(GF_Read, 0, 0, xSizeROI, ySizeROI, buffer, xSizeROI, ySizeROI, pxlType, 0, 0);
if (lCrGdal == CE_Failure)
{
return 1;
ret = 1;
}
delete[] buffer;
}
}
else if (pxlType == GDT_Int16)
{
typedef short int SHORT;
......@@ -83,7 +85,7 @@ int main(int argc, char * argv[])
CPLErr lCrGdal = rb->RasterIO(GF_Read, 0, 0, xSizeROI, ySizeROI, buffer, xSizeROI, ySizeROI, pxlType, 0, 0);
if (lCrGdal == CE_Failure)
{
return 1;
ret = 1;
}
delete[] buffer;
}
......@@ -93,13 +95,12 @@ int main(int argc, char * argv[])
CPLErr lCrGdal = rb->RasterIO(GF_Read, 0, 0, xSizeROI, ySizeROI, buffer, xSizeROI, ySizeROI, pxlType, 0, 0);
if (lCrGdal == CE_Failure)
{
return 1;
ret = 1;
}
delete[] buffer;
}
GDALClose(poDatasetSubDS);
GDALClose(poDataset);
return 0;
return ret;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment