Skip to content

Commit

Permalink
allow builds with DEBUG macro defined
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Apr 11, 2018
1 parent bb0bfea commit 222e45b
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 32 deletions.
4 changes: 2 additions & 2 deletions external/libdxfrw/drw_base.h
Expand Up @@ -93,8 +93,8 @@ namespace DRW

enum DBG_LEVEL
{
NONE,
DEBUG
none,
debug
};

//! Special codes for colors
Expand Down
4 changes: 2 additions & 2 deletions external/libdxfrw/intern/drw_dbg.cpp
Expand Up @@ -67,7 +67,7 @@ DRW_dbg *DRW_dbg::getInstance()

DRW_dbg::DRW_dbg()
{
level = NONE;
level = none;
prClass = new print_none;
}

Expand All @@ -77,7 +77,7 @@ void DRW_dbg::setLevel( LEVEL lvl )
delete prClass;
switch ( level )
{
case DEBUG:
case debug:
prClass = new print_debug;
break;
default:
Expand Down
4 changes: 2 additions & 2 deletions external/libdxfrw/intern/drw_dbg.h
Expand Up @@ -32,8 +32,8 @@ class DRW_dbg
public:
enum LEVEL
{
NONE,
DEBUG
none,
debug
};
void setLevel( LEVEL lvl );
LEVEL getLevel();
Expand Down
8 changes: 4 additions & 4 deletions external/libdxfrw/libdwgr.cpp
Expand Up @@ -53,7 +53,7 @@ dwgR::dwgR( const char *name )
, writer( nullptr )
#endif
{
DRW_DBGSL( DRW_dbg::NONE );
DRW_DBGSL( DRW_dbg::none );
}

dwgR::~dwgR()
Expand All @@ -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 );
}
}

Expand Down
11 changes: 6 additions & 5 deletions external/libdxfrw/libdxfrw.cpp
Expand Up @@ -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()
Expand All @@ -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 );
}
}

Expand Down Expand Up @@ -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 )
Expand Down
10 changes: 5 additions & 5 deletions src/core/qgsogrutils.cpp
Expand Up @@ -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 );
}
Expand Down
20 changes: 10 additions & 10 deletions src/core/qgsogrutils.h
Expand Up @@ -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 );

};

Expand All @@ -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 );

};

Expand All @@ -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 );

};

Expand All @@ -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 );

};

Expand All @@ -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 );

};

Expand All @@ -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<OGRDataSourceH>::type, OGRDataSourceDeleter >;

This comment has been minimized.

Copy link
@nyalldawson

nyalldawson Apr 11, 2018

Collaborator

nice!


/**
* Scoped OGR geometry.
*/
using ogr_geometry_unique_ptr = std::unique_ptr< void, OGRGeometryDeleter>;
using ogr_geometry_unique_ptr = std::unique_ptr< std::remove_pointer<OGRGeometryH>::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<OGRFieldDefnH>::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<OGRFeatureH>::type, OGRFeatureDeleter >;

/**
* Scoped GDAL dataset.
*/
using dataset_unique_ptr = std::unique_ptr< void, GDALDatasetCloser >;
using dataset_unique_ptr = std::unique_ptr< std::remove_pointer<GDALDatasetH>::type, GDALDatasetCloser >;

/**
* Performs a fast close of an unwanted GDAL dataset handle by deleting the underlying
Expand Down
3 changes: 1 addition & 2 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 222e45b

Please sign in to comment.