Skip to content

Commit 4f76722

Browse files
committed
osgeo4w: prepare for GDAL 2.3 update
1 parent 85fdf4e commit 4f76722

File tree

11 files changed

+32
-10
lines changed

11 files changed

+32
-10
lines changed

CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,9 @@ IF(MSVC)
481481
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DQGISDEBUG=1")
482482
# disable macros that offend std::numeric_limits<T>::min()/max()
483483
ADD_DEFINITIONS(-DNOMINMAX)
484+
IF(MSVC_VERSION LESS 1900)
485+
ADD_DEFINITIONS(-DCPL_SUPRESS_CPLUSPLUS)
486+
ENDIF(MSVC_VERSION LESS 1900)
484487
ENDIF(MSVC)
485488

486489
IF(ENABLE_COVERAGE)

src/analysis/raster/qgsalignraster.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,16 @@
1515

1616
#include "qgsalignraster.h"
1717

18-
#include <gdalwarper.h>
1918
#include <ogr_srs_api.h>
2019
#include <cpl_conv.h>
20+
21+
#if defined(_MSC_VER) && _MSC_VER >= 1600 && _MSC_VER < 1900
22+
// we need GDALWarpKernel
23+
#undef CPL_SUPRESS_CPLUSPLUS
24+
#endif
25+
26+
#include <gdalwarper.h>
27+
2128
#include <limits>
2229

2330
#include <qmath.h>
@@ -503,9 +510,8 @@ bool QgsAlignRaster::createAndWarp( const Item& raster )
503510
}
504511

505512
// Initialize and execute the warp operation.
506-
GDALWarpOperation oOperation;
507-
oOperation.Initialize( psWarpOptions );
508-
oOperation.ChunkAndWarpImage( 0, 0, mXSize, mYSize );
513+
GDALWarpOperationH oOperation = GDALCreateWarpOperation( psWarpOptions );
514+
GDALChunkAndWarpImage( oOperation, 0, 0, mXSize, mYSize );
509515

510516
GDALDestroyGenImgProjTransformer( psWarpOptions->pTransformerArg );
511517
GDALDestroyWarpOptions( psWarpOptions );

src/app/qgsoptions.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,9 @@
6262
#include <sqlite3.h>
6363
#include "qgslogger.h"
6464

65+
#ifndef CPL_SUPRESS_CPLUSPLUS
6566
#define CPL_SUPRESS_CPLUSPLUS
67+
#endif
6668
#include <gdal.h>
6769
#include <geos_c.h>
6870
#include <cpl_conv.h> // for setting gdal options

src/core/qgsdataitem.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
#include "qgsconfig.h"
4141

4242
// use GDAL VSI mechanism
43+
#ifndef CPL_SUPRESS_CPLUSPLUS
4344
#define CPL_SUPRESS_CPLUSPLUS
45+
#endif
4446
#include "cpl_vsi.h"
4547
#include "cpl_string.h"
4648

src/plugins/georeferencer/qgsgeoreftransform.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818

1919
#include <gdal.h>
2020
#include <gdal_alg.h>
21+
#include <cpl_string.h>
2122

2223
#include "qgsleastsquares.h"
2324

2425
#include <cmath>
25-
2626
#include <cassert>
2727
#include <limits>
2828

@@ -511,7 +511,7 @@ bool QgsGDALGeorefTransform::updateParametersFromGCPs( const QVector<QgsPoint> &
511511
for ( int i = 0; i < n; i++ )
512512
{
513513
GCPList[i].pszId = new char[20];
514-
snprintf( GCPList[i].pszId, 19, "gcp%i", i );
514+
CPLsnprintf( GCPList[i].pszId, 19, "gcp%i", i );
515515
GCPList[i].pszInfo = nullptr;
516516
GCPList[i].dfGCPPixel = pixelCoords[i].x();
517517
GCPList[i].dfGCPLine = -pixelCoords[i].y();

src/plugins/georeferencer/qgsimagewarper.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,15 +252,14 @@ int QgsImageWarper::warpFile( const QString& input,
252252
adfGeoTransform );
253253

254254
// Initialize and execute the warp operation.
255-
GDALWarpOperation oOperation;
256-
oOperation.Initialize( psWarpOptions );
255+
GDALWarpOperationH oOperation = GDALCreateWarpOperation( psWarpOptions );
257256

258257
progressDialog->show();
259258
progressDialog->raise();
260259
progressDialog->activateWindow();
261260

262-
eErr = oOperation.ChunkAndWarpImage( 0, 0, destPixels, destLines );
263-
// eErr = oOperation.ChunkAndWarpMulti(0, 0, destPixels, destLines);
261+
eErr = GDALChunkAndWarpImage( oOperation, 0, 0, destPixels, destLines );
262+
// eErr = GDALChunkAndWarpMulti( oOperation, 0, 0, destPixels, destLines );
264263

265264
destroyGeoToPixelTransform( psWarpOptions->pTransformerArg );
266265
GDALDestroyWarpOptions( psWarpOptions );

src/providers/gdal/qgsgdalproviderbase.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
* *
1616
***************************************************************************/
1717

18+
#ifndef CPL_SUPRESS_CPLUSPLUS
1819
#define CPL_SUPRESS_CPLUSPLUS
20+
#endif
1921
#include "cpl_conv.h"
2022

2123
#include "qgsapplication.h"

src/providers/gdal/qgsgdalproviderbase.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323

2424
#include <QList>
2525

26+
#ifndef CPL_SUPRESS_CPLUSPLUS
2627
#define CPL_SUPRESS_CPLUSPLUS
28+
#endif
2729
#include <gdal.h>
2830

2931
#if defined(GDAL_VERSION_NUM) && GDAL_VERSION_NUM >= 1800

src/providers/ogr/qgsogrprovider.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ email : sherman at mrcc.com
2121
#include "qgsmessagelog.h"
2222
#include "qgslocalec.h"
2323

24+
#ifndef CPL_SUPRESS_CPLUSPLUS
2425
#define CPL_SUPRESS_CPLUSPLUS
26+
#endif
2527
#include <gdal.h> // to collect version information
2628
#include <ogr_api.h>
2729
#include <ogr_srs_api.h>

src/providers/wcs/qgswcsprovider.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ class QNetworkAccessManager;
4444
class QNetworkReply;
4545
class QNetworkRequest;
4646

47+
#ifndef CPL_SUPRESS_CPLUSPLUS
4748
#define CPL_SUPRESS_CPLUSPLUS
49+
#endif
4850
#include <gdal.h>
4951
#include "cpl_conv.h"
5052

tests/src/core/testqgsapplication.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ Email : sherman at mrcc dot com
1515
#include <QtTest/QtTest>
1616
#include <QPixmap>
1717

18+
#ifndef CPL_SUPRESS_CPLUSPLUS
1819
#define CPL_SUPRESS_CPLUSPLUS
20+
#endif
1921
#include <gdal.h>
2022

2123
//header for class being tested

0 commit comments

Comments
 (0)