diff --git a/gdal/alg/libqhull/COPYING.txt b/gdal/alg/internal_libqhull/COPYING.txt similarity index 100% rename from gdal/alg/libqhull/COPYING.txt rename to gdal/alg/internal_libqhull/COPYING.txt diff --git a/gdal/alg/libqhull/README.txt b/gdal/alg/internal_libqhull/README.txt similarity index 100% rename from gdal/alg/libqhull/README.txt rename to gdal/alg/internal_libqhull/README.txt diff --git a/gdal/alg/libqhull/geom.c b/gdal/alg/internal_libqhull/geom.c similarity index 100% rename from gdal/alg/libqhull/geom.c rename to gdal/alg/internal_libqhull/geom.c diff --git a/gdal/alg/libqhull/geom.h b/gdal/alg/internal_libqhull/geom.h similarity index 100% rename from gdal/alg/libqhull/geom.h rename to gdal/alg/internal_libqhull/geom.h diff --git a/gdal/alg/libqhull/geom2.c b/gdal/alg/internal_libqhull/geom2.c similarity index 100% rename from gdal/alg/libqhull/geom2.c rename to gdal/alg/internal_libqhull/geom2.c diff --git a/gdal/alg/libqhull/global.c b/gdal/alg/internal_libqhull/global.c similarity index 100% rename from gdal/alg/libqhull/global.c rename to gdal/alg/internal_libqhull/global.c diff --git a/gdal/alg/libqhull/io.c b/gdal/alg/internal_libqhull/io.c similarity index 100% rename from gdal/alg/libqhull/io.c rename to gdal/alg/internal_libqhull/io.c diff --git a/gdal/alg/libqhull/io.h b/gdal/alg/internal_libqhull/io.h similarity index 100% rename from gdal/alg/libqhull/io.h rename to gdal/alg/internal_libqhull/io.h diff --git a/gdal/alg/libqhull/libqhull.c b/gdal/alg/internal_libqhull/libqhull.c similarity index 100% rename from gdal/alg/libqhull/libqhull.c rename to gdal/alg/internal_libqhull/libqhull.c diff --git a/gdal/alg/libqhull/libqhull.h b/gdal/alg/internal_libqhull/libqhull.h similarity index 100% rename from gdal/alg/libqhull/libqhull.h rename to gdal/alg/internal_libqhull/libqhull.h diff --git a/gdal/alg/libqhull/mem.c b/gdal/alg/internal_libqhull/mem.c similarity index 100% rename from gdal/alg/libqhull/mem.c rename to gdal/alg/internal_libqhull/mem.c diff --git a/gdal/alg/libqhull/mem.h b/gdal/alg/internal_libqhull/mem.h similarity index 100% rename from gdal/alg/libqhull/mem.h rename to gdal/alg/internal_libqhull/mem.h diff --git a/gdal/alg/libqhull/merge.c b/gdal/alg/internal_libqhull/merge.c similarity index 100% rename from gdal/alg/libqhull/merge.c rename to gdal/alg/internal_libqhull/merge.c diff --git a/gdal/alg/libqhull/merge.h b/gdal/alg/internal_libqhull/merge.h similarity index 100% rename from gdal/alg/libqhull/merge.h rename to gdal/alg/internal_libqhull/merge.h diff --git a/gdal/alg/libqhull/poly.c b/gdal/alg/internal_libqhull/poly.c similarity index 100% rename from gdal/alg/libqhull/poly.c rename to gdal/alg/internal_libqhull/poly.c diff --git a/gdal/alg/libqhull/poly.h b/gdal/alg/internal_libqhull/poly.h similarity index 100% rename from gdal/alg/libqhull/poly.h rename to gdal/alg/internal_libqhull/poly.h diff --git a/gdal/alg/libqhull/poly2.c b/gdal/alg/internal_libqhull/poly2.c similarity index 100% rename from gdal/alg/libqhull/poly2.c rename to gdal/alg/internal_libqhull/poly2.c diff --git a/gdal/alg/libqhull/qhull_a.h b/gdal/alg/internal_libqhull/qhull_a.h similarity index 100% rename from gdal/alg/libqhull/qhull_a.h rename to gdal/alg/internal_libqhull/qhull_a.h diff --git a/gdal/alg/libqhull/qset.c b/gdal/alg/internal_libqhull/qset.c similarity index 100% rename from gdal/alg/libqhull/qset.c rename to gdal/alg/internal_libqhull/qset.c diff --git a/gdal/alg/libqhull/qset.h b/gdal/alg/internal_libqhull/qset.h similarity index 100% rename from gdal/alg/libqhull/qset.h rename to gdal/alg/internal_libqhull/qset.h diff --git a/gdal/alg/libqhull/random.c b/gdal/alg/internal_libqhull/random.c similarity index 100% rename from gdal/alg/libqhull/random.c rename to gdal/alg/internal_libqhull/random.c diff --git a/gdal/alg/libqhull/random.h b/gdal/alg/internal_libqhull/random.h similarity index 100% rename from gdal/alg/libqhull/random.h rename to gdal/alg/internal_libqhull/random.h diff --git a/gdal/alg/libqhull/rboxlib.c b/gdal/alg/internal_libqhull/rboxlib.c similarity index 100% rename from gdal/alg/libqhull/rboxlib.c rename to gdal/alg/internal_libqhull/rboxlib.c diff --git a/gdal/alg/libqhull/stat.c b/gdal/alg/internal_libqhull/stat.c similarity index 100% rename from gdal/alg/libqhull/stat.c rename to gdal/alg/internal_libqhull/stat.c diff --git a/gdal/alg/libqhull/stat.h b/gdal/alg/internal_libqhull/stat.h similarity index 100% rename from gdal/alg/libqhull/stat.h rename to gdal/alg/internal_libqhull/stat.h diff --git a/gdal/alg/libqhull/user.c b/gdal/alg/internal_libqhull/user.c similarity index 100% rename from gdal/alg/libqhull/user.c rename to gdal/alg/internal_libqhull/user.c diff --git a/gdal/alg/libqhull/user.h b/gdal/alg/internal_libqhull/user.h similarity index 100% rename from gdal/alg/libqhull/user.h rename to gdal/alg/internal_libqhull/user.h diff --git a/gdal/alg/libqhull/usermem.c b/gdal/alg/internal_libqhull/usermem.c similarity index 100% rename from gdal/alg/libqhull/usermem.c rename to gdal/alg/internal_libqhull/usermem.c diff --git a/gdal/alg/libqhull/userprintf.c b/gdal/alg/internal_libqhull/userprintf.c similarity index 100% rename from gdal/alg/libqhull/userprintf.c rename to gdal/alg/internal_libqhull/userprintf.c diff --git a/gdal/alg/libqhull/userprintf_rbox.c b/gdal/alg/internal_libqhull/userprintf_rbox.c similarity index 100% rename from gdal/alg/libqhull/userprintf_rbox.c rename to gdal/alg/internal_libqhull/userprintf_rbox.c diff --git a/gdal/alg/internal_qhull_headers.h b/gdal/alg/internal_qhull_headers.h index f3df3a474026..ce8c53011d83 100644 --- a/gdal/alg/internal_qhull_headers.h +++ b/gdal/alg/internal_qhull_headers.h @@ -974,22 +974,22 @@ static gdal_realT qh_stddev(); #pragma warning( disable : 4306 ) /* e.g 'type cast' : conversion from 'long' to 'facetT *' of greater size */ #endif -#include "libqhull/libqhull.h" -#include "libqhull/libqhull.c" -#include "libqhull/poly.c" -#include "libqhull/poly2.c" -#include "libqhull/mem.c" -#include "libqhull/user.c" -#include "libqhull/global.c" +#include "internal_libqhull/libqhull.h" +#include "internal_libqhull/libqhull.c" +#include "internal_libqhull/poly.c" +#include "internal_libqhull/poly2.c" +#include "internal_libqhull/mem.c" +#include "internal_libqhull/user.c" +#include "internal_libqhull/global.c" /*#include "userprintf.c"*/ -#include "libqhull/random.c" -#include "libqhull/qset.c" -#include "libqhull/io.c" -#include "libqhull/usermem.c" -#include "libqhull/geom.c" -#include "libqhull/geom2.c" -#include "libqhull/stat.c" -#include "libqhull/merge.c" +#include "internal_libqhull/random.c" +#include "internal_libqhull/qset.c" +#include "internal_libqhull/io.c" +#include "internal_libqhull/usermem.c" +#include "internal_libqhull/geom.c" +#include "internal_libqhull/geom2.c" +#include "internal_libqhull/stat.c" +#include "internal_libqhull/merge.c" #ifdef _MSC_VER #pragma warning( pop ) diff --git a/gdal/frmts/raw/roipacdataset.cpp b/gdal/frmts/raw/roipacdataset.cpp index 4a6b28fcf720..7cca5300ef34 100644 --- a/gdal/frmts/raw/roipacdataset.cpp +++ b/gdal/frmts/raw/roipacdataset.cpp @@ -354,8 +354,25 @@ GDALDataset *ROIPACDataset::Open( GDALOpenInfo *poOpenInfo ) } else { /* PIXEL */ nPixelOffset = GDALGetDataTypeSizeBytes(eDataType) * nBands; - nLineOffset = nPixelOffset * nWidth * nBands; + nLineOffset = nPixelOffset * nWidth; nBandOffset = GDALGetDataTypeSizeBytes(eDataType); + + if( nBands > 1 ) + { + // GDAL 2.0.[0-3] and 2.1.0 had a value of nLineOffset that was + // equal to the theoretical nLineOffset multiplied by nBands... + VSIFSeekL( poDS->fpImage, 0, SEEK_END ); + const GUIntBig nWrongFileSize = GDALGetDataTypeSizeBytes(eDataType) * + nWidth * (static_cast(nFileLength - 1) * nBands * nBands + nBands); + if( VSIFTellL( poDS->fpImage ) == nWrongFileSize ) + { + CPLError(CE_Warning, CPLE_AppDefined, + "This file has been incorrectly generated by an older " + "GDAL version whose line offset computation was erroneous. " + "Taking that into account, but the file should be re-encoded ideally"); + nLineOffset = nLineOffset * nBands; + } + } } poDS->nBands = nBands; for( int b = 0; b < nBands; b++ )