mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
more nullptr updates (folloup 320c696)
This commit is contained in:
parent
c2d919a7a1
commit
8214608169
@ -39,7 +39,7 @@ Node& Node::operator=( const Node & n )
|
||||
if ( n.getPoint() )//mPoint of n is not a null pointer
|
||||
{
|
||||
mPoint = new Point3D( n.getPoint()->getX(), n.getPoint()->getY(), n.getPoint()->getZ() );
|
||||
if ( mPoint == nullptr )//no memory
|
||||
if ( !mPoint )//no memory
|
||||
{
|
||||
mPoint = tmp;
|
||||
mNext = n.getNext();
|
||||
@ -47,7 +47,7 @@ Node& Node::operator=( const Node & n )
|
||||
}
|
||||
|
||||
}
|
||||
else//mPoint of n is a null pointer
|
||||
else//mPoint of n is a nullptr
|
||||
{
|
||||
mPoint = nullptr;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int criterionNum, QVector<int>* resultTree, QVector<double>* resultCost )
|
||||
{
|
||||
QVector< double > * result = nullptr;
|
||||
if ( resultCost != nullptr )
|
||||
if ( resultCost )
|
||||
{
|
||||
result = resultCost;
|
||||
}
|
||||
@ -42,7 +42,7 @@ void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int
|
||||
result->insert( result->begin(), source->vertexCount(), std::numeric_limits<double>::infinity() );
|
||||
( *result )[ startPointIdx ] = 0.0;
|
||||
|
||||
if ( resultTree != nullptr )
|
||||
if ( resultTree )
|
||||
{
|
||||
resultTree->clear();
|
||||
resultTree->insert( resultTree->begin(), source->vertexCount(), -1 );
|
||||
@ -73,7 +73,7 @@ void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int
|
||||
if ( cost < ( *result )[ arc.inVertex()] )
|
||||
{
|
||||
( *result )[ arc.inVertex()] = cost;
|
||||
if ( resultTree != nullptr )
|
||||
if ( resultTree )
|
||||
{
|
||||
( *resultTree )[ arc.inVertex()] = *arcIt;
|
||||
}
|
||||
@ -81,7 +81,7 @@ void QgsGraphAnalyzer::dijkstra( const QgsGraph* source, int startPointIdx, int
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( resultCost == nullptr )
|
||||
if ( !resultCost )
|
||||
{
|
||||
delete result;
|
||||
}
|
||||
|
@ -29,8 +29,7 @@ QgsGraphBuilder::QgsGraphBuilder( const QgsCoordinateReferenceSystem& crs, bool
|
||||
|
||||
QgsGraphBuilder::~QgsGraphBuilder()
|
||||
{
|
||||
if ( mGraph != nullptr )
|
||||
delete mGraph;
|
||||
delete mGraph;
|
||||
}
|
||||
|
||||
void QgsGraphBuilder::addVertex( int, const QgsPoint& pt )
|
||||
|
@ -130,7 +130,7 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
|
||||
{
|
||||
QgsVectorLayer *vl = mVectorLayer;
|
||||
|
||||
if ( vl == nullptr )
|
||||
if ( !vl )
|
||||
return;
|
||||
|
||||
int featureCount = ( int ) vl->featureCount() * 2;
|
||||
|
@ -39,7 +39,7 @@ QgsOSMDatabase::~QgsOSMDatabase()
|
||||
|
||||
bool QgsOSMDatabase::isOpen() const
|
||||
{
|
||||
return mDatabase != nullptr;
|
||||
return nullptr != mDatabase;
|
||||
}
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ bool QgsOSMDatabase::close()
|
||||
deleteStatement( mStmtWayNodePoints );
|
||||
deleteStatement( mStmtWayTags );
|
||||
|
||||
Q_ASSERT( mStmtNode == nullptr );
|
||||
Q_ASSERT( !mStmtNode );
|
||||
|
||||
// close database
|
||||
if ( QgsSLConnect::sqlite3_close( mDatabase ) != SQLITE_OK )
|
||||
|
@ -232,7 +232,7 @@ bool QgsOSMXmlImport::closeDatabase()
|
||||
deleteStatement( mStmtInsertWayNode );
|
||||
deleteStatement( mStmtInsertWayTag );
|
||||
|
||||
Q_ASSERT( mStmtInsertNode == nullptr );
|
||||
Q_ASSERT( !mStmtInsertNode );
|
||||
|
||||
QgsSLConnect::sqlite3_close( mDatabase );
|
||||
mDatabase = nullptr;
|
||||
|
@ -458,7 +458,7 @@ bool QgsAlignRaster::createAndWarp( const Item& raster )
|
||||
|
||||
// Copy the color table, if required.
|
||||
GDALColorTableH hCT = GDALGetRasterColorTable( GDALGetRasterBand( hSrcDS, 1 ) );
|
||||
if ( hCT != nullptr )
|
||||
if ( hCT )
|
||||
GDALSetRasterColorTable( GDALGetRasterBand( hDstDS, 1 ), hCT );
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
@ -521,7 +521,7 @@ bool QgsAlignRaster::suggestedWarpOutput( const QgsAlignRaster::RasterInfo& info
|
||||
// Create a transformer that maps from source pixel/line coordinates
|
||||
// to destination georeferenced coordinates (not destination
|
||||
// pixel line). We do that by omitting the destination dataset
|
||||
// handle (setting it to NULL).
|
||||
// handle (setting it to nullptr).
|
||||
void* hTransformArg = GDALCreateGenImgProjTransformer( info.mDataset, info.mCrsWkt.toAscii().constData(), nullptr, destWkt.toAscii().constData(), FALSE, 0, 1 );
|
||||
if ( !hTransformArg )
|
||||
return false;
|
||||
|
@ -49,7 +49,7 @@ class ANALYSIS_EXPORT QgsAlignRaster
|
||||
~RasterInfo();
|
||||
|
||||
//! Check whether the given path is a valid raster
|
||||
bool isValid() const { return mDataset != nullptr; }
|
||||
bool isValid() const { return nullptr != mDataset; }
|
||||
|
||||
//! Return CRS in WKT format
|
||||
QString crs() const { return mCrsWkt; }
|
||||
@ -138,9 +138,9 @@ class ANALYSIS_EXPORT QgsAlignRaster
|
||||
virtual ~ProgressHandler() {}
|
||||
};
|
||||
|
||||
//! Assign a progress handler instance. Does not take ownership. NULL can be passed.
|
||||
//! Assign a progress handler instance. Does not take ownership. nullptr can be passed.
|
||||
void setProgressHandler( ProgressHandler* progressHandler ) { mProgressHandler = progressHandler; }
|
||||
//! Get associated progress handler. May be NULL (default)
|
||||
//! Get associated progress handler. May be nullptr (default)
|
||||
ProgressHandler* progressHandler() const { return mProgressHandler; }
|
||||
|
||||
//! Set list of rasters that will be aligned
|
||||
|
@ -60,27 +60,27 @@ int QgsNineCellFilter::processRaster( QProgressDialog* p )
|
||||
//open input file
|
||||
int xSize, ySize;
|
||||
GDALDatasetH inputDataset = openInputFile( xSize, ySize );
|
||||
if ( inputDataset == nullptr )
|
||||
if ( !inputDataset )
|
||||
{
|
||||
return 1; //opening of input file failed
|
||||
}
|
||||
|
||||
//output driver
|
||||
GDALDriverH outputDriver = openOutputDriver();
|
||||
if ( outputDriver == nullptr )
|
||||
if ( !outputDriver )
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
GDALDatasetH outputDataset = openOutputFile( inputDataset, outputDriver );
|
||||
if ( outputDataset == nullptr )
|
||||
if ( !outputDataset )
|
||||
{
|
||||
return 3; //create operation on output file failed
|
||||
}
|
||||
|
||||
//open first raster band for reading (operation is only for single band raster)
|
||||
GDALRasterBandH rasterBand = GDALGetRasterBand( inputDataset, 1 );
|
||||
if ( rasterBand == nullptr )
|
||||
if ( !rasterBand )
|
||||
{
|
||||
GDALClose( inputDataset );
|
||||
GDALClose( outputDataset );
|
||||
@ -89,7 +89,7 @@ int QgsNineCellFilter::processRaster( QProgressDialog* p )
|
||||
mInputNodataValue = GDALGetRasterNoDataValue( rasterBand, nullptr );
|
||||
|
||||
GDALRasterBandH outputRasterBand = GDALGetRasterBand( outputDataset, 1 );
|
||||
if ( outputRasterBand == nullptr )
|
||||
if ( !outputRasterBand )
|
||||
{
|
||||
GDALClose( inputDataset );
|
||||
GDALClose( outputDataset );
|
||||
@ -209,7 +209,7 @@ int QgsNineCellFilter::processRaster( QProgressDialog* p )
|
||||
GDALDatasetH QgsNineCellFilter::openInputFile( int& nCellsX, int& nCellsY )
|
||||
{
|
||||
GDALDatasetH inputDataset = GDALOpen( TO8F( mInputFile ), GA_ReadOnly );
|
||||
if ( inputDataset != nullptr )
|
||||
if ( inputDataset )
|
||||
{
|
||||
nCellsX = GDALGetRasterXSize( inputDataset );
|
||||
nCellsY = GDALGetRasterYSize( inputDataset );
|
||||
@ -231,9 +231,9 @@ GDALDriverH QgsNineCellFilter::openOutputDriver()
|
||||
//open driver
|
||||
GDALDriverH outputDriver = GDALGetDriverByName( mOutputFormat.toLocal8Bit().data() );
|
||||
|
||||
if ( outputDriver == nullptr )
|
||||
if ( !outputDriver )
|
||||
{
|
||||
return outputDriver; //return NULL, driver does not exist
|
||||
return outputDriver; //return nullptr, driver does not exist
|
||||
}
|
||||
|
||||
driverMetadata = GDALGetMetadata( outputDriver, nullptr );
|
||||
@ -247,7 +247,7 @@ GDALDriverH QgsNineCellFilter::openOutputDriver()
|
||||
|
||||
GDALDatasetH QgsNineCellFilter::openOutputFile( GDALDatasetH inputDataset, GDALDriverH outputDriver )
|
||||
{
|
||||
if ( inputDataset == nullptr )
|
||||
if ( !inputDataset )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@ -258,7 +258,7 @@ GDALDatasetH QgsNineCellFilter::openOutputFile( GDALDatasetH inputDataset, GDALD
|
||||
//open output file
|
||||
char **papszOptions = nullptr;
|
||||
GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), xSize, ySize, 1, GDT_Float32, papszOptions );
|
||||
if ( outputDataset == nullptr )
|
||||
if ( !outputDataset )
|
||||
{
|
||||
return outputDataset;
|
||||
}
|
||||
|
@ -64,10 +64,10 @@ class ANALYSIS_EXPORT QgsNineCellFilter
|
||||
/** Opens the input file and returns the dataset handle and the number of pixels in x-/y- direction*/
|
||||
GDALDatasetH openInputFile( int& nCellsX, int& nCellsY );
|
||||
/** Opens the output driver and tests if it supports the creation of a new dataset
|
||||
@return NULL on error and the driver handle on success*/
|
||||
@return nullptr on error and the driver handle on success*/
|
||||
GDALDriverH openOutputDriver();
|
||||
/** Opens the output file and sets the same geotransform and CRS as the input data
|
||||
@return the output dataset or NULL in case of error*/
|
||||
@return the output dataset or nullptr in case of error*/
|
||||
GDALDatasetH openOutputFile( GDALDatasetH inputDataset, GDALDriverH outputDriver );
|
||||
|
||||
protected:
|
||||
|
@ -148,7 +148,7 @@ QgsRasterCalcNode* localParseRasterCalcString(const QString& str, QString& parse
|
||||
// remove nodes without parents - to prevent memory leaks
|
||||
while (gTmpNodes.size() > 0)
|
||||
delete gTmpNodes.takeFirst();
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ int QgsRasterCalculator::processCalculation( QProgressDialog* p )
|
||||
|
||||
//open output dataset for writing
|
||||
GDALDriverH outputDriver = openOutputDriver();
|
||||
if ( outputDriver == nullptr )
|
||||
if ( !outputDriver )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
@ -194,9 +194,9 @@ GDALDriverH QgsRasterCalculator::openOutputDriver()
|
||||
//open driver
|
||||
GDALDriverH outputDriver = GDALGetDriverByName( mOutputFormat.toLocal8Bit().data() );
|
||||
|
||||
if ( outputDriver == nullptr )
|
||||
if ( !outputDriver )
|
||||
{
|
||||
return outputDriver; //return NULL, driver does not exist
|
||||
return outputDriver; //return nullptr, driver does not exist
|
||||
}
|
||||
|
||||
driverMetadata = GDALGetMetadata( outputDriver, nullptr );
|
||||
@ -213,7 +213,7 @@ GDALDatasetH QgsRasterCalculator::openOutputFile( GDALDriverH outputDriver )
|
||||
//open output file
|
||||
char **papszOptions = nullptr;
|
||||
GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), mNumOutputColumns, mNumOutputRows, 1, GDT_Float32, papszOptions );
|
||||
if ( outputDataset == nullptr )
|
||||
if ( !outputDataset )
|
||||
{
|
||||
return outputDataset;
|
||||
}
|
||||
|
@ -79,11 +79,11 @@ class ANALYSIS_EXPORT QgsRasterCalculator
|
||||
QgsRasterCalculator();
|
||||
|
||||
/** Opens the output driver and tests if it supports the creation of a new dataset
|
||||
@return NULL on error and the driver handle on success*/
|
||||
@return nullptr on error and the driver handle on success*/
|
||||
GDALDriverH openOutputDriver();
|
||||
|
||||
/** Opens the output file and sets the same geotransform and CRS as the input data
|
||||
@return the output dataset or NULL in case of error*/
|
||||
@return the output dataset or nullptr in case of error*/
|
||||
GDALDatasetH openOutputFile( GDALDriverH outputDriver );
|
||||
|
||||
/** Sets gdal 6 parameters array from mOutputRectangle, mNumOutputColumns, mNumOutputRows
|
||||
|
@ -88,20 +88,20 @@ int QgsRelief::processRaster( QProgressDialog* p )
|
||||
//open input file
|
||||
int xSize, ySize;
|
||||
GDALDatasetH inputDataset = openInputFile( xSize, ySize );
|
||||
if ( inputDataset == nullptr )
|
||||
if ( !inputDataset )
|
||||
{
|
||||
return 1; //opening of input file failed
|
||||
}
|
||||
|
||||
//output driver
|
||||
GDALDriverH outputDriver = openOutputDriver();
|
||||
if ( outputDriver == nullptr )
|
||||
if ( !outputDriver )
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
GDALDatasetH outputDataset = openOutputFile( inputDataset, outputDriver );
|
||||
if ( outputDataset == nullptr )
|
||||
if ( !outputDataset )
|
||||
{
|
||||
return 3; //create operation on output file failed
|
||||
}
|
||||
@ -125,7 +125,7 @@ int QgsRelief::processRaster( QProgressDialog* p )
|
||||
|
||||
//open first raster band for reading (operation is only for single band raster)
|
||||
GDALRasterBandH rasterBand = GDALGetRasterBand( inputDataset, 1 );
|
||||
if ( rasterBand == nullptr )
|
||||
if ( !rasterBand )
|
||||
{
|
||||
GDALClose( inputDataset );
|
||||
GDALClose( outputDataset );
|
||||
@ -142,7 +142,7 @@ int QgsRelief::processRaster( QProgressDialog* p )
|
||||
GDALRasterBandH outputGreenBand = GDALGetRasterBand( outputDataset, 2 );
|
||||
GDALRasterBandH outputBlueBand = GDALGetRasterBand( outputDataset, 3 );
|
||||
|
||||
if ( outputRedBand == nullptr || outputGreenBand == nullptr || outputBlueBand == nullptr )
|
||||
if ( !outputRedBand || !outputGreenBand || !outputBlueBand )
|
||||
{
|
||||
GDALClose( inputDataset );
|
||||
GDALClose( outputDataset );
|
||||
@ -398,7 +398,7 @@ bool QgsRelief::setElevationColor( double elevation, int* red, int* green, int*
|
||||
GDALDatasetH QgsRelief::openInputFile( int& nCellsX, int& nCellsY )
|
||||
{
|
||||
GDALDatasetH inputDataset = GDALOpen( TO8F( mInputFile ), GA_ReadOnly );
|
||||
if ( inputDataset != nullptr )
|
||||
if ( inputDataset )
|
||||
{
|
||||
nCellsX = GDALGetRasterXSize( inputDataset );
|
||||
nCellsY = GDALGetRasterYSize( inputDataset );
|
||||
@ -420,9 +420,9 @@ GDALDriverH QgsRelief::openOutputDriver()
|
||||
//open driver
|
||||
GDALDriverH outputDriver = GDALGetDriverByName( mOutputFormat.toLocal8Bit().data() );
|
||||
|
||||
if ( outputDriver == nullptr )
|
||||
if ( !outputDriver )
|
||||
{
|
||||
return outputDriver; //return NULL, driver does not exist
|
||||
return outputDriver; //return nullptr, driver does not exist
|
||||
}
|
||||
|
||||
driverMetadata = GDALGetMetadata( outputDriver, nullptr );
|
||||
@ -436,7 +436,7 @@ GDALDriverH QgsRelief::openOutputDriver()
|
||||
|
||||
GDALDatasetH QgsRelief::openOutputFile( GDALDatasetH inputDataset, GDALDriverH outputDriver )
|
||||
{
|
||||
if ( inputDataset == nullptr )
|
||||
if ( !inputDataset )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@ -452,7 +452,7 @@ GDALDatasetH QgsRelief::openOutputFile( GDALDatasetH inputDataset, GDALDriverH o
|
||||
|
||||
//create three band raster (reg, green, blue)
|
||||
GDALDatasetH outputDataset = GDALCreate( outputDriver, TO8F( mOutputFile ), xSize, ySize, 3, GDT_Byte, papszOptions );
|
||||
if ( outputDataset == nullptr )
|
||||
if ( !outputDataset )
|
||||
{
|
||||
return outputDataset;
|
||||
}
|
||||
@ -489,14 +489,14 @@ bool QgsRelief::exportFrequencyDistributionToCsv( const QString& file )
|
||||
{
|
||||
int nCellsX, nCellsY;
|
||||
GDALDatasetH inputDataset = openInputFile( nCellsX, nCellsY );
|
||||
if ( inputDataset == nullptr )
|
||||
if ( !inputDataset )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//open first raster band for reading (elevation raster is always single band)
|
||||
GDALRasterBandH elevationBand = GDALGetRasterBand( inputDataset, 1 );
|
||||
if ( elevationBand == nullptr )
|
||||
if ( !elevationBand )
|
||||
{
|
||||
GDALClose( inputDataset );
|
||||
return false;
|
||||
@ -572,14 +572,14 @@ QList< QgsRelief::ReliefColor > QgsRelief::calculateOptimizedReliefClasses()
|
||||
|
||||
int nCellsX, nCellsY;
|
||||
GDALDatasetH inputDataset = openInputFile( nCellsX, nCellsY );
|
||||
if ( inputDataset == nullptr )
|
||||
if ( !inputDataset )
|
||||
{
|
||||
return resultList;
|
||||
}
|
||||
|
||||
//open first raster band for reading (elevation raster is always single band)
|
||||
GDALRasterBandH elevationBand = GDALGetRasterBand( inputDataset, 1 );
|
||||
if ( elevationBand == nullptr )
|
||||
if ( !elevationBand )
|
||||
{
|
||||
GDALClose( inputDataset );
|
||||
return resultList;
|
||||
|
@ -94,10 +94,10 @@ class ANALYSIS_EXPORT QgsRelief
|
||||
/** Opens the input file and returns the dataset handle and the number of pixels in x-/y- direction*/
|
||||
GDALDatasetH openInputFile( int& nCellsX, int& nCellsY );
|
||||
/** Opens the output driver and tests if it supports the creation of a new dataset
|
||||
@return NULL on error and the driver handle on success*/
|
||||
@return nullptr on error and the driver handle on success*/
|
||||
GDALDriverH openOutputDriver();
|
||||
/** Opens the output file and sets the same geotransform and CRS as the input data
|
||||
@return the output dataset or NULL in case of error*/
|
||||
@return the output dataset or nullptr in case of error*/
|
||||
GDALDatasetH openOutputFile( GDALDatasetH inputDataset, GDALDriverH outputDriver );
|
||||
|
||||
/** Set elevation color*/
|
||||
|
@ -72,7 +72,7 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
|
||||
//open the raster layer and the raster band
|
||||
GDALAllRegister();
|
||||
GDALDatasetH inputDataset = GDALOpen( TO8F( mRasterFilePath ), GA_ReadOnly );
|
||||
if ( inputDataset == nullptr )
|
||||
if ( !inputDataset )
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
@ -84,7 +84,7 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
|
||||
}
|
||||
|
||||
GDALRasterBandH rasterBand = GDALGetRasterBand( inputDataset, mRasterBand );
|
||||
if ( rasterBand == nullptr )
|
||||
if ( !rasterBand )
|
||||
{
|
||||
GDALClose( inputDataset );
|
||||
return 5;
|
||||
|
@ -237,7 +237,7 @@ QList< GroupLayerInfo > QgsAppLegendInterface::groupLayerRelationship()
|
||||
|
||||
bool QgsAppLegendInterface::groupExists( int groupIndex )
|
||||
{
|
||||
return groupIndexToNode( groupIndex ) != nullptr;
|
||||
return nullptr != groupIndexToNode( groupIndex );
|
||||
}
|
||||
|
||||
bool QgsAppLegendInterface::isGroupExpanded( int groupIndex )
|
||||
|
@ -256,7 +256,7 @@ static void dumpBacktrace( unsigned int depth )
|
||||
SymSetOptions( SYMOPT_DEFERRED_LOADS | SYMOPT_INCLUDE_32BIT_MODULES | SYMOPT_UNDNAME );
|
||||
SymInitialize( GetCurrentProcess(), "http://msdl.microsoft.com/download/symbols;http://download.osgeo.org/osgeo4w/symstore", TRUE );
|
||||
|
||||
unsigned short nFrames = CaptureStackBackTrace( 1, depth, buffer, NULL );
|
||||
unsigned short nFrames = CaptureStackBackTrace( 1, depth, buffer, nullptr );
|
||||
SYMBOL_INFO *symbol = ( SYMBOL_INFO * ) qgsMalloc( sizeof( SYMBOL_INFO ) + 256 );
|
||||
symbol->MaxNameLen = 255;
|
||||
symbol->SizeOfStruct = sizeof( SYMBOL_INFO );
|
||||
@ -307,7 +307,7 @@ void qgisCrash( int signal )
|
||||
if ( gdbpid == 0 )
|
||||
{
|
||||
// attach, backtrace and continue
|
||||
execl( "/usr/bin/gdb", "gdb", "-q", "-batch", "-n", pidstr, "-ex", "thread", "-ex", "bt full", exename, NULL );
|
||||
execl( "/usr/bin/gdb", "gdb", "-q", "-batch", "-n", pidstr, "-ex", "thread", "-ex", "bt full", exename, nullptr );
|
||||
perror( "cannot exec gdb" );
|
||||
exit( 1 );
|
||||
}
|
||||
@ -720,7 +720,7 @@ int main( int argc, char *argv[] )
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(ANDROID)
|
||||
bool myUseGuiFlag = getenv( "DISPLAY" ) != nullptr;
|
||||
bool myUseGuiFlag = nullptr != getenv( "DISPLAY" );
|
||||
#else
|
||||
bool myUseGuiFlag = true;
|
||||
#endif
|
||||
|
@ -89,7 +89,7 @@ void QgsNewOgrConnection::testConnection()
|
||||
OGRSFDriverH pahDriver;
|
||||
CPLErrorReset();
|
||||
poDS = OGROpen( TO8F( uri ), false, &pahDriver );
|
||||
if ( poDS == nullptr )
|
||||
if ( !poDS )
|
||||
{
|
||||
QMessageBox::information( this, tr( "Test connection" ), tr( "Connection failed - Check settings and try again.\n\nExtended error information:\n%1" ).arg( QString::fromUtf8( CPLGetLastErrorMsg() ) ) );
|
||||
}
|
||||
|
@ -3491,7 +3491,7 @@ void QgisApp::loadGDALSublayers( const QString& uri, const QStringList& list )
|
||||
}
|
||||
|
||||
// This method is the method that does the real job. If the layer given in
|
||||
// parameter is NULL, then the method tries to act on the activeLayer.
|
||||
// parameter is nullptr, then the method tries to act on the activeLayer.
|
||||
void QgisApp::askUserForOGRSublayers( QgsVectorLayer *layer )
|
||||
{
|
||||
if ( !layer )
|
||||
@ -4559,15 +4559,11 @@ void QgisApp::openLayerDefinition( const QString & path )
|
||||
void QgisApp::openProject( QAction *action )
|
||||
{
|
||||
// possibly save any pending work before opening a different project
|
||||
QString debugme;
|
||||
assert( action != nullptr );
|
||||
|
||||
debugme = action->data().toString();
|
||||
Q_ASSERT( action );
|
||||
|
||||
QString debugme = action->data().toString();
|
||||
if ( saveDirty() )
|
||||
{
|
||||
addProject( debugme );
|
||||
}
|
||||
|
||||
//set the projections enabled icon in the status bar
|
||||
int myProjectionEnabledFlag =
|
||||
@ -8217,8 +8213,8 @@ void QgisApp::openURL( QString url, bool useQgisDocDirectory )
|
||||
*/
|
||||
CFURLRef urlRef = CFURLCreateWithBytes( kCFAllocatorDefault,
|
||||
reinterpret_cast<const UInt8*>( url.toUtf8().data() ), url.length(),
|
||||
kCFStringEncodingUTF8, NULL );
|
||||
OSStatus status = LSOpenCFURLRef( urlRef, NULL );
|
||||
kCFStringEncodingUTF8, nullptr );
|
||||
OSStatus status = LSOpenCFURLRef( urlRef, nullptr );
|
||||
status = 0; //avoid compiler warning
|
||||
CFRelease( urlRef );
|
||||
#elif defined(Q_OS_WIN)
|
||||
@ -9840,7 +9836,7 @@ void QgisApp::refreshActionFeatureAction()
|
||||
{
|
||||
QgsMapLayer* layer = activeLayer();
|
||||
|
||||
if ( layer == nullptr || layer->type() != QgsMapLayer::VectorLayer )
|
||||
if ( !layer || layer->type() != QgsMapLayer::VectorLayer )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -10279,7 +10275,7 @@ void QgisApp::oldProjectVersionWarning( const QString& oldVersion )
|
||||
|
||||
#ifdef ANDROID
|
||||
//this is needed to deal with https://hub.qgis.org/issues/4573
|
||||
QMessageBox box( QMessageBox::Warning, title, tr( "This project file was saved by an older version of QGIS" ), QMessageBox::Ok, NULL );
|
||||
QMessageBox box( QMessageBox::Warning, title, tr( "This project file was saved by an older version of QGIS" ), QMessageBox::Ok, nullptr );
|
||||
box.setDetailedText(
|
||||
text.remove( 0, 3 )
|
||||
.replace( QString( "<p>" ), QString( "\n\n" ) )
|
||||
@ -10408,7 +10404,7 @@ void QgisApp::showLayerProperties( QgsMapLayer *ml )
|
||||
if ( ml->type() == QgsMapLayer::RasterLayer )
|
||||
{
|
||||
#if 0 // See note above about reusing this
|
||||
QgsRasterLayerProperties *rlp = NULL;
|
||||
QgsRasterLayerProperties *rlp = nullptr;
|
||||
if ( rlp )
|
||||
{
|
||||
rlp->sync();
|
||||
@ -10430,7 +10426,7 @@ void QgisApp::showLayerProperties( QgsMapLayer *ml )
|
||||
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( ml );
|
||||
|
||||
#if 0 // See note above about reusing this
|
||||
QgsVectorLayerProperties *vlp = NULL;
|
||||
QgsVectorLayerProperties *vlp = nullptr;
|
||||
if ( vlp )
|
||||
{
|
||||
vlp->syncToLayer();
|
||||
@ -10906,7 +10902,7 @@ LONG WINAPI QgisApp::qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo )
|
||||
ExpParam.ExceptionPointers = ExceptionInfo;
|
||||
ExpParam.ClientPointers = TRUE;
|
||||
|
||||
if ( MiniDumpWriteDump( GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpWithDataSegs, ExceptionInfo ? &ExpParam : NULL, NULL, NULL ) )
|
||||
if ( MiniDumpWriteDump( GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpWithDataSegs, ExceptionInfo ? &ExpParam : nullptr, nullptr, nullptr ) )
|
||||
{
|
||||
msg = QObject::tr( "minidump written to %1" ).arg( dumpName );
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ void QgsAttributeTableDialog::closeEvent( QCloseEvent* event )
|
||||
{
|
||||
QDialog::closeEvent( event );
|
||||
|
||||
if ( mDock == nullptr )
|
||||
if ( !mDock )
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue( "/Windows/BetterAttributeTable/geometry", saveGeometry() );
|
||||
@ -434,7 +434,7 @@ void QgsAttributeTableDialog::filterColumnChanged( QObject* filterAction )
|
||||
mFilterButton->setPopupMode( QToolButton::InstantPopup );
|
||||
// replace the search line edit with a search widget that is suited to the selected field
|
||||
// delete previous widget
|
||||
if ( mCurrentSearchWidgetWrapper != nullptr )
|
||||
if ( mCurrentSearchWidgetWrapper )
|
||||
{
|
||||
mCurrentSearchWidgetWrapper->widget()->setVisible( false );
|
||||
delete mCurrentSearchWidgetWrapper;
|
||||
@ -491,7 +491,7 @@ void QgsAttributeTableDialog::filterShowAll()
|
||||
mFilterButton->setDefaultAction( mActionShowAllFilter );
|
||||
mFilterButton->setPopupMode( QToolButton::InstantPopup );
|
||||
mFilterQuery->setVisible( false );
|
||||
if ( mCurrentSearchWidgetWrapper != nullptr )
|
||||
if ( mCurrentSearchWidgetWrapper )
|
||||
{
|
||||
mCurrentSearchWidgetWrapper->widget()->setVisible( false );
|
||||
}
|
||||
@ -747,7 +747,7 @@ void QgsAttributeTableDialog::filterQueryChanged( const QString& query )
|
||||
void QgsAttributeTableDialog::filterQueryAccepted()
|
||||
{
|
||||
if (( mFilterQuery->isVisible() && mFilterQuery->text().isEmpty() ) ||
|
||||
( mCurrentSearchWidgetWrapper != nullptr && mCurrentSearchWidgetWrapper->widget()->isVisible()
|
||||
( mCurrentSearchWidgetWrapper && mCurrentSearchWidgetWrapper->widget()->isVisible()
|
||||
&& mCurrentSearchWidgetWrapper->expression().isEmpty() ) )
|
||||
{
|
||||
filterShowAll();
|
||||
@ -763,14 +763,14 @@ void QgsAttributeTableDialog::openConditionalStyles()
|
||||
|
||||
void QgsAttributeTableDialog::setFilterExpression( const QString& filterString )
|
||||
{
|
||||
if ( mCurrentSearchWidgetWrapper == nullptr || !mCurrentSearchWidgetWrapper->applyDirectly() )
|
||||
if ( !mCurrentSearchWidgetWrapper || !mCurrentSearchWidgetWrapper->applyDirectly() )
|
||||
{
|
||||
mFilterQuery->setText( filterString );
|
||||
mFilterButton->setDefaultAction( mActionAdvancedFilter );
|
||||
mFilterButton->setPopupMode( QToolButton::MenuButtonPopup );
|
||||
mFilterQuery->setVisible( true );
|
||||
mApplyFilterButton->setVisible( true );
|
||||
if ( mCurrentSearchWidgetWrapper != nullptr )
|
||||
if ( mCurrentSearchWidgetWrapper )
|
||||
{
|
||||
// replace search widget widget with the normal filter query line edit
|
||||
replaceSearchWidget( mCurrentSearchWidgetWrapper->widget(), mFilterQuery );
|
||||
|
@ -141,7 +141,7 @@ void QgsBrowserLayerProperties::setItem( QgsDataItem* item )
|
||||
QgsDebugMsg( "creating raster layer" );
|
||||
// should copy code from addLayer() to split uri ?
|
||||
QgsRasterLayer* layer = new QgsRasterLayer( layerItem->uri(), layerItem->uri(), layerItem->providerKey() );
|
||||
if ( layer != nullptr )
|
||||
if ( layer )
|
||||
{
|
||||
if ( layer->isValid() )
|
||||
{
|
||||
@ -155,7 +155,7 @@ void QgsBrowserLayerProperties::setItem( QgsDataItem* item )
|
||||
{
|
||||
QgsDebugMsg( "creating vector layer" );
|
||||
QgsVectorLayer* layer = new QgsVectorLayer( layerItem->uri(), layerItem->name(), layerItem->providerKey() );
|
||||
if ( layer != nullptr )
|
||||
if ( layer )
|
||||
{
|
||||
if ( layer->isValid() )
|
||||
{
|
||||
@ -511,7 +511,7 @@ void QgsBrowserDockWidget::refreshModel( const QModelIndex& index )
|
||||
|
||||
void QgsBrowserDockWidget::addLayer( QgsLayerItem *layerItem )
|
||||
{
|
||||
if ( layerItem == nullptr )
|
||||
if ( !layerItem )
|
||||
return;
|
||||
|
||||
QString uri = QgisApp::instance()->crsAndFormatAdjustedLayerUri( layerItem->uri(), layerItem->supportedCRS(), layerItem->supportedFormats() );
|
||||
@ -541,20 +541,20 @@ void QgsBrowserDockWidget::addLayerAtIndex( const QModelIndex& index )
|
||||
QgsDebugMsg( QString( "rowCount() = %1" ).arg( mModel->rowCount( mProxyModel->mapToSource( index ) ) ) );
|
||||
QgsDataItem *item = mModel->dataItem( mProxyModel->mapToSource( index ) );
|
||||
|
||||
if ( item != nullptr && item->type() == QgsDataItem::Project )
|
||||
if ( item && item->type() == QgsDataItem::Project )
|
||||
{
|
||||
QgsProjectItem *projectItem = qobject_cast<QgsProjectItem*>( item );
|
||||
if ( projectItem != nullptr )
|
||||
if ( projectItem )
|
||||
{
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
QgisApp::instance()->openFile( projectItem->path() );
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
}
|
||||
if ( item != nullptr && item->type() == QgsDataItem::Layer )
|
||||
if ( item && item->type() == QgsDataItem::Layer )
|
||||
{
|
||||
QgsLayerItem *layerItem = qobject_cast<QgsLayerItem*>( item );
|
||||
if ( layerItem != nullptr )
|
||||
if ( layerItem )
|
||||
{
|
||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||
addLayer( layerItem );
|
||||
|
@ -255,7 +255,7 @@ void QgsConfigureShortcutsDialog::setNoShortcut()
|
||||
|
||||
QAction* QgsConfigureShortcutsDialog::currentAction()
|
||||
{
|
||||
if ( treeActions->currentItem() == nullptr )
|
||||
if ( !treeActions->currentItem() )
|
||||
return nullptr;
|
||||
|
||||
QObject* action = treeActions->currentItem()->data( 0, Qt::UserRole ).value<QObject*>();
|
||||
@ -397,7 +397,7 @@ void QgsConfigureShortcutsDialog::setCurrentActionShortcut( const QKeySequence&
|
||||
|
||||
// first check whether this action is not taken already
|
||||
QAction* otherAction = QgsShortcutsManager::instance()->actionForShortcut( s );
|
||||
if ( otherAction != nullptr )
|
||||
if ( otherAction )
|
||||
{
|
||||
QString otherActionText = otherAction->text();
|
||||
otherActionText.remove( '&' ); // remove the accelerator
|
||||
|
@ -618,7 +618,7 @@ QStringList QgsCustomization::mInternalWidgets = QStringList() << "qt_tabwidget
|
||||
QgsCustomization *QgsCustomization::pinstance = nullptr;
|
||||
QgsCustomization *QgsCustomization::instance()
|
||||
{
|
||||
if ( pinstance == nullptr )
|
||||
if ( !pinstance )
|
||||
{
|
||||
pinstance = new QgsCustomization();
|
||||
}
|
||||
|
@ -463,7 +463,7 @@ void QgsCustomProjectionDialog::on_pbnCalculate_clicked()
|
||||
|
||||
QgsDebugMsg( QString( "My proj: %1" ).arg( teParameters->toPlainText() ) );
|
||||
|
||||
if ( myProj == nullptr )
|
||||
if ( !myProj )
|
||||
{
|
||||
QMessageBox::information( this, tr( "QGIS Custom Projection" ),
|
||||
tr( "This proj4 projection definition is not valid." ) );
|
||||
@ -490,7 +490,7 @@ void QgsCustomProjectionDialog::on_pbnCalculate_clicked()
|
||||
|
||||
projPJ wgs84Proj = pj_init_plus( GEOPROJ4.toLocal8Bit().data() ); //defined in qgis.h
|
||||
|
||||
if ( wgs84Proj == nullptr )
|
||||
if ( !wgs84Proj )
|
||||
{
|
||||
QMessageBox::information( this, tr( "QGIS Custom Projection" ),
|
||||
tr( "Internal Error (source projection invalid?)" ) );
|
||||
|
@ -385,7 +385,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeat
|
||||
{
|
||||
QTreeWidgetItem *layItem = layerItem( vlayer );
|
||||
|
||||
if ( layItem == nullptr )
|
||||
if ( !layItem )
|
||||
{
|
||||
layItem = new QTreeWidgetItem( QStringList() << vlayer->name() );
|
||||
layItem->setData( 0, Qt::UserRole, QVariant::fromValue( qobject_cast<QObject *>( vlayer ) ) );
|
||||
@ -674,7 +674,7 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,
|
||||
|
||||
QgsRaster::IdentifyFormat currentFormat = QgsRasterDataProvider::identifyFormatFromName( layer->customProperty( "identify/format" ).toString() );
|
||||
|
||||
if ( layItem == nullptr )
|
||||
if ( !layItem )
|
||||
{
|
||||
layItem = new QTreeWidgetItem( QStringList() << QString::number( lstResults->topLevelItemCount() ) << layer->name() );
|
||||
layItem->setData( 0, Qt::UserRole, QVariant::fromValue( qobject_cast<QObject *>( layer ) ) );
|
||||
@ -933,7 +933,7 @@ void QgsIdentifyResultsDialog::contextMenuEvent( QContextMenuEvent* event )
|
||||
QgsMapLayer *layer = vectorLayer( item );
|
||||
QgsVectorLayer *vlayer = vectorLayer( item );
|
||||
QgsRasterLayer *rlayer = rasterLayer( item );
|
||||
if ( vlayer == nullptr && rlayer == nullptr )
|
||||
if ( !vlayer && !rlayer )
|
||||
{
|
||||
QgsDebugMsg( "Item does not belong to a layer." );
|
||||
return;
|
||||
@ -1333,7 +1333,7 @@ void QgsIdentifyResultsDialog::handleCurrentItemChanged( QTreeWidgetItem *curren
|
||||
for ( int i = 0; i < current->childCount(); i++ )
|
||||
{
|
||||
QgsIdentifyResultsWebViewItem *wv = dynamic_cast<QgsIdentifyResultsWebViewItem*>( current->child( i ) );
|
||||
if ( wv != nullptr )
|
||||
if ( wv )
|
||||
{
|
||||
mActionPrint->setEnabled( true );
|
||||
break;
|
||||
|
@ -91,7 +91,7 @@ void QgsMapToolMeasureAngle::canvasReleaseEvent( QgsMapMouseEvent* e )
|
||||
|
||||
if ( mAnglePoints.size() < 1 )
|
||||
{
|
||||
if ( mResultDisplay == nullptr )
|
||||
if ( !mResultDisplay )
|
||||
{
|
||||
mResultDisplay = new QgsDisplayAngle( this, Qt::WindowStaysOnTopHint );
|
||||
QObject::connect( mResultDisplay, SIGNAL( rejected() ), this, SLOT( stopMeasuring() ) );
|
||||
|
@ -40,10 +40,9 @@ QgsMapToolSelect::QgsMapToolSelect( QgsMapCanvas* canvas )
|
||||
void QgsMapToolSelect::canvasReleaseEvent( QgsMapMouseEvent* e )
|
||||
{
|
||||
QgsVectorLayer* vlayer = QgsMapToolSelectUtils::getCurrentVectorLayer( mCanvas );
|
||||
if ( vlayer == nullptr )
|
||||
{
|
||||
if ( !vlayer )
|
||||
return;
|
||||
}
|
||||
|
||||
QgsRubberBand rubberBand( mCanvas, QGis::Polygon );
|
||||
rubberBand.setFillColor( mFillColor );
|
||||
rubberBand.setBorderColor( mBorderColour );
|
||||
|
@ -41,10 +41,9 @@ QgsMapToolSelectFreehand::~QgsMapToolSelectFreehand()
|
||||
void QgsMapToolSelectFreehand::canvasPressEvent( QgsMapMouseEvent* e )
|
||||
{
|
||||
if ( e->button() != Qt::LeftButton )
|
||||
{
|
||||
return;
|
||||
}
|
||||
if ( mRubberBand == nullptr )
|
||||
|
||||
if ( !mRubberBand )
|
||||
{
|
||||
mRubberBand = new QgsRubberBand( mCanvas, QGis::Polygon );
|
||||
mRubberBand->setFillColor( mFillColor );
|
||||
@ -57,20 +56,18 @@ void QgsMapToolSelectFreehand::canvasPressEvent( QgsMapMouseEvent* e )
|
||||
|
||||
void QgsMapToolSelectFreehand::canvasMoveEvent( QgsMapMouseEvent* e )
|
||||
{
|
||||
if ( !mDragging || mRubberBand == nullptr )
|
||||
{
|
||||
if ( !mDragging || !mRubberBand )
|
||||
return;
|
||||
}
|
||||
|
||||
mRubberBand->addPoint( toMapCoordinates( e->pos() ) );
|
||||
}
|
||||
|
||||
|
||||
void QgsMapToolSelectFreehand::canvasReleaseEvent( QgsMapMouseEvent* e )
|
||||
{
|
||||
if ( mRubberBand == nullptr )
|
||||
{
|
||||
if ( !mRubberBand )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mRubberBand->numberOfVertices() > 2 )
|
||||
{
|
||||
QgsGeometry* shapeGeom = mRubberBand->asGeometry();
|
||||
|
@ -39,7 +39,7 @@ QgsMapToolSelectPolygon::~QgsMapToolSelectPolygon()
|
||||
|
||||
void QgsMapToolSelectPolygon::canvasPressEvent( QgsMapMouseEvent* e )
|
||||
{
|
||||
if ( mRubberBand == nullptr )
|
||||
if ( !mRubberBand )
|
||||
{
|
||||
mRubberBand = new QgsRubberBand( mCanvas, QGis::Polygon );
|
||||
mRubberBand->setFillColor( mFillColor );
|
||||
@ -65,10 +65,9 @@ void QgsMapToolSelectPolygon::canvasPressEvent( QgsMapMouseEvent* e )
|
||||
|
||||
void QgsMapToolSelectPolygon::canvasMoveEvent( QgsMapMouseEvent* e )
|
||||
{
|
||||
if ( mRubberBand == nullptr )
|
||||
{
|
||||
if ( !mRubberBand )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mRubberBand->numberOfVertices() > 0 )
|
||||
{
|
||||
mRubberBand->removeLastPoint( 0 );
|
||||
|
@ -47,9 +47,8 @@ QgsMapToolSelectRadius::~QgsMapToolSelectRadius()
|
||||
void QgsMapToolSelectRadius::canvasPressEvent( QgsMapMouseEvent* e )
|
||||
{
|
||||
if ( e->button() != Qt::LeftButton )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mRadiusCenter = toMapCoordinates( e->pos() );
|
||||
}
|
||||
|
||||
@ -57,12 +56,11 @@ void QgsMapToolSelectRadius::canvasPressEvent( QgsMapMouseEvent* e )
|
||||
void QgsMapToolSelectRadius::canvasMoveEvent( QgsMapMouseEvent* e )
|
||||
{
|
||||
if ( e->buttons() != Qt::LeftButton )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !mDragging )
|
||||
{
|
||||
if ( mRubberBand == nullptr )
|
||||
if ( !mRubberBand )
|
||||
{
|
||||
mRubberBand = new QgsRubberBand( mCanvas, QGis::Polygon );
|
||||
mRubberBand->setFillColor( mFillColor );
|
||||
@ -78,12 +76,11 @@ void QgsMapToolSelectRadius::canvasMoveEvent( QgsMapMouseEvent* e )
|
||||
void QgsMapToolSelectRadius::canvasReleaseEvent( QgsMapMouseEvent* e )
|
||||
{
|
||||
if ( e->button() != Qt::LeftButton )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !mDragging )
|
||||
{
|
||||
if ( mRubberBand == nullptr )
|
||||
if ( !mRubberBand )
|
||||
{
|
||||
mRubberBand = new QgsRubberBand( mCanvas, QGis::Polygon );
|
||||
mRubberBand->setFillColor( mFillColor );
|
||||
|
@ -71,7 +71,7 @@ void QgsMapToolSelectFeatures::canvasMoveEvent( QgsMapMouseEvent* e )
|
||||
void QgsMapToolSelectFeatures::canvasReleaseEvent( QgsMapMouseEvent* e )
|
||||
{
|
||||
QgsVectorLayer* vlayer = QgsMapToolSelectUtils::getCurrentVectorLayer( mCanvas );
|
||||
if ( vlayer == nullptr )
|
||||
if ( !vlayer )
|
||||
{
|
||||
delete mRubberBand;
|
||||
mRubberBand = nullptr;
|
||||
|
@ -33,9 +33,8 @@ email : jpalmer at linz dot govt dot nz
|
||||
|
||||
QgsVectorLayer* QgsMapToolSelectUtils::getCurrentVectorLayer( QgsMapCanvas* canvas )
|
||||
{
|
||||
QgsVectorLayer* vlayer = nullptr;
|
||||
if ( !canvas->currentLayer()
|
||||
|| ( vlayer = qobject_cast<QgsVectorLayer *>( canvas->currentLayer() ) ) == nullptr )
|
||||
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( canvas->currentLayer() );
|
||||
if ( !vlayer )
|
||||
{
|
||||
QgisApp::instance()->messageBar()->pushMessage(
|
||||
QObject::tr( "No active vector layer" ),
|
||||
@ -93,14 +92,11 @@ void QgsMapToolSelectUtils::setSelectFeatures( QgsMapCanvas* canvas,
|
||||
bool singleSelect )
|
||||
{
|
||||
if ( selectGeometry->type() != QGis::Polygon )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QgsVectorLayer* vlayer = QgsMapToolSelectUtils::getCurrentVectorLayer( canvas );
|
||||
if ( vlayer == nullptr )
|
||||
{
|
||||
if ( !vlayer )
|
||||
return;
|
||||
}
|
||||
|
||||
// toLayerCoordinates will throw an exception for any 'invalid' points in
|
||||
// the rubber band.
|
||||
|
@ -61,7 +61,7 @@ namespace QgsMapToolSelectUtils
|
||||
void setSelectFeatures( QgsMapCanvas* canvas, QgsGeometry* selectGeometry, QMouseEvent * e );
|
||||
|
||||
/**
|
||||
Get the current selected canvas map layer. Returns NULL if it is not a vector layer
|
||||
Get the current selected canvas map layer. Returns nullptr if it is not a vector layer
|
||||
@param canvas The map canvas used for getting the current layer
|
||||
@return QgsVectorLayer The layer
|
||||
*/
|
||||
|
@ -1818,7 +1818,7 @@ void QgsOptions::loadGdalDriverList()
|
||||
// TODO add same UI for vector drivers
|
||||
#ifdef GDAL_COMPUTE_VERSION
|
||||
#if GDAL_VERSION_NUM >= GDAL_COMPUTE_VERSION(2,0,0)
|
||||
if ( QString( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_RASTER, NULL ) ) != "YES" )
|
||||
if ( QString( GDALGetMetadataItem( myGdalDriver, GDAL_DCAP_RASTER, nullptr ) ) != "YES" )
|
||||
continue;
|
||||
#endif
|
||||
#endif
|
||||
|
@ -44,7 +44,7 @@ typedef int type_t();
|
||||
QgsPluginRegistry *QgsPluginRegistry::_instance = nullptr;
|
||||
QgsPluginRegistry *QgsPluginRegistry::instance()
|
||||
{
|
||||
if ( _instance == nullptr )
|
||||
if ( !_instance )
|
||||
{
|
||||
_instance = new QgsPluginRegistry();
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ QString QgsProjectLayerGroupDialog::selectedProjectFile() const
|
||||
|
||||
bool QgsProjectLayerGroupDialog::isValid() const
|
||||
{
|
||||
return mTreeView->layerTreeModel() != nullptr;
|
||||
return nullptr != mTreeView->layerTreeModel();
|
||||
}
|
||||
|
||||
void QgsProjectLayerGroupDialog::on_mBrowseFileToolButton_clicked()
|
||||
|
@ -589,7 +589,7 @@ void QgsRasterLayerProperties::sync()
|
||||
// TODO: Wouldn't it be better to just removeWidget() the tabs than delete them? [LS]
|
||||
if ( !( mRasterLayer->dataProvider()->capabilities() & QgsRasterDataProvider::BuildPyramids ) )
|
||||
{
|
||||
if ( mOptsPage_Pyramids != nullptr )
|
||||
if ( mOptsPage_Pyramids )
|
||||
{
|
||||
delete mOptsPage_Pyramids;
|
||||
mOptsPage_Pyramids = nullptr;
|
||||
@ -598,7 +598,7 @@ void QgsRasterLayerProperties::sync()
|
||||
|
||||
if ( !( mRasterLayer->dataProvider()->capabilities() & QgsRasterDataProvider::Size ) )
|
||||
{
|
||||
if ( mOptsPage_Histogram != nullptr )
|
||||
if ( mOptsPage_Histogram )
|
||||
{
|
||||
delete mOptsPage_Histogram;
|
||||
mOptsPage_Histogram = nullptr;
|
||||
@ -1373,7 +1373,8 @@ void QgsRasterLayerProperties::setTransparencyToEdited( int row )
|
||||
|
||||
void QgsRasterLayerProperties::mOptionsStackedWidget_CurrentChanged( int indx )
|
||||
{
|
||||
if ( mHistogramWidget == nullptr ) return;
|
||||
if ( !mHistogramWidget )
|
||||
return;
|
||||
|
||||
if ( indx == 5 )
|
||||
{
|
||||
@ -1764,7 +1765,7 @@ void QgsRasterLayerProperties::on_mResetColorRenderingBtn_clicked()
|
||||
|
||||
bool QgsRasterLayerProperties::rasterIsMultiBandColor()
|
||||
{
|
||||
return mRasterLayer && dynamic_cast<QgsMultiBandColorRenderer*>( mRasterLayer->renderer() ) != nullptr;
|
||||
return mRasterLayer && nullptr != dynamic_cast<QgsMultiBandColorRenderer*>( mRasterLayer->renderer() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#ifdef Q_OS_MACX
|
||||
QgsTipGui::QgsTipGui()
|
||||
: QDialog( NULL, Qt::WindowSystemMenuHint ) // Modeless dialog with close button only
|
||||
: QDialog( nullptr, Qt::WindowSystemMenuHint ) // Modeless dialog with close button only
|
||||
#else
|
||||
QgsTipGui::QgsTipGui()
|
||||
: QDialog( nullptr ) // Normal dialog in non Mac-OS
|
||||
|
@ -45,7 +45,7 @@ QgsUndoWidget::QgsUndoWidget( QWidget * parent, QgsMapCanvas * mapCanvas )
|
||||
|
||||
void QgsUndoWidget::layerChanged( QgsMapLayer * layer )
|
||||
{
|
||||
if ( layer != nullptr )
|
||||
if ( layer )
|
||||
{
|
||||
setUndoStack( layer->undoStack() );
|
||||
}
|
||||
@ -59,12 +59,12 @@ void QgsUndoWidget::layerChanged( QgsMapLayer * layer )
|
||||
|
||||
void QgsUndoWidget::destroyStack()
|
||||
{
|
||||
if ( mUndoStack != nullptr )
|
||||
if ( mUndoStack )
|
||||
{
|
||||
// do not clear undo stack here, just null pointer
|
||||
mUndoStack = nullptr;
|
||||
}
|
||||
if ( mUndoView != nullptr )
|
||||
if ( mUndoView )
|
||||
{
|
||||
mUndoView->close();
|
||||
delete mUndoView;
|
||||
@ -141,7 +141,7 @@ void QgsUndoWidget::redo()
|
||||
|
||||
void QgsUndoWidget::setUndoStack( QUndoStack* undoStack )
|
||||
{
|
||||
if ( mUndoView != nullptr )
|
||||
if ( mUndoView )
|
||||
{
|
||||
mUndoView->close();
|
||||
delete mUndoView;
|
||||
|
@ -62,7 +62,7 @@ class CORE_EXPORT QgsAuthMethodRegistry
|
||||
|
||||
/** Create an instance of the auth method
|
||||
@param authMethodKey identificator of the auth method
|
||||
@return instance of auth method or NULL on error
|
||||
@return instance of auth method or nullptr on error
|
||||
*/
|
||||
QgsAuthMethod *authMethod( const QString & authMethodKey );
|
||||
|
||||
@ -81,7 +81,7 @@ class CORE_EXPORT QgsAuthMethodRegistry
|
||||
/** Get pointer to auth method function
|
||||
@param authMethodKey identificator of the auth method
|
||||
@param functionName name of function
|
||||
@return pointer to function or NULL on error
|
||||
@return pointer to function or nullptr on error
|
||||
*/
|
||||
QFunctionPointer function( const QString & authMethodKey,
|
||||
const QString & functionName );
|
||||
@ -89,7 +89,7 @@ class CORE_EXPORT QgsAuthMethodRegistry
|
||||
/** Get pointer to auth method function
|
||||
@param authMethodKey identificator of the auth method
|
||||
@param functionName name of function
|
||||
@return pointer to function or NULL on error
|
||||
@return pointer to function or nullptr on error
|
||||
*/
|
||||
void *function( const QString & authMethodKey,
|
||||
const QString & functionName );
|
||||
@ -101,7 +101,7 @@ class CORE_EXPORT QgsAuthMethodRegistry
|
||||
/** Return list of available auth methods by their keys */
|
||||
QStringList authMethodList() const;
|
||||
|
||||
/** Return metadata of the auth method or NULL if not found */
|
||||
/** Return metadata of the auth method or nullptr if not found */
|
||||
const QgsAuthMethodMetadata* authMethodMetadata( const QString& authMethodKey ) const;
|
||||
|
||||
// void registerGuis( QWidget *widget );
|
||||
|
@ -76,7 +76,7 @@ QgsPaintEffectAbstractMetadata *QgsPaintEffectRegistry::effectMetadata( const QS
|
||||
|
||||
bool QgsPaintEffectRegistry::addEffectType( QgsPaintEffectAbstractMetadata *metadata )
|
||||
{
|
||||
if ( metadata == nullptr || mMetadata.contains( metadata->name() ) )
|
||||
if ( !metadata || mMetadata.contains( metadata->name() ) )
|
||||
return false;
|
||||
|
||||
mMetadata[metadata->name()] = metadata;
|
||||
|
@ -63,7 +63,7 @@ class CORE_EXPORT QgsPaintEffectAbstractMetadata
|
||||
*/
|
||||
virtual QgsPaintEffect* createPaintEffect( const QgsStringMap& map ) = 0;
|
||||
|
||||
/** Create configuration widget for paint effect of this class. Can return NULL
|
||||
/** Create configuration widget for paint effect of this class. Can return nullptr
|
||||
* if there's no GUI for the paint effect class.
|
||||
* @returns configuration widget
|
||||
*/
|
||||
@ -161,7 +161,7 @@ class CORE_EXPORT QgsPaintEffectRegistry
|
||||
|
||||
/** Returns the metadata for a specific effect.
|
||||
* @param name unique string name for paint effect class
|
||||
* @returns paint effect metadata if found, otherwise NULL
|
||||
* @returns paint effect metadata if found, otherwise nullptr
|
||||
*/
|
||||
QgsPaintEffectAbstractMetadata* effectMetadata( const QString& name ) const;
|
||||
|
||||
@ -174,7 +174,7 @@ class CORE_EXPORT QgsPaintEffectRegistry
|
||||
/** Creates a new paint effect given the effect name and properties map.
|
||||
* @param name unique name representing paint effect class
|
||||
* @param properties encoded string map of effect properties
|
||||
* @returns new paint effect of specified class, or NULL if matching
|
||||
* @returns new paint effect of specified class, or nullptr if matching
|
||||
* paint effect could not be created
|
||||
*/
|
||||
QgsPaintEffect* createEffect( const QString& name, const QgsStringMap& properties = QgsStringMap() ) const;
|
||||
@ -182,7 +182,7 @@ class CORE_EXPORT QgsPaintEffectRegistry
|
||||
/** Creates a new paint effect given a DOM element storing paint effect
|
||||
* properties.
|
||||
* @param element encoded DOM element of effect properties
|
||||
* @returns new paint effect, or NULL if matching
|
||||
* @returns new paint effect, or nullptr if matching
|
||||
* paint effect could not be created
|
||||
*/
|
||||
QgsPaintEffect* createEffect( const QDomElement& element ) const;
|
||||
|
@ -236,7 +236,7 @@ unsigned char* QgsCurvePolygonV2::asWkb( int& binarySize ) const
|
||||
QgsWkbPtr wkb( geomPtr );
|
||||
wkb << static_cast<char>( QgsApplication::endian() );
|
||||
wkb << static_cast<quint32>( wkbType() );
|
||||
wkb << static_cast<quint32>(( mExteriorRing != nullptr ) + mInteriorRings.size() );
|
||||
wkb << static_cast<quint32>(( nullptr != mExteriorRing ) + mInteriorRings.size() );
|
||||
if ( mExteriorRing )
|
||||
{
|
||||
int curveWkbLen = 0;
|
||||
|
@ -106,7 +106,7 @@ class CORE_EXPORT QgsCurvePolygonV2: public QgsSurfaceV2
|
||||
double vertexAngle( const QgsVertexId& vertex ) const override;
|
||||
|
||||
virtual int vertexCount( int /*part*/ = 0, int ring = 0 ) const override;
|
||||
virtual int ringCount( int /*part*/ = 0 ) const override { return ( mExteriorRing != nullptr ) + mInteriorRings.size(); }
|
||||
virtual int ringCount( int /*part*/ = 0 ) const override { return ( nullptr != mExteriorRing ) + mInteriorRings.size(); }
|
||||
virtual int partCount() const override { return ringCount() > 0 ? 1 : 0; }
|
||||
virtual QgsPointV2 vertexAt( const QgsVertexId& id ) const override;
|
||||
|
||||
|
@ -447,7 +447,7 @@ bool QgsGeometry::deleteVertex( int atVertex )
|
||||
return static_cast< QgsGeometryCollectionV2* >( d->geometry )->removeGeometry( atVertex );
|
||||
}
|
||||
|
||||
//if it is a point, set the geometry to NULL
|
||||
//if it is a point, set the geometry to nullptr
|
||||
if ( QgsWKBTypes::flatType( d->geometry->wkbType() ) == QgsWKBTypes::Point )
|
||||
{
|
||||
detach( false );
|
||||
|
@ -497,7 +497,7 @@ class CORE_EXPORT QgsGeometry
|
||||
/** Try to convert the geometry to the requested type
|
||||
* @param destType the geometry type to be converted to
|
||||
* @param destMultipart determines if the output geometry will be multipart or not
|
||||
* @return the converted geometry or NULL pointer if the conversion fails.
|
||||
* @return the converted geometry or nullptr if the conversion fails.
|
||||
* @note added in 2.2
|
||||
*/
|
||||
QgsGeometry* convertToType( QGis::GeometryType destType, bool destMultipart = false ) const;
|
||||
|
@ -113,7 +113,7 @@ class GEOSGeomScopedPtr
|
||||
explicit GEOSGeomScopedPtr( GEOSGeometry* geom = nullptr ) : mGeom( geom ) {}
|
||||
~GEOSGeomScopedPtr() { GEOSGeom_destroy_r( geosinit.ctxt, mGeom ); }
|
||||
GEOSGeometry* get() const { return mGeom; }
|
||||
operator bool() const { return mGeom != nullptr; }
|
||||
operator bool() const { return nullptr != mGeom; }
|
||||
void reset( GEOSGeometry* geom )
|
||||
{
|
||||
GEOSGeom_destroy_r( geosinit.ctxt, mGeom );
|
||||
@ -673,7 +673,7 @@ int QgsGeos::splitPolygonGeometry( GEOSGeometry* splitLine, QList<QgsAbstractGeo
|
||||
intersectGeometry = GEOSIntersection_r( geosinit.ctxt, mGeos, polygon );
|
||||
if ( !intersectGeometry )
|
||||
{
|
||||
QgsDebugMsg( "intersectGeometry is NULL" );
|
||||
QgsDebugMsg( "intersectGeometry is nullptr" );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ unsigned char* QgsPolygonV2::asWkb( int& binarySize ) const
|
||||
QgsWkbPtr wkb( geomPtr );
|
||||
wkb << static_cast<char>( QgsApplication::endian() );
|
||||
wkb << static_cast<quint32>( wkbType() );
|
||||
wkb << static_cast<quint32>(( mExteriorRing != nullptr ) + mInteriorRings.size() );
|
||||
wkb << static_cast<quint32>(( nullptr != mExteriorRing ) + mInteriorRings.size() );
|
||||
if ( mExteriorRing )
|
||||
{
|
||||
QList<QgsPointV2> pts;
|
||||
|
@ -444,7 +444,7 @@ QList<QgsLayerTreeNode*> QgsLayerTreeModel::indexes2nodes( const QModelIndexList
|
||||
|
||||
bool QgsLayerTreeModel::isIndexSymbologyNode( const QModelIndex& index ) const
|
||||
{
|
||||
return index2legendNode( index ) != nullptr;
|
||||
return nullptr != index2legendNode( index );
|
||||
}
|
||||
|
||||
QgsLayerTreeLayer* QgsLayerTreeModel::layerNodeForSymbologyNode( const QModelIndex& index ) const
|
||||
|
@ -115,7 +115,7 @@ void QgsLayerTreeNode::insertChildrenPrivate( int index, QList<QgsLayerTreeNode*
|
||||
|
||||
Q_FOREACH ( QgsLayerTreeNode *node, nodes )
|
||||
{
|
||||
Q_ASSERT( node->mParent == nullptr );
|
||||
Q_ASSERT( !node->mParent );
|
||||
node->mParent = this;
|
||||
}
|
||||
|
||||
|
@ -825,7 +825,7 @@ namespace pal
|
||||
//std::cerr << "adding part: " << render_x << " " << render_y << std::endl;
|
||||
LabelPosition* tmp = new LabelPosition( 0, render_x /*- xBase*/, render_y /*- yBase*/, ci.width, string_height, -render_angle, 0.0001, this );
|
||||
tmp->setPartId( orientation > 0 ? i : li->char_num - i - 1 );
|
||||
if ( slp == nullptr )
|
||||
if ( !slp )
|
||||
slp = tmp;
|
||||
else
|
||||
slp_tmp->setNextPart( tmp );
|
||||
@ -876,7 +876,7 @@ namespace pal
|
||||
LabelInfo* li = mLF->curvedLabelInfo();
|
||||
|
||||
// label info must be present
|
||||
if ( li == nullptr || li->char_num == 0 )
|
||||
if ( !li || li->char_num == 0 )
|
||||
return 0;
|
||||
|
||||
// distance calculation
|
||||
|
@ -258,7 +258,7 @@ namespace pal
|
||||
if ( this->probFeat == lp->probFeat ) // bugfix #1
|
||||
return false; // always overlaping itself !
|
||||
|
||||
if ( nextPart == nullptr && lp->nextPart == nullptr )
|
||||
if ( !nextPart && !lp->nextPart )
|
||||
return isInConflictSinglePart( lp );
|
||||
else
|
||||
return isInConflictMultiPart( lp );
|
||||
|
@ -125,7 +125,7 @@ namespace pal
|
||||
|
||||
// break the (possibly multi-part) geometry into simple geometries
|
||||
QLinkedList<const GEOSGeometry*>* simpleGeometries = unmulti( lf->geometry() );
|
||||
if ( simpleGeometries == nullptr ) // unmulti() failed?
|
||||
if ( !simpleGeometries ) // unmulti() failed?
|
||||
{
|
||||
mMutex.unlock();
|
||||
throw InternalException::UnknownGeometry();
|
||||
@ -227,7 +227,7 @@ namespace pal
|
||||
{
|
||||
//do the same for the obstacle geometry
|
||||
simpleGeometries = unmulti( lf->obstacleGeometry() );
|
||||
if ( simpleGeometries == nullptr ) // unmulti() failed?
|
||||
if ( !simpleGeometries ) // unmulti() failed?
|
||||
{
|
||||
mMutex.unlock();
|
||||
throw InternalException::UnknownGeometry();
|
||||
@ -277,7 +277,7 @@ namespace pal
|
||||
mMutex.unlock();
|
||||
|
||||
// if using only biggest parts...
|
||||
if (( mMode == LabelPerFeature || lf->hasFixedPosition() ) && biggest_part != nullptr )
|
||||
if (( mMode == LabelPerFeature || lf->hasFixedPosition() ) && biggest_part )
|
||||
{
|
||||
addFeaturePart( biggest_part, lf->labelText() );
|
||||
addedFeature = true;
|
||||
|
@ -505,7 +505,7 @@ namespace pal
|
||||
t.start();
|
||||
|
||||
// First, extract the problem
|
||||
if (( prob = extract( bbox[0], bbox[1], bbox[2], bbox[3] ) ) == nullptr )
|
||||
if ( !( prob = extract( bbox[0], bbox[1], bbox[2], bbox[3] ) ) )
|
||||
{
|
||||
// nothing to be done => return an empty result set
|
||||
if ( stats )
|
||||
@ -585,7 +585,7 @@ namespace pal
|
||||
|
||||
std::list<LabelPosition*>* Pal::solveProblem( Problem* prob, bool displayAll )
|
||||
{
|
||||
if ( prob == nullptr )
|
||||
if ( !prob )
|
||||
return new std::list<LabelPosition*>();
|
||||
|
||||
prob->reduce();
|
||||
|
@ -1311,7 +1311,7 @@ namespace pal
|
||||
std::cout << " Conflictual..." << std::endl;
|
||||
#endif
|
||||
int feat, rfeat;
|
||||
bool sub = ctx->featWrap != nullptr;
|
||||
bool sub = nullptr != ctx->featWrap;
|
||||
|
||||
feat = lp->getProblemFeatureId();
|
||||
if ( sub )
|
||||
|
@ -258,7 +258,7 @@ void *qgsMalloc( size_t size )
|
||||
return nullptr;
|
||||
}
|
||||
void *p = malloc( size );
|
||||
if ( p == nullptr )
|
||||
if ( !p )
|
||||
{
|
||||
QgsDebugMsg( QString( "Allocation of %1 bytes failed." ).arg( size ) );
|
||||
}
|
||||
@ -273,7 +273,7 @@ void *qgsCalloc( size_t nmemb, size_t size )
|
||||
return nullptr;
|
||||
}
|
||||
void *p = qgsMalloc( nmemb * size );
|
||||
if ( p != nullptr )
|
||||
if ( p )
|
||||
{
|
||||
memset( p, 0, nmemb * size );
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ void QgsBrowserModel::addRootItems()
|
||||
|
||||
#ifdef Q_OS_MAC
|
||||
QString path = QString( "/Volumes" );
|
||||
QgsDirectoryItem *vols = new QgsDirectoryItem( NULL, path, path );
|
||||
QgsDirectoryItem *vols = new QgsDirectoryItem( nullptr, path, path );
|
||||
connectItem( vols );
|
||||
mRootItems << vols;
|
||||
#endif
|
||||
|
@ -27,7 +27,7 @@
|
||||
QgsColorSchemeRegistry *QgsColorSchemeRegistry::mInstance = nullptr;
|
||||
QgsColorSchemeRegistry *QgsColorSchemeRegistry::instance()
|
||||
{
|
||||
if ( mInstance == nullptr )
|
||||
if ( !mInstance )
|
||||
{
|
||||
mInstance = new QgsColorSchemeRegistry();
|
||||
|
||||
|
@ -679,8 +679,8 @@ void QgsCoordinateTransform::transformCoords( const int& numPoints, double *x, d
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_ASSERT( mSourceProjection != nullptr );
|
||||
Q_ASSERT( mDestinationProjection != nullptr );
|
||||
Q_ASSERT( mSourceProjection );
|
||||
Q_ASSERT( mDestinationProjection );
|
||||
projResult = pj_transform( mSourceProjection, mDestinationProjection, numPoints, 0, x, y, z );
|
||||
}
|
||||
|
||||
|
@ -608,7 +608,7 @@ int QgsDataItem::findItem( QVector<QgsDataItem*> items, QgsDataItem * item )
|
||||
{
|
||||
for ( int i = 0; i < items.size(); i++ )
|
||||
{
|
||||
Q_ASSERT_X( items[i], "findItem", QString( "item %1 is NULL" ).arg( i ).toAscii() );
|
||||
Q_ASSERT_X( items[i], "findItem", QString( "item %1 is nullptr" ).arg( i ).toAscii() );
|
||||
QgsDebugMsgLevel( QString::number( i ) + " : " + items[i]->mPath + " x " + item->mPath, 2 );
|
||||
if ( items[i]->equal( item ) )
|
||||
return i;
|
||||
@ -1250,7 +1250,7 @@ QgsZipItem::~QgsZipItem()
|
||||
// but use char ** and CSLAddString, because CPLStringList was added in gdal-1.9
|
||||
char **VSIReadDirRecursive1( const char *pszPath )
|
||||
{
|
||||
// CPLStringList oFiles = NULL;
|
||||
// CPLStringList oFiles = nullptr;
|
||||
char **papszOFiles = nullptr;
|
||||
char **papszFiles1 = nullptr;
|
||||
char **papszFiles2 = nullptr;
|
||||
|
@ -38,7 +38,7 @@ extern int exp_lex_destroy(yyscan_t scanner);
|
||||
extern int exp_lex(YYSTYPE* yylval_param, yyscan_t yyscanner);
|
||||
extern YY_BUFFER_STATE exp__scan_string(const char* buffer, yyscan_t scanner);
|
||||
|
||||
/** returns parsed tree, otherwise returns NULL and sets parserErrorMsg
|
||||
/** returns parsed tree, otherwise returns nullptr and sets parserErrorMsg
|
||||
(interface function to be called from QgsExpression)
|
||||
*/
|
||||
QgsExpression::Node* parseExpression(const QString& str, QString& parserErrorMsg);
|
||||
@ -253,7 +253,7 @@ expression:
|
||||
}
|
||||
else
|
||||
{
|
||||
$$ = new QgsExpression::NodeFunction( fnIndex, NULL );
|
||||
$$ = new QgsExpression::NodeFunction( fnIndex, nullptr );
|
||||
}
|
||||
delete $1;
|
||||
}
|
||||
@ -294,7 +294,7 @@ when_then_clause:
|
||||
%%
|
||||
|
||||
|
||||
// returns parsed tree, otherwise returns NULL and sets parserErrorMsg
|
||||
// returns parsed tree, otherwise returns nullptr and sets parserErrorMsg
|
||||
QgsExpression::Node* parseExpression(const QString& str, QString& parserErrorMsg)
|
||||
{
|
||||
expression_parser_context ctx;
|
||||
@ -314,7 +314,7 @@ QgsExpression::Node* parseExpression(const QString& str, QString& parserErrorMsg
|
||||
{
|
||||
parserErrorMsg = ctx.errorMsg;
|
||||
delete ctx.rootNode;
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +123,7 @@ bool QgsAbstractFeatureIterator::prepareSimplification( const QgsSimplifyMethod&
|
||||
if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) && simplifyMethod.methodType() != QgsSimplifyMethod::NoSimplification && ( simplifyMethod.forceLocalOptimization() || !providerCanSimplify( simplifyMethod.methodType() ) ) )
|
||||
{
|
||||
mGeometrySimplifier = QgsSimplifyMethod::createGeometrySimplifier( simplifyMethod );
|
||||
mLocalSimplification = mGeometrySimplifier != nullptr;
|
||||
mLocalSimplification = nullptr != mGeometrySimplifier;
|
||||
return mLocalSimplification;
|
||||
}
|
||||
return false;
|
||||
|
@ -595,7 +595,7 @@ void QgsGml::setAttribute( const QString& name, const QString& value )
|
||||
int QgsGml::readEpsgFromAttribute( int& epsgNr, const XML_Char** attr ) const
|
||||
{
|
||||
int i = 0;
|
||||
while ( attr[i] != nullptr )
|
||||
while ( attr[i] )
|
||||
{
|
||||
if ( strcmp( attr[i], "srsName" ) == 0 )
|
||||
{
|
||||
@ -626,7 +626,7 @@ int QgsGml::readEpsgFromAttribute( int& epsgNr, const XML_Char** attr ) const
|
||||
QString QgsGml::readAttribute( const QString& attributeName, const XML_Char** attr ) const
|
||||
{
|
||||
int i = 0;
|
||||
while ( attr[i] != nullptr )
|
||||
while ( attr[i] )
|
||||
{
|
||||
if ( attributeName.compare( attr[i] ) == 0 )
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ QgsGmlSchema::~QgsGmlSchema()
|
||||
QString QgsGmlSchema::readAttribute( const QString& attributeName, const XML_Char** attr ) const
|
||||
{
|
||||
int i = 0;
|
||||
while ( attr[i] != nullptr )
|
||||
while ( attr[i] )
|
||||
{
|
||||
if ( attributeName.compare( attr[i] ) == 0 )
|
||||
{
|
||||
|
@ -567,7 +567,7 @@ const unsigned char* QgsLabel::labelPoint( labelpoint& point, const unsigned cha
|
||||
Q_ASSERT( sizeof( QGis::WkbType ) == 4 );
|
||||
Q_ASSERT( sizeof( double ) == 8 );
|
||||
|
||||
if ( geom == nullptr )
|
||||
if ( !geom )
|
||||
{
|
||||
QgsDebugMsg( "empty wkb" );
|
||||
return nullptr;
|
||||
|
@ -379,7 +379,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
|
||||
void setLegendUrlFormat( const QString& legendUrlFormat ) { mLegendUrlFormat = legendUrlFormat; }
|
||||
QString legendUrlFormat() const { return mLegendUrlFormat; }
|
||||
|
||||
/** @deprecated since 2.4 - returns NULL */
|
||||
/** @deprecated since 2.4 - returns nullptr */
|
||||
Q_DECL_DEPRECATED QImage *cacheImage() { return nullptr; }
|
||||
/** @deprecated since 2.4 - caches listen to repaintRequested() signal to invalidate the cached image */
|
||||
Q_DECL_DEPRECATED void setCacheImage( QImage * );
|
||||
|
@ -95,7 +95,7 @@ class CORE_EXPORT QgsMapLayerRegistry : public QObject
|
||||
* If you specify false here, you have take care of deleting
|
||||
* the layer yourself. Not available in python.
|
||||
*
|
||||
* @return NULL if unable to add layer, otherwise pointer to newly added layer
|
||||
* @return nullptr if unable to add layer, otherwise pointer to newly added layer
|
||||
*
|
||||
* @see addMapLayers
|
||||
*
|
||||
|
@ -943,7 +943,7 @@ void QgsMapRenderer::updateFullExtent()
|
||||
Q_FOREACH ( const QString layerId, mLayerSet )
|
||||
{
|
||||
QgsMapLayer * lyr = registry->mapLayer( layerId );
|
||||
if ( lyr == nullptr )
|
||||
if ( !lyr )
|
||||
{
|
||||
QgsDebugMsg( QString( "WARNING: layer '%1' not found in map layer registry!" ).arg( layerId ) );
|
||||
}
|
||||
|
@ -306,7 +306,7 @@ class CORE_EXPORT QgsMapRenderer : public QObject
|
||||
//! Accessor for render context
|
||||
QgsRenderContext* rendererContext() {return &mRenderContext;}
|
||||
|
||||
//! Labeling engine (NULL if there's no custom engine)
|
||||
//! Labeling engine (nullptr if there's no custom engine)
|
||||
QgsLabelingEngineInterface* labelingEngine() { return mLabelingEngine; }
|
||||
|
||||
//! Set labeling engine. Previous engine (if any) is deleted.
|
||||
@ -445,7 +445,7 @@ class CORE_EXPORT QgsMapRenderer : public QObject
|
||||
//!Output units
|
||||
OutputUnits mOutputUnits;
|
||||
|
||||
//! Labeling engine (NULL by default)
|
||||
//! Labeling engine (nullptr by default)
|
||||
QgsLabelingEngineInterface* mLabelingEngine;
|
||||
|
||||
//! Locks rendering loop for concurrent draws
|
||||
|
@ -361,7 +361,7 @@ QImage QgsMapRendererJob::composeImage( const QgsMapSettings& settings, const La
|
||||
|
||||
painter.setCompositionMode( job.blendMode );
|
||||
|
||||
Q_ASSERT( job.img != nullptr );
|
||||
Q_ASSERT( job.img );
|
||||
painter.drawImage( 0, 0, *job.img );
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ QgsMapRendererSequentialJob::~QgsMapRendererSequentialJob()
|
||||
cancel();
|
||||
}
|
||||
|
||||
Q_ASSERT( mInternalJob == nullptr && mPainter == nullptr );
|
||||
Q_ASSERT( !mInternalJob && !mPainter );
|
||||
|
||||
delete mLabelingResults;
|
||||
mLabelingResults = nullptr;
|
||||
@ -61,7 +61,7 @@ void QgsMapRendererSequentialJob::start()
|
||||
|
||||
QgsDebugMsg( "SEQUENTIAL START" );
|
||||
|
||||
Q_ASSERT( mInternalJob == nullptr && mPainter == nullptr );
|
||||
Q_ASSERT( !mInternalJob && !mPainter );
|
||||
|
||||
mPainter = new QPainter( &mImage );
|
||||
|
||||
@ -82,7 +82,7 @@ void QgsMapRendererSequentialJob::cancel()
|
||||
QgsDebugMsg( "sequential - cancel internal" );
|
||||
mInternalJob->cancel();
|
||||
|
||||
Q_ASSERT( mInternalJob == nullptr && mPainter == nullptr );
|
||||
Q_ASSERT( !mInternalJob && !mPainter );
|
||||
}
|
||||
|
||||
void QgsMapRendererSequentialJob::waitForFinished()
|
||||
@ -95,7 +95,7 @@ void QgsMapRendererSequentialJob::waitForFinished()
|
||||
|
||||
bool QgsMapRendererSequentialJob::isActive() const
|
||||
{
|
||||
return mInternalJob != nullptr;
|
||||
return nullptr != mInternalJob;
|
||||
}
|
||||
|
||||
QgsLabelingResults* QgsMapRendererSequentialJob::takeLabelingResults()
|
||||
|
@ -510,7 +510,7 @@ QgsRectangle QgsMapSettings::fullExtent() const
|
||||
while ( it != mLayers.end() )
|
||||
{
|
||||
QgsMapLayer * lyr = registry->mapLayer( *it );
|
||||
if ( lyr == nullptr )
|
||||
if ( !lyr )
|
||||
{
|
||||
QgsDebugMsg( QString( "WARNING: layer '%1' not found in map layer registry!" ).arg( *it ) );
|
||||
}
|
||||
|
@ -196,10 +196,8 @@ void QgsOfflineEditing::synchronize()
|
||||
{
|
||||
// open logging db
|
||||
sqlite3* db = openLoggingDb();
|
||||
if ( db == nullptr )
|
||||
{
|
||||
if ( !db )
|
||||
return;
|
||||
}
|
||||
|
||||
emit progressStarted();
|
||||
|
||||
@ -455,10 +453,8 @@ void QgsOfflineEditing::createLoggingTables( sqlite3* db )
|
||||
|
||||
QgsVectorLayer* QgsOfflineEditing::copyVectorLayer( QgsVectorLayer* layer, sqlite3* db, const QString& offlineDbPath )
|
||||
{
|
||||
if ( layer == nullptr )
|
||||
{
|
||||
if ( !layer )
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QString tableName = layer->id();
|
||||
|
||||
@ -1141,10 +1137,8 @@ QgsOfflineEditing::GeometryChanges QgsOfflineEditing::sqlQueryGeometryChanges( s
|
||||
void QgsOfflineEditing::committedAttributesAdded( const QString& qgisLayerId, const QList<QgsField>& addedAttributes )
|
||||
{
|
||||
sqlite3* db = openLoggingDb();
|
||||
if ( db == nullptr )
|
||||
{
|
||||
if ( !db )
|
||||
return;
|
||||
}
|
||||
|
||||
// insert log
|
||||
int layerId = getOrCreateLayerId( db, qgisLayerId );
|
||||
@ -1171,10 +1165,8 @@ void QgsOfflineEditing::committedAttributesAdded( const QString& qgisLayerId, co
|
||||
void QgsOfflineEditing::committedFeaturesAdded( const QString& qgisLayerId, const QgsFeatureList& addedFeatures )
|
||||
{
|
||||
sqlite3* db = openLoggingDb();
|
||||
if ( db == nullptr )
|
||||
{
|
||||
if ( !db )
|
||||
return;
|
||||
}
|
||||
|
||||
// insert log
|
||||
int layerId = getOrCreateLayerId( db, qgisLayerId );
|
||||
@ -1200,10 +1192,8 @@ void QgsOfflineEditing::committedFeaturesAdded( const QString& qgisLayerId, cons
|
||||
void QgsOfflineEditing::committedFeaturesRemoved( const QString& qgisLayerId, const QgsFeatureIds& deletedFeatureIds )
|
||||
{
|
||||
sqlite3* db = openLoggingDb();
|
||||
if ( db == nullptr )
|
||||
{
|
||||
if ( !db )
|
||||
return;
|
||||
}
|
||||
|
||||
// insert log
|
||||
int layerId = getOrCreateLayerId( db, qgisLayerId );
|
||||
@ -1231,10 +1221,8 @@ void QgsOfflineEditing::committedFeaturesRemoved( const QString& qgisLayerId, co
|
||||
void QgsOfflineEditing::committedAttributeValuesChanges( const QString& qgisLayerId, const QgsChangedAttributesMap& changedAttrsMap )
|
||||
{
|
||||
sqlite3* db = openLoggingDb();
|
||||
if ( db == nullptr )
|
||||
{
|
||||
if ( !db )
|
||||
return;
|
||||
}
|
||||
|
||||
// insert log
|
||||
int layerId = getOrCreateLayerId( db, qgisLayerId );
|
||||
@ -1268,10 +1256,8 @@ void QgsOfflineEditing::committedAttributeValuesChanges( const QString& qgisLaye
|
||||
void QgsOfflineEditing::committedGeometriesChanges( const QString& qgisLayerId, const QgsGeometryMap& changedGeometries )
|
||||
{
|
||||
sqlite3* db = openLoggingDb();
|
||||
if ( db == nullptr )
|
||||
{
|
||||
if ( !db )
|
||||
return;
|
||||
}
|
||||
|
||||
// insert log
|
||||
int layerId = getOrCreateLayerId( db, qgisLayerId );
|
||||
|
@ -507,7 +507,7 @@ QgsPalLayerSettings QgsPalLayerSettings::fromLayer( QgsVectorLayer* layer )
|
||||
|
||||
QgsExpression* QgsPalLayerSettings::getLabelExpression()
|
||||
{
|
||||
if ( expression == nullptr )
|
||||
if ( !expression )
|
||||
{
|
||||
expression = new QgsExpression( fieldName );
|
||||
}
|
||||
@ -2269,7 +2269,7 @@ void QgsPalLayerSettings::registerFeature( QgsFeature& f, QgsRenderContext &cont
|
||||
if ( minFeatureSize > 0 && !checkMinimumSizeMM( context, preparedGeom, minFeatureSize ) )
|
||||
return;
|
||||
|
||||
if ( geos_geom == nullptr )
|
||||
if ( !geos_geom )
|
||||
return; // invalid geometry
|
||||
|
||||
// likelihood exists label will be registered with PAL and may be drawn
|
||||
@ -2759,7 +2759,7 @@ void QgsPalLayerSettings::registerObstacleFeature( QgsFeature& f, QgsRenderConte
|
||||
geos_geom = geom->asGeos();
|
||||
}
|
||||
|
||||
if ( geos_geom == nullptr )
|
||||
if ( !geos_geom )
|
||||
return; // invalid geometry
|
||||
|
||||
GEOSGeometry* geos_geom_clone;
|
||||
|
@ -58,7 +58,7 @@ bool QgsPluginLayerType::showLayerProperties( QgsPluginLayer *layer )
|
||||
QgsPluginLayerRegistry* QgsPluginLayerRegistry::_instance = nullptr;
|
||||
QgsPluginLayerRegistry* QgsPluginLayerRegistry::instance()
|
||||
{
|
||||
if ( _instance == nullptr )
|
||||
if ( !_instance )
|
||||
{
|
||||
_instance = new QgsPluginLayerRegistry();
|
||||
}
|
||||
@ -87,8 +87,9 @@ QStringList QgsPluginLayerRegistry::pluginLayerTypes()
|
||||
|
||||
bool QgsPluginLayerRegistry::addPluginLayerType( QgsPluginLayerType* type )
|
||||
{
|
||||
if ( type == nullptr )
|
||||
if ( !type )
|
||||
return false;
|
||||
|
||||
if ( mPluginLayerTypes.contains( type->name() ) )
|
||||
return false;
|
||||
|
||||
|
@ -611,13 +611,13 @@ bool QgsPointLocator::init( int maxFeaturesToIndex )
|
||||
return hasIndex() ? true : rebuildIndex( maxFeaturesToIndex );
|
||||
}
|
||||
|
||||
|
||||
bool QgsPointLocator::hasIndex() const
|
||||
{
|
||||
return mRTree != nullptr || mIsEmptyLayer;
|
||||
return mRTree || mIsEmptyLayer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool QgsPointLocator::rebuildIndex( int maxFeaturesToIndex )
|
||||
{
|
||||
destroyIndex();
|
||||
|
@ -22,7 +22,7 @@ QgsPythonRunner* QgsPythonRunner::mInstance = nullptr;
|
||||
|
||||
bool QgsPythonRunner::isValid()
|
||||
{
|
||||
return mInstance != nullptr;
|
||||
return nullptr != mInstance;
|
||||
}
|
||||
|
||||
bool QgsPythonRunner::run( const QString& command, const QString& messageOnError )
|
||||
|
@ -48,7 +48,7 @@ QgsRelation QgsRelation::createFromXML( const QDomNode &node )
|
||||
QgsMapLayer* referencingLayer = mapLayers[referencingLayerId];
|
||||
QgsMapLayer* referencedLayer = mapLayers[referencedLayerId];
|
||||
|
||||
if ( nullptr == referencingLayer )
|
||||
if ( !referencingLayer )
|
||||
{
|
||||
QgsLogger::warning( QApplication::translate( "QgsRelation", "Relation defined for layer '%1' which does not exist." ).arg( referencingLayerId ) );
|
||||
}
|
||||
@ -57,7 +57,7 @@ QgsRelation QgsRelation::createFromXML( const QDomNode &node )
|
||||
QgsLogger::warning( QApplication::translate( "QgsRelation", "Relation defined for layer '%1' which is not of type VectorLayer." ).arg( referencingLayerId ) );
|
||||
}
|
||||
|
||||
if ( nullptr == referencedLayer )
|
||||
if ( !referencedLayer )
|
||||
{
|
||||
QgsLogger::warning( QApplication::translate( "QgsRelation", "Relation defined for layer '%1' which does not exist." ).arg( referencedLayerId ) );
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ class CORE_EXPORT QgsRenderContext
|
||||
|
||||
QgsLabelingEngineInterface* labelingEngine() const { return mLabelingEngine; }
|
||||
|
||||
//! Get access to new labeling engine (may be NULL)
|
||||
//! Get access to new labeling engine (may be nullptr)
|
||||
QgsLabelingEngineV2* labelingEngineV2() const { return mLabelingEngine2; }
|
||||
|
||||
QColor selectionColor() const { return mSelectionColor; }
|
||||
@ -238,10 +238,10 @@ class CORE_EXPORT QgsRenderContext
|
||||
/** Map scale*/
|
||||
double mRendererScale;
|
||||
|
||||
/** Labeling engine (can be NULL)*/
|
||||
/** Labeling engine (can be nullptr)*/
|
||||
QgsLabelingEngineInterface* mLabelingEngine;
|
||||
|
||||
/** Newer labeling engine implementation (can be NULL) */
|
||||
/** Newer labeling engine implementation (can be nullptr) */
|
||||
QgsLabelingEngineV2* mLabelingEngine2;
|
||||
|
||||
/** Color used for features that are marked as selected */
|
||||
|
@ -113,7 +113,7 @@ void QgsRunProcess::processExit( int, QProcess::ExitStatus )
|
||||
// (unless it was never created in the first case, which is what the
|
||||
// test against 0 is for).
|
||||
|
||||
if ( mOutput != nullptr )
|
||||
if ( mOutput )
|
||||
{
|
||||
mOutput->appendMessage( "<b>" + tr( "Done" ) + "</b>" );
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ class QgsFeatureIteratorDataStream : public IDataStream
|
||||
}
|
||||
|
||||
//! returns true if there are more items in the stream.
|
||||
virtual bool hasNext() override { return mNextData != nullptr; }
|
||||
virtual bool hasNext() override { return nullptr != mNextData; }
|
||||
|
||||
//! returns the total number of entries available in the stream.
|
||||
virtual uint32_t size() override { Q_ASSERT( 0 && "not available" ); return 0; }
|
||||
|
@ -31,15 +31,11 @@ QgsTransaction* QgsTransaction::create( const QString& connString, const QString
|
||||
|
||||
QLibrary* lib = QgsProviderRegistry::instance()->providerLibrary( providerKey );
|
||||
if ( !lib )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
createTransaction_t* createTransaction = ( createTransaction_t* ) cast_to_fptr( lib->resolve( "createTransaction" ) );
|
||||
if ( !createTransaction )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QgsTransaction* ts = createTransaction( connString );
|
||||
|
||||
@ -51,23 +47,17 @@ QgsTransaction* QgsTransaction::create( const QString& connString, const QString
|
||||
QgsTransaction* QgsTransaction::create( const QStringList& layerIds )
|
||||
{
|
||||
if ( layerIds.isEmpty() )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QgsVectorLayer* layer = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( layerIds.first() ) );
|
||||
if ( !layer )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QString connStr = QgsDataSourceURI( layer->source() ).connectionInfo();
|
||||
QString providerKey = layer->dataProvider()->name();
|
||||
QgsTransaction* ts = QgsTransaction::create( connStr, providerKey );
|
||||
if ( !ts )
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Q_FOREACH ( const QString& layerId, layerIds )
|
||||
{
|
||||
@ -94,9 +84,7 @@ QgsTransaction::~QgsTransaction()
|
||||
bool QgsTransaction::addLayer( const QString& layerId )
|
||||
{
|
||||
if ( mTransactionActive )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QgsVectorLayer* layer = qobject_cast<QgsVectorLayer*>( QgsMapLayerRegistry::instance()->mapLayer( layerId ) );
|
||||
return addLayer( layer );
|
||||
@ -105,30 +93,20 @@ bool QgsTransaction::addLayer( const QString& layerId )
|
||||
bool QgsTransaction::addLayer( QgsVectorLayer* layer )
|
||||
{
|
||||
if ( mTransactionActive )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !layer )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( layer->isEditable() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//test if provider supports transactions
|
||||
if ( !layer->dataProvider() || ( layer->dataProvider()->capabilities() & QgsVectorDataProvider::TransactionSupport ) == 0 )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( layer->dataProvider()->transaction() != nullptr )
|
||||
{
|
||||
if ( layer->dataProvider()->transaction() )
|
||||
return false;
|
||||
}
|
||||
|
||||
//connection string not compatible
|
||||
if ( QgsDataSourceURI( layer->source() ).connectionInfo() != mConnString )
|
||||
@ -147,15 +125,11 @@ bool QgsTransaction::addLayer( QgsVectorLayer* layer )
|
||||
bool QgsTransaction::begin( QString& errorMsg, int statementTimeout )
|
||||
{
|
||||
if ( mTransactionActive )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//Set all layers to direct edit mode
|
||||
if ( !beginTransaction( errorMsg, statementTimeout ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
setLayerTransactionIds( this );
|
||||
mTransactionActive = true;
|
||||
@ -165,9 +139,7 @@ bool QgsTransaction::begin( QString& errorMsg, int statementTimeout )
|
||||
bool QgsTransaction::commit( QString& errorMsg )
|
||||
{
|
||||
if ( !mTransactionActive )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Q_FOREACH ( QgsVectorLayer* l, mLayers )
|
||||
{
|
||||
@ -178,9 +150,7 @@ bool QgsTransaction::commit( QString& errorMsg )
|
||||
}
|
||||
|
||||
if ( !commitTransaction( errorMsg ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
setLayerTransactionIds( nullptr );
|
||||
mTransactionActive = false;
|
||||
@ -190,9 +160,7 @@ bool QgsTransaction::commit( QString& errorMsg )
|
||||
bool QgsTransaction::rollback( QString& errorMsg )
|
||||
{
|
||||
if ( !mTransactionActive )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Q_FOREACH ( QgsVectorLayer* l, mLayers )
|
||||
{
|
||||
@ -203,9 +171,7 @@ bool QgsTransaction::rollback( QString& errorMsg )
|
||||
}
|
||||
|
||||
if ( !rollbackTransaction( errorMsg ) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
setLayerTransactionIds( nullptr );
|
||||
mTransactionActive = false;
|
||||
|
@ -233,7 +233,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
|
||||
options = nullptr;
|
||||
}
|
||||
|
||||
if ( mDS == nullptr )
|
||||
if ( !mDS )
|
||||
{
|
||||
mError = ErrCreateDataSource;
|
||||
mErrorMessage = QObject::tr( "creation of data source failed (OGR error:%1)" )
|
||||
@ -320,7 +320,7 @@ QgsVectorFileWriter::QgsVectorFileWriter(
|
||||
}
|
||||
}
|
||||
|
||||
if ( mLayer == nullptr )
|
||||
if ( !mLayer )
|
||||
{
|
||||
mErrorMessage = QObject::tr( "creation of layer failed (OGR error:%1)" )
|
||||
.arg( QString::fromUtf8( CPLGetLastErrorMsg() ) );
|
||||
|
@ -3877,7 +3877,7 @@ QString QgsVectorLayer::loadNamedStyle( const QString &theURI, bool &theResultFl
|
||||
qml = loadStyleExternalMethod( mDataSource, errorMsg );
|
||||
if ( !qml.isEmpty() )
|
||||
{
|
||||
theResultFlag = this->applyNamedStyle( qml, errorMsg );
|
||||
theResultFlag = applyNamedStyle( qml, errorMsg );
|
||||
return QObject::tr( "Loaded from Provider" );
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ bool QgsVectorLayerCache::featureAtId( QgsFeatureId featureId, QgsFeature& featu
|
||||
cachedFeature = mCache[ featureId ];
|
||||
}
|
||||
|
||||
if ( cachedFeature != nullptr )
|
||||
if ( cachedFeature )
|
||||
{
|
||||
feature = QgsFeature( *cachedFeature->feature() );
|
||||
featureFound = true;
|
||||
@ -195,7 +195,7 @@ void QgsVectorLayerCache::onAttributeValueChanged( QgsFeatureId fid, int field,
|
||||
{
|
||||
QgsCachedFeature* cachedFeat = mCache[ fid ];
|
||||
|
||||
if ( nullptr != cachedFeat )
|
||||
if ( cachedFeat )
|
||||
{
|
||||
cachedFeat->mFeature->setAttribute( field, value );
|
||||
}
|
||||
@ -248,7 +248,7 @@ void QgsVectorLayerCache::geometryChanged( QgsFeatureId fid, QgsGeometry& geom )
|
||||
{
|
||||
QgsCachedFeature* cachedFeat = mCache[ fid ];
|
||||
|
||||
if ( cachedFeat != nullptr )
|
||||
if ( cachedFeat )
|
||||
{
|
||||
cachedFeat->mFeature->setGeometry( geom );
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ bool QgsVectorLayerDiagramProvider::prepare( const QgsRenderContext& context, QS
|
||||
}
|
||||
|
||||
const QgsLinearlyInterpolatedDiagramRenderer* linearlyInterpolatedDiagramRenderer = dynamic_cast<const QgsLinearlyInterpolatedDiagramRenderer*>( diagRenderer );
|
||||
if ( linearlyInterpolatedDiagramRenderer != nullptr )
|
||||
if ( linearlyInterpolatedDiagramRenderer )
|
||||
{
|
||||
if ( linearlyInterpolatedDiagramRenderer->classificationAttributeIsExpression() )
|
||||
{
|
||||
@ -280,10 +280,9 @@ QgsLabelFeature* QgsVectorLayerDiagramProvider::registerDiagram( QgsFeature& fea
|
||||
geos_geom = geom->asGeos();
|
||||
}
|
||||
|
||||
if ( geos_geom == nullptr )
|
||||
{
|
||||
if ( !geos_geom )
|
||||
return nullptr; // invalid geometry
|
||||
}
|
||||
|
||||
GEOSGeometry* geomCopy = GEOSGeom_clone_r( QgsGeometry::getGEOSHandler(), geos_geom );
|
||||
|
||||
const GEOSGeometry* geosObstacleGeom = nullptr;
|
||||
|
@ -608,7 +608,7 @@ bool QgsVectorLayerFeatureIterator::prepareSimplification( const QgsSimplifyMeth
|
||||
if ( !( mRequest.flags() & QgsFeatureRequest::NoGeometry ) && simplifyMethod.methodType() != QgsSimplifyMethod::NoSimplification && mSource->mCanBeSimplified )
|
||||
{
|
||||
mEditGeometrySimplifier = QgsSimplifyMethod::createGeometrySimplifier( simplifyMethod );
|
||||
return mEditGeometrySimplifier != nullptr;
|
||||
return nullptr != mEditGeometrySimplifier;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -217,10 +217,8 @@ QgsVectorLayerImport::importLayer( QgsVectorLayer* layer,
|
||||
QgsCoordinateTransform* ct = nullptr;
|
||||
bool shallTransform = false;
|
||||
|
||||
if ( layer == nullptr )
|
||||
{
|
||||
if ( !layer )
|
||||
return ErrInvalidLayer;
|
||||
}
|
||||
|
||||
if ( destCRS && destCRS->isValid() )
|
||||
{
|
||||
@ -317,15 +315,11 @@ QgsVectorLayerImport::importLayer( QgsVectorLayer* layer,
|
||||
|
||||
// Create our transform
|
||||
if ( destCRS )
|
||||
{
|
||||
ct = new QgsCoordinateTransform( layer->crs(), *destCRS );
|
||||
}
|
||||
|
||||
// Check for failure
|
||||
if ( ct == nullptr )
|
||||
{
|
||||
if ( !ct )
|
||||
shallTransform = false;
|
||||
}
|
||||
|
||||
int n = 0;
|
||||
|
||||
|
@ -59,7 +59,7 @@ QgsVectorLayerRenderer::QgsVectorLayerRenderer( QgsVectorLayer* layer, QgsRender
|
||||
mRendererV2 = layer->rendererV2() ? layer->rendererV2()->clone() : nullptr;
|
||||
mSelectedFeatureIds = layer->selectedFeaturesIds();
|
||||
|
||||
mDrawVertexMarkers = ( layer->editBuffer() != nullptr );
|
||||
mDrawVertexMarkers = nullptr != layer->editBuffer();
|
||||
|
||||
mGeometryType = layer->geometryType();
|
||||
|
||||
|
@ -253,7 +253,7 @@ bool QgsContrastEnhancement::generateLookupTable()
|
||||
bool QgsContrastEnhancement::isValueInDisplayableRange( double theValue )
|
||||
{
|
||||
|
||||
if ( nullptr != mContrastEnhancementFunction )
|
||||
if ( mContrastEnhancementFunction )
|
||||
{
|
||||
return mContrastEnhancementFunction->isValueInDisplayableRange( theValue );
|
||||
}
|
||||
@ -315,7 +315,7 @@ void QgsContrastEnhancement::setContrastEnhancementFunction( QgsContrastEnhancem
|
||||
{
|
||||
QgsDebugMsg( "called" );
|
||||
|
||||
if ( nullptr != theFunction )
|
||||
if ( theFunction )
|
||||
{
|
||||
delete mContrastEnhancementFunction;
|
||||
mContrastEnhancementFunction = theFunction;
|
||||
@ -343,7 +343,7 @@ void QgsContrastEnhancement::setMaximumValue( double theValue, bool generateTabl
|
||||
mMaximumValue = theValue;
|
||||
}
|
||||
|
||||
if ( nullptr != mContrastEnhancementFunction )
|
||||
if ( mContrastEnhancementFunction )
|
||||
{
|
||||
mContrastEnhancementFunction->setMaximumValue( theValue );
|
||||
}
|
||||
@ -375,7 +375,7 @@ void QgsContrastEnhancement::setMinimumValue( double theValue, bool generateTabl
|
||||
mMinimumValue = theValue;
|
||||
}
|
||||
|
||||
if ( nullptr != mContrastEnhancementFunction )
|
||||
if ( mContrastEnhancementFunction )
|
||||
{
|
||||
mContrastEnhancementFunction->setMinimumValue( theValue );
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ bool QgsRasterBlock::reset( QGis::DataType theDataType, int theWidth, int theHei
|
||||
qgssize tSize = typeSize( theDataType );
|
||||
QgsDebugMsg( QString( "allocate %1 bytes" ).arg( tSize * theWidth * theHeight ) );
|
||||
mData = qgsMalloc( tSize * theWidth * theHeight );
|
||||
if ( mData == nullptr )
|
||||
if ( !mData )
|
||||
{
|
||||
QgsDebugMsg( QString( "Couldn't allocate data memory of %1 bytes" ).arg( tSize * theWidth * theHeight ) );
|
||||
return false;
|
||||
@ -179,8 +179,8 @@ bool QgsRasterBlock::isEmpty() const
|
||||
{
|
||||
QgsDebugMsg( QString( "mWidth= %1 mHeight = %2 mDataType = %3 mData = %4 mImage = %5" ).arg( mWidth ).arg( mHeight ).arg( mDataType ).arg(( ulong )mData ).arg(( ulong )mImage ) );
|
||||
if ( mWidth == 0 || mHeight == 0 ||
|
||||
( typeIsNumeric( mDataType ) && mData == nullptr ) ||
|
||||
( typeIsColor( mDataType ) && mImage == nullptr ) )
|
||||
( typeIsNumeric( mDataType ) && !mData ) ||
|
||||
( typeIsColor( mDataType ) && !mImage ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -273,7 +273,7 @@ QGis::DataType QgsRasterBlock::typeWithNoDataValue( QGis::DataType dataType, dou
|
||||
|
||||
bool QgsRasterBlock::hasNoData() const
|
||||
{
|
||||
return mHasNoDataValue || mNoDataBitmap != nullptr;
|
||||
return mHasNoDataValue || mNoDataBitmap;
|
||||
}
|
||||
|
||||
bool QgsRasterBlock::isNoDataValue( double value, double noDataValue )
|
||||
@ -322,7 +322,7 @@ bool QgsRasterBlock::isNoData( qgssize index )
|
||||
return isNoDataValue( value );
|
||||
}
|
||||
// use no data bitmap
|
||||
if ( mNoDataBitmap == nullptr )
|
||||
if ( !mNoDataBitmap )
|
||||
{
|
||||
// no data are not defined
|
||||
return false;
|
||||
@ -402,7 +402,7 @@ bool QgsRasterBlock::setIsNoData( qgssize index )
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mNoDataBitmap == nullptr )
|
||||
if ( !mNoDataBitmap )
|
||||
{
|
||||
if ( !createNoDataBitmap() )
|
||||
{
|
||||
@ -447,7 +447,7 @@ bool QgsRasterBlock::setIsNoData()
|
||||
else
|
||||
{
|
||||
// use bitmap
|
||||
if ( mNoDataBitmap == nullptr )
|
||||
if ( !mNoDataBitmap )
|
||||
{
|
||||
if ( !createNoDataBitmap() )
|
||||
{
|
||||
@ -529,7 +529,7 @@ bool QgsRasterBlock::setIsNoDataExcept( const QRect & theExceptRect )
|
||||
else
|
||||
{
|
||||
// use bitmap
|
||||
if ( mNoDataBitmap == nullptr )
|
||||
if ( !mNoDataBitmap )
|
||||
{
|
||||
if ( !createNoDataBitmap() )
|
||||
{
|
||||
@ -646,7 +646,7 @@ void QgsRasterBlock::setIsData( qgssize index )
|
||||
return;
|
||||
}
|
||||
|
||||
if ( mNoDataBitmap == nullptr )
|
||||
if ( !mNoDataBitmap )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -708,7 +708,7 @@ bool QgsRasterBlock::convert( QGis::DataType destDataType )
|
||||
{
|
||||
void *data = convert( mData, mDataType, destDataType, ( qgssize )mWidth * ( qgssize )mHeight );
|
||||
|
||||
if ( data == nullptr )
|
||||
if ( !data )
|
||||
{
|
||||
QgsDebugMsg( "Cannot convert raster block" );
|
||||
return false;
|
||||
@ -899,7 +899,7 @@ bool QgsRasterBlock::createNoDataBitmap()
|
||||
mNoDataBitmapSize = ( qgssize )mNoDataBitmapWidth * mHeight;
|
||||
QgsDebugMsg( QString( "allocate %1 bytes" ).arg( mNoDataBitmapSize ) );
|
||||
mNoDataBitmap = ( char* )qgsMalloc( mNoDataBitmapSize );
|
||||
if ( mNoDataBitmap == nullptr )
|
||||
if ( !mNoDataBitmap )
|
||||
{
|
||||
QgsDebugMsg( QString( "Couldn't allocate no data memory of %1 bytes" ).arg( mNoDataBitmapSize ) );
|
||||
return false;
|
||||
|
@ -48,7 +48,7 @@ QgsRasterShader::~QgsRasterShader()
|
||||
*/
|
||||
bool QgsRasterShader::shade( double theValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue, int *theReturnAlpha )
|
||||
{
|
||||
if ( nullptr != mRasterShaderFunction )
|
||||
if ( mRasterShaderFunction )
|
||||
{
|
||||
return mRasterShaderFunction->shade( theValue, theReturnRedValue, theReturnGreenValue, theReturnBlueValue, theReturnAlpha );
|
||||
}
|
||||
@ -71,7 +71,7 @@ bool QgsRasterShader::shade( double theValue, int* theReturnRedValue, int* theRe
|
||||
*/
|
||||
bool QgsRasterShader::shade( double theRedValue, double theGreenValue, double theBlueValue, double theAlphaValue, int* theReturnRedValue, int* theReturnGreenValue, int* theReturnBlueValue, int* theReturnAlphaValue )
|
||||
{
|
||||
if ( nullptr != mRasterShaderFunction )
|
||||
if ( mRasterShaderFunction )
|
||||
{
|
||||
return mRasterShaderFunction->shade( theRedValue, theGreenValue, theBlueValue, theAlphaValue, theReturnRedValue, theReturnGreenValue, theReturnBlueValue, theReturnAlphaValue );
|
||||
}
|
||||
@ -91,7 +91,7 @@ void QgsRasterShader::setRasterShaderFunction( QgsRasterShaderFunction* theFunct
|
||||
if ( mRasterShaderFunction == theFunction )
|
||||
return;
|
||||
|
||||
if ( nullptr != theFunction )
|
||||
if ( theFunction )
|
||||
{
|
||||
delete mRasterShaderFunction;
|
||||
mRasterShaderFunction = theFunction;
|
||||
@ -108,7 +108,7 @@ void QgsRasterShader::setMaximumValue( double theValue )
|
||||
QgsDebugMsg( "Value = " + QString::number( theValue ) );
|
||||
|
||||
mMaximumValue = theValue;
|
||||
if ( nullptr != mRasterShaderFunction )
|
||||
if ( mRasterShaderFunction )
|
||||
{
|
||||
mRasterShaderFunction->setMaximumValue( theValue );
|
||||
}
|
||||
@ -124,7 +124,7 @@ void QgsRasterShader::setMinimumValue( double theValue )
|
||||
QgsDebugMsg( "Value = " + QString::number( theValue ) );
|
||||
|
||||
mMinimumValue = theValue;
|
||||
if ( nullptr != mRasterShaderFunction )
|
||||
if ( mRasterShaderFunction )
|
||||
{
|
||||
mRasterShaderFunction->setMinimumValue( theValue );
|
||||
}
|
||||
|
@ -865,7 +865,7 @@ QVector< QgsCptCityDataItem* > QgsCptCityCollectionItem::childrenRamps( bool rec
|
||||
{
|
||||
QgsCptCityCollectionItem* collectionItem = dynamic_cast<QgsCptCityCollectionItem*>( childItem );
|
||||
QgsCptCityColorRampItem* rampItem = dynamic_cast<QgsCptCityColorRampItem*>( childItem );
|
||||
QgsDebugMsgLevel( QString( "child path= %1 coll= %2 ramp = %3" ).arg( childItem->path() ).arg( collectionItem != nullptr ).arg( rampItem != nullptr ), 2 );
|
||||
QgsDebugMsgLevel( QString( "child path= %1 coll= %2 ramp = %3" ).arg( childItem->path() ).arg( nullptr != collectionItem ).arg( nullptr != rampItem ), 2 );
|
||||
if ( collectionItem && recursive )
|
||||
{
|
||||
collectionItem->populate();
|
||||
@ -1330,7 +1330,7 @@ QgsCptCityBrowserModel::QgsCptCityBrowserModel( QObject *parent,
|
||||
QgsCptCityArchive* archive, ViewType viewType )
|
||||
: QAbstractItemModel( parent ), mArchive( archive ), mViewType( viewType )
|
||||
{
|
||||
Q_ASSERT( mArchive != nullptr );
|
||||
Q_ASSERT( mArchive );
|
||||
QgsDebugMsg( "archiveName = " + archive->archiveName() + " viewType=" + ( int ) viewType );
|
||||
// keep iconsize for now, but not effectively used
|
||||
mIconSize = QSize( 100, 15 );
|
||||
@ -1410,7 +1410,7 @@ QVariant QgsCptCityBrowserModel::data( const QModelIndex &index, int role ) cons
|
||||
return item->icon( mIconSize );
|
||||
}
|
||||
else if ( role == Qt::FontRole &&
|
||||
( dynamic_cast< QgsCptCityCollectionItem* >( item ) != nullptr ) )
|
||||
dynamic_cast< QgsCptCityCollectionItem* >( item ) )
|
||||
{
|
||||
// collectionitems are larger and bold
|
||||
QFont font;
|
||||
|
@ -3465,7 +3465,7 @@ QgsSymbolV2* QgsCentroidFillSymbolLayerV2::subSymbol()
|
||||
|
||||
bool QgsCentroidFillSymbolLayerV2::setSubSymbol( QgsSymbolV2* symbol )
|
||||
{
|
||||
if ( symbol == nullptr || symbol->type() != QgsSymbolV2::Marker )
|
||||
if ( !symbol || symbol->type() != QgsSymbolV2::Marker )
|
||||
{
|
||||
delete symbol;
|
||||
return false;
|
||||
|
@ -320,7 +320,7 @@ QgsSymbolV2* QgsGraduatedSymbolRendererV2::symbolForValue( double value )
|
||||
QgsSymbolV2* QgsGraduatedSymbolRendererV2::symbolForFeature( QgsFeature& feature, QgsRenderContext &context )
|
||||
{
|
||||
QgsSymbolV2* symbol = originalSymbolForFeature( feature, context );
|
||||
if ( symbol == nullptr )
|
||||
if ( !symbol )
|
||||
return nullptr;
|
||||
|
||||
if ( !mRotation.data() && !mSizeScale.data() )
|
||||
|
@ -252,7 +252,7 @@ void QgsSimpleLineSymbolLayerV2::renderPolygonOutline( const QPolygonF& points,
|
||||
QPainterPath clipPath;
|
||||
clipPath.addPolygon( points );
|
||||
|
||||
if ( rings != nullptr )
|
||||
if ( rings )
|
||||
{
|
||||
//add polygon rings
|
||||
QList<QPolygonF>::const_iterator it = rings->constBegin();
|
||||
@ -1343,7 +1343,7 @@ QgsSymbolV2* QgsMarkerLineSymbolLayerV2::subSymbol()
|
||||
|
||||
bool QgsMarkerLineSymbolLayerV2::setSubSymbol( QgsSymbolV2* symbol )
|
||||
{
|
||||
if ( symbol == nullptr || symbol->type() != QgsSymbolV2::Marker )
|
||||
if ( !symbol || symbol->type() != QgsSymbolV2::Marker )
|
||||
{
|
||||
delete symbol;
|
||||
return false;
|
||||
|
@ -269,7 +269,7 @@ void QgsFeatureRendererV2::startRender( QgsRenderContext& context, const QgsVect
|
||||
bool QgsFeatureRendererV2::renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer, bool selected, bool drawVertexMarker )
|
||||
{
|
||||
QgsSymbolV2* symbol = symbolForFeature( feature, context );
|
||||
if ( symbol == nullptr )
|
||||
if ( !symbol )
|
||||
return false;
|
||||
|
||||
renderFeatureWithSymbol( feature, symbol, context, layer, selected, drawVertexMarker );
|
||||
@ -314,7 +314,7 @@ QgsFeatureRendererV2* QgsFeatureRendererV2::load( QDomElement& element )
|
||||
QString rendererType = element.attribute( "type" );
|
||||
|
||||
QgsRendererV2AbstractMetadata* m = QgsRendererV2Registry::instance()->rendererMetadata( rendererType );
|
||||
if ( m == nullptr )
|
||||
if ( !m )
|
||||
return nullptr;
|
||||
|
||||
QgsFeatureRendererV2* r = m->createRenderer( element );
|
||||
@ -424,7 +424,7 @@ QgsFeatureRendererV2* QgsFeatureRendererV2::loadSld( const QDomNode &node, QGis:
|
||||
|
||||
// create the renderer and return it
|
||||
QgsRendererV2AbstractMetadata* m = QgsRendererV2Registry::instance()->rendererMetadata( rendererType );
|
||||
if ( m == nullptr )
|
||||
if ( !m )
|
||||
{
|
||||
errorMessage = QString( "Error: Unable to get metadata for '%1' renderer." ).arg( rendererType );
|
||||
return nullptr;
|
||||
@ -512,13 +512,13 @@ void QgsFeatureRendererV2::setVertexMarkerAppearance( int type, int size )
|
||||
bool QgsFeatureRendererV2::willRenderFeature( QgsFeature &feat )
|
||||
{
|
||||
Q_NOWARN_DEPRECATED_PUSH
|
||||
return symbolForFeature( feat ) != nullptr;
|
||||
return nullptr != symbolForFeature( feat );
|
||||
Q_NOWARN_DEPRECATED_POP
|
||||
}
|
||||
|
||||
bool QgsFeatureRendererV2::willRenderFeature( QgsFeature &feat, QgsRenderContext &context )
|
||||
{
|
||||
return symbolForFeature( feat, context ) != nullptr;
|
||||
return nullptr != symbolForFeature( feat, context );
|
||||
}
|
||||
|
||||
void QgsFeatureRendererV2::renderVertexMarker( const QPointF &pt, QgsRenderContext& context )
|
||||
|
@ -75,7 +75,7 @@ QgsRendererV2Registry* QgsRendererV2Registry::instance()
|
||||
|
||||
bool QgsRendererV2Registry::addRenderer( QgsRendererV2AbstractMetadata* metadata )
|
||||
{
|
||||
if ( metadata == nullptr || mRenderers.contains( metadata->name() ) )
|
||||
if ( !metadata || mRenderers.contains( metadata->name() ) )
|
||||
return false;
|
||||
|
||||
mRenderers[metadata->name()] = metadata;
|
||||
|
@ -1011,7 +1011,7 @@ QgsFeatureRendererV2* QgsRuleBasedRendererV2::create( QDomElement& element )
|
||||
QDomElement rulesElem = element.firstChildElement( "rules" );
|
||||
|
||||
Rule* root = Rule::create( rulesElem, symbolMap );
|
||||
if ( root == nullptr )
|
||||
if ( !root )
|
||||
return nullptr;
|
||||
|
||||
QgsRuleBasedRendererV2* r = new QgsRuleBasedRendererV2( root );
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user