Skip to content

Commit

Permalink
More nullptr conversions
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 4, 2016
1 parent 8df09a6 commit 8c38bc9
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/gui/qgsgroupwmsdatadialog.h
Expand Up @@ -28,7 +28,7 @@ class GUI_EXPORT QgsGroupWMSDataDialog: public QDialog, private Ui::QgsGroupWMSD

public:
//! Constructor
QgsGroupWMSDataDialog( QWidget *parent = 0, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags );
QgsGroupWMSDataDialog( QWidget *parent = nullptr, const Qt::WindowFlags& fl = QgisGui::ModalDialogFlags );
//~QgsGroupWMSDataDialog();

//! return group WMS title
Expand Down
4 changes: 2 additions & 2 deletions src/providers/virtual/qgsvirtuallayerprovider.h
Expand Up @@ -99,10 +99,10 @@ class QgsVirtualLayerProvider: public QgsVectorDataProvider
// underlying vector layers
struct SourceLayer
{
SourceLayer(): layer( 0 ) {}
SourceLayer(): layer( nullptr ) {}
SourceLayer( QgsVectorLayer *l, const QString& n = "" ) : layer( l ), name( n ) {}
SourceLayer( const QString& p, const QString& s, const QString& n, const QString& e = "UTF-8" ) :
layer( 0 ), name( n ), source( s ), provider( p ), encoding( e ) {}
layer( nullptr ), name( n ), source( s ), provider( p ), encoding( e ) {}
// non-null if it refers to a live layer
QgsVectorLayer* layer;
QString name;
Expand Down
4 changes: 2 additions & 2 deletions src/providers/virtual/qgsvirtuallayerqueryparser.cpp
Expand Up @@ -23,7 +23,7 @@ namespace QgsVirtualLayerQueryParser
while ( true )
{
char *errMsg = nullptr;
int r = sqlite3_exec( db.get(), query.toLocal8Bit().constData(), NULL, NULL, &errMsg );
int r = sqlite3_exec( db.get(), query.toLocal8Bit().constData(), nullptr, nullptr, &errMsg );
QString err = errMsg;
if ( r && err.startsWith( noSuchError ) )
{
Expand All @@ -32,7 +32,7 @@ namespace QgsVirtualLayerQueryParser

// create a dummy table to skip this error
QString createStr = QString( "CREATE TABLE \"%1\" (id int)" ).arg( tableName.replace( "\"", "\"\"" ) );
( void )sqlite3_exec( db.get(), createStr.toLocal8Bit().constData(), NULL, NULL, NULL );
( void )sqlite3_exec( db.get(), createStr.toLocal8Bit().constData(), nullptr, NULL, NULL );
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/providers/virtual/qgsvirtuallayersqlitehelper.cpp
Expand Up @@ -87,7 +87,7 @@ namespace Sqlite
Query::Query( sqlite3* db, const QString& q ) : db_( db ), nBind_( 1 )
{
QByteArray ba( q.toLocal8Bit() );
int r = sqlite3_prepare_v2( db, ba.constData(), ba.size(), &stmt_, NULL );
int r = sqlite3_prepare_v2( db, ba.constData(), ba.size(), &stmt_, nullptr );
if ( r )
{
QString err = QString( "Query preparation error on %1" ).arg( q );
Expand Down Expand Up @@ -121,7 +121,7 @@ namespace Sqlite
void Query::exec( sqlite3* db, const QString& sql )
{
char *errMsg = nullptr;
int r = sqlite3_exec( db, sql.toLocal8Bit().constData(), NULL, NULL, &errMsg );
int r = sqlite3_exec( db, sql.toLocal8Bit().constData(), nullptr, nullptr, &errMsg );
if ( r )
{
QString err = QString( "Query execution error on %1: %2 - %3" ).arg( sql ).arg( r ).arg( errMsg );
Expand Down
2 changes: 1 addition & 1 deletion src/providers/virtual/qgsvirtuallayersqlitehelper.h
Expand Up @@ -32,7 +32,7 @@ extern "C"
class QgsScopedSqlite
{
public:
QgsScopedSqlite() : db_( 0 ) {}
QgsScopedSqlite() : db_( nullptr ) {}

explicit QgsScopedSqlite( const QString& path, bool withExtension = true );

Expand Down
28 changes: 14 additions & 14 deletions src/providers/virtual/qgsvirtuallayersqlitemodule.cpp
Expand Up @@ -55,7 +55,7 @@ void initVirtualLayerMetadata( sqlite3* db )

sqlite3_stmt *stmt;
int r;
r = sqlite3_prepare_v2( db, "SELECT name FROM sqlite_master WHERE name='_meta'", -1, &stmt, NULL );
r = sqlite3_prepare_v2( db, "SELECT name FROM sqlite_master WHERE name='_meta'", -1, &stmt, nullptr );
if ( r )
{
throw std::runtime_error( sqlite3_errmsg( db ) );
Expand All @@ -66,7 +66,7 @@ void initVirtualLayerMetadata( sqlite3* db )
char *errMsg;
if ( create_meta )
{
r = sqlite3_exec( db, QString( "CREATE TABLE _meta (version INT, url TEXT); INSERT INTO _meta (version) VALUES(%1);" ).arg( VIRTUAL_LAYER_VERSION ).toLocal8Bit().constData(), NULL, NULL, &errMsg );
r = sqlite3_exec( db, QString( "CREATE TABLE _meta (version INT, url TEXT); INSERT INTO _meta (version) VALUES(%1);" ).arg( VIRTUAL_LAYER_VERSION ).toLocal8Bit().constData(), nullptr, nullptr, &errMsg );
if ( r )
{
throw std::runtime_error( errMsg );
Expand Down Expand Up @@ -485,7 +485,7 @@ int vtable_bestindex( sqlite3_vtab *pvtab, sqlite3_index_info* index_info )
index_info->idxNum = 1; // PK filter
index_info->estimatedCost = 1.0; // ??
//index_info->estimatedRows = 1;
index_info->idxStr = NULL;
index_info->idxStr = nullptr;
index_info->needToFreeIdxStr = 0;
return SQLITE_OK;
}
Expand All @@ -500,15 +500,15 @@ int vtable_bestindex( sqlite3_vtab *pvtab, sqlite3_index_info* index_info )
index_info->idxNum = 2; // RTree filter
index_info->estimatedCost = 1.0; // ??
//index_info->estimatedRows = 1;
index_info->idxStr = NULL;
index_info->idxStr = nullptr;
index_info->needToFreeIdxStr = 0;
return SQLITE_OK;
}
}
index_info->idxNum = 0;
index_info->estimatedCost = 10.0;
//index_info->estimatedRows = 10;
index_info->idxStr = NULL;
index_info->idxStr = nullptr;
index_info->needToFreeIdxStr = 0;
return SQLITE_OK;
}
Expand Down Expand Up @@ -685,15 +685,15 @@ int qgsvlayer_module_init( sqlite3 *db, char **pzErrMsg, void * unused /*const s
module.xRowid = vtable_rowid;
module.xRename = vtable_rename;

module.xUpdate = NULL;
module.xBegin = NULL;
module.xSync = NULL;
module.xCommit = NULL;
module.xRollback = NULL;
module.xFindFunction = NULL;
module.xSavepoint = NULL;
module.xRelease = NULL;
module.xRollbackTo = NULL;
module.xUpdate = nullptr;
module.xBegin = nullptr;
module.xSync = nullptr;
module.xCommit = nullptr;
module.xRollback = nullptr;
module.xFindFunction = nullptr;
module.xSavepoint = nullptr;
module.xRelease = nullptr;
module.xRollbackTo = nullptr;

ModuleContext* context = new ModuleContext;
sqlite3_create_module_v2( db, "QgsVLayer", &module, context, module_destroy );
Expand Down

0 comments on commit 8c38bc9

Please sign in to comment.