From 222e45b838ebf8a2df43c6ef888047182fba5cb2 Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Wed, 11 Apr 2018 22:54:51 +0200 Subject: [PATCH] allow builds with DEBUG macro defined --- external/libdxfrw/drw_base.h | 4 ++-- external/libdxfrw/intern/drw_dbg.cpp | 4 ++-- external/libdxfrw/intern/drw_dbg.h | 4 ++-- external/libdxfrw/libdwgr.cpp | 8 ++++---- external/libdxfrw/libdxfrw.cpp | 11 ++++++----- src/core/qgsogrutils.cpp | 10 +++++----- src/core/qgsogrutils.h | 20 ++++++++++---------- src/providers/ogr/qgsogrprovider.cpp | 3 +-- 8 files changed, 32 insertions(+), 32 deletions(-) diff --git a/external/libdxfrw/drw_base.h b/external/libdxfrw/drw_base.h index a3490b3062c..8e93c50e4fb 100644 --- a/external/libdxfrw/drw_base.h +++ b/external/libdxfrw/drw_base.h @@ -93,8 +93,8 @@ namespace DRW enum DBG_LEVEL { - NONE, - DEBUG + none, + debug }; //! Special codes for colors diff --git a/external/libdxfrw/intern/drw_dbg.cpp b/external/libdxfrw/intern/drw_dbg.cpp index e7de6d3e9d6..eb1bc42e480 100644 --- a/external/libdxfrw/intern/drw_dbg.cpp +++ b/external/libdxfrw/intern/drw_dbg.cpp @@ -67,7 +67,7 @@ DRW_dbg *DRW_dbg::getInstance() DRW_dbg::DRW_dbg() { - level = NONE; + level = none; prClass = new print_none; } @@ -77,7 +77,7 @@ void DRW_dbg::setLevel( LEVEL lvl ) delete prClass; switch ( level ) { - case DEBUG: + case debug: prClass = new print_debug; break; default: diff --git a/external/libdxfrw/intern/drw_dbg.h b/external/libdxfrw/intern/drw_dbg.h index d109202128c..c13f346d95e 100644 --- a/external/libdxfrw/intern/drw_dbg.h +++ b/external/libdxfrw/intern/drw_dbg.h @@ -32,8 +32,8 @@ class DRW_dbg public: enum LEVEL { - NONE, - DEBUG + none, + debug }; void setLevel( LEVEL lvl ); LEVEL getLevel(); diff --git a/external/libdxfrw/libdwgr.cpp b/external/libdxfrw/libdwgr.cpp index ab2997c3a56..3052b3f7630 100644 --- a/external/libdxfrw/libdwgr.cpp +++ b/external/libdxfrw/libdwgr.cpp @@ -53,7 +53,7 @@ dwgR::dwgR( const char *name ) , writer( nullptr ) #endif { - DRW_DBGSL( DRW_dbg::NONE ); + DRW_DBGSL( DRW_dbg::none ); } dwgR::~dwgR() @@ -65,11 +65,11 @@ void dwgR::setDebug( DRW::DBG_LEVEL lvl ) { switch ( lvl ) { - case DRW::DEBUG: - DRW_DBGSL( DRW_dbg::DEBUG ); + case DRW::debug: + DRW_DBGSL( DRW_dbg::debug ); break; default: - DRW_DBGSL( DRW_dbg::NONE ); + DRW_DBGSL( DRW_dbg::none ); } } diff --git a/external/libdxfrw/libdxfrw.cpp b/external/libdxfrw/libdxfrw.cpp index 4a39578d60a..d2da493d2e5 100644 --- a/external/libdxfrw/libdxfrw.cpp +++ b/external/libdxfrw/libdxfrw.cpp @@ -62,7 +62,7 @@ dxfRW::dxfRW( const char *name ) , elParts( 128 ) //parts number when convert ellipse to polyline , currHandle( 0 ) { - DRW_DBGSL( DRW_dbg::NONE ); + DRW_DBGSL( DRW_dbg::none ); } dxfRW::~dxfRW() @@ -79,11 +79,11 @@ void dxfRW::setDebug( DRW::DBG_LEVEL lvl ) { switch ( lvl ) { - case DRW::DEBUG: - DRW_DBGSL( DRW_dbg::DEBUG ); + case DRW::debug: + DRW_DBGSL( DRW_dbg::debug ); break; default: - DRW_DBGSL( DRW_dbg::NONE ); + DRW_DBGSL( DRW_dbg::none ); } } @@ -3398,7 +3398,8 @@ bool dxfRW::processImageDef() return true; } -/** Utility function +/** + * Utility function * convert a int to string in hex **/ std::string dxfRW::toHexStr( int n ) diff --git a/src/core/qgsogrutils.cpp b/src/core/qgsogrutils.cpp index 655b87faf7c..24ff48eae66 100644 --- a/src/core/qgsogrutils.cpp +++ b/src/core/qgsogrutils.cpp @@ -31,28 +31,28 @@ -void gdal::OGRDataSourceDeleter::operator()( void *source ) +void gdal::OGRDataSourceDeleter::operator()( OGRDataSourceH source ) { OGR_DS_Destroy( source ); } -void gdal::OGRGeometryDeleter::operator()( void *geometry ) +void gdal::OGRGeometryDeleter::operator()( OGRGeometryH geometry ) { OGR_G_DestroyGeometry( geometry ); } -void gdal::OGRFldDeleter::operator()( void *definition ) +void gdal::OGRFldDeleter::operator()( OGRFieldDefnH definition ) { OGR_Fld_Destroy( definition ); } -void gdal::OGRFeatureDeleter::operator()( void *feature ) +void gdal::OGRFeatureDeleter::operator()( OGRFeatureH feature ) { OGR_F_Destroy( feature ); } -void gdal::GDALDatasetCloser::operator()( void *dataset ) +void gdal::GDALDatasetCloser::operator()( GDALDatasetH dataset ) { GDALClose( dataset ); } diff --git a/src/core/qgsogrutils.h b/src/core/qgsogrutils.h index 3e9755ec684..79c411e8286 100644 --- a/src/core/qgsogrutils.h +++ b/src/core/qgsogrutils.h @@ -39,7 +39,7 @@ namespace gdal /** * Destroys an OGR data \a source, using the correct gdal calls. */ - void CORE_EXPORT operator()( void *source ); + void CORE_EXPORT operator()( OGRDataSourceH source ); }; @@ -52,7 +52,7 @@ namespace gdal /** * Destroys an OGR \a geometry, using the correct gdal calls. */ - void CORE_EXPORT operator()( void *geometry ); + void CORE_EXPORT operator()( OGRGeometryH geometry ); }; @@ -65,7 +65,7 @@ namespace gdal /** * Destroys an OGR field \a definition, using the correct gdal calls. */ - void CORE_EXPORT operator()( void *definition ); + void CORE_EXPORT operator()( OGRFieldDefnH definition ); }; @@ -78,7 +78,7 @@ namespace gdal /** * Destroys an OGR \a feature, using the correct gdal calls. */ - void CORE_EXPORT operator()( void *feature ); + void CORE_EXPORT operator()( OGRFeatureH feature ); }; @@ -91,7 +91,7 @@ namespace gdal /** * Destroys an gdal \a dataset, using the correct gdal calls. */ - void CORE_EXPORT operator()( void *dataset ); + void CORE_EXPORT operator()( GDALDatasetH datasource ); }; @@ -111,27 +111,27 @@ namespace gdal /** * Scoped OGR data source. */ - using ogr_datasource_unique_ptr = std::unique_ptr< void, OGRDataSourceDeleter>; + using ogr_datasource_unique_ptr = std::unique_ptr< std::remove_pointer::type, OGRDataSourceDeleter >; /** * Scoped OGR geometry. */ - using ogr_geometry_unique_ptr = std::unique_ptr< void, OGRGeometryDeleter>; + using ogr_geometry_unique_ptr = std::unique_ptr< std::remove_pointer::type, OGRGeometryDeleter >; /** * Scoped OGR field definition. */ - using ogr_field_def_unique_ptr = std::unique_ptr< void, OGRFldDeleter >; + using ogr_field_def_unique_ptr = std::unique_ptr< std::remove_pointer::type, OGRFldDeleter >; /** * Scoped OGR feature. */ - using ogr_feature_unique_ptr = std::unique_ptr< void, OGRFeatureDeleter >; + using ogr_feature_unique_ptr = std::unique_ptr< std::remove_pointer::type, OGRFeatureDeleter >; /** * Scoped GDAL dataset. */ - using dataset_unique_ptr = std::unique_ptr< void, GDALDatasetCloser >; + using dataset_unique_ptr = std::unique_ptr< std::remove_pointer::type, GDALDatasetCloser >; /** * Performs a fast close of an unwanted GDAL dataset handle by deleting the underlying diff --git a/src/providers/ogr/qgsogrprovider.cpp b/src/providers/ogr/qgsogrprovider.cpp index 147dc880f83..c5c54977580 100644 --- a/src/providers/ogr/qgsogrprovider.cpp +++ b/src/providers/ogr/qgsogrprovider.cpp @@ -2974,9 +2974,8 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri, { QgsDebugMsg( QString( "Creating empty vector layer with format: %1" ).arg( format ) ); - GDALDriverH driver; QgsApplication::registerOgrDrivers(); - driver = OGRGetDriverByName( format.toLatin1() ); + OGRSFDriverH driver = OGRGetDriverByName( format.toLatin1() ); if ( !driver ) { return false;