diff --git a/scripts/qstringfixup.py b/scripts/qstringfixup.py index eee3c2b8e6e..ab7bfc0e770 100644 --- a/scripts/qstringfixup.py +++ b/scripts/qstringfixup.py @@ -93,11 +93,11 @@ qlatin1str_single_char = re.compile( r"""(.*)(.startsWith\(|.endsWith\(|.indexOf\(|.lastIndexOf\(|\+=) QLatin1String\( ("[^"]") \)(.*)""" ) -make_unique = re.compile( - r"""^(\s*)std::unique_ptr<\s*(.*?)\s*>(\s*.*?\s*=\s*std::make_unique<\s*(.*?)\s*>.*)$""" +make_unique_shared = re.compile( + r"""^(\s*)std::(?:unique|shared)_ptr<\s*(.*?)\s*>(\s*.*?\s*=\s*std::make_(?:unique|shared)<\s*(.*?)\s*>.*)$""" ) -make_unique2 = re.compile( - r"""^(\s*)std::unique_ptr<\s*(.*?)\s*>(?:\s*(.*?)\s*\()\s*(std::make_unique<\s*(.*?)\s*>.*?)\s*\)\s*;$""" +make_unique_shared2 = re.compile( + r"""^(\s*)std::(?:unique|shared)_ptr<\s*(.*?)\s*>(?:\s*(.*?)\s*\()\s*(std::make_(?:unique|shared)<\s*(.*?)\s*>.*?)\s*\)\s*;$""" ) make_unique3 = re.compile( r"""^(\s*)std::unique_ptr<\s*(.*?)\s*>(?:\s*(.*?)\s*\()\s*new\s*(.*?)\s*(\(.*\s*\))\s*\)\s*;""" @@ -235,11 +235,11 @@ while i < len(lines): else: break - m = make_unique.match(line) + m = make_unique_shared.match(line) if m and m.group(2) == m.group(4): line = m.group(1) + "auto" + m.group(3) - m = make_unique2.match(line) + m = make_unique_shared2.match(line) if m and m.group(2) == m.group(5): line = m.group(1) + "auto " + m.group(3) + " = " + m.group(4) + ";" diff --git a/src/core/mesh/qgsmeshcalcutils.cpp b/src/core/mesh/qgsmeshcalcutils.cpp index 9a9221cc139..60abdc76226 100644 --- a/src/core/mesh/qgsmeshcalcutils.cpp +++ b/src/core/mesh/qgsmeshcalcutils.cpp @@ -183,7 +183,7 @@ std::shared_ptr QgsMeshCalcUtils::createMemoryDataset( con { Q_ASSERT( type != QgsMeshDatasetGroupMetadata::DataOnVolumes ); - std::shared_ptr ds = std::make_shared(); + auto ds = std::make_shared(); if ( type == QgsMeshDatasetGroupMetadata::DataOnVertices ) { ds->values.resize( mMeshLayer->dataProvider()->vertexCount() ); @@ -562,7 +562,7 @@ std::shared_ptr QgsMeshCalcUtils::copy( Q_ASSERT( isValid() ); Q_ASSERT( dataset0 ); - std::shared_ptr output = std::make_shared(); + auto output = std::make_shared(); output->values = dataset0->values; //deep copy output->active = dataset0->active; //deep copy output->time = dataset0->time; diff --git a/src/core/providers/meshmemory/qgsmeshmemorydataprovider.cpp b/src/core/providers/meshmemory/qgsmeshmemorydataprovider.cpp index 76b656a13d5..569e41cdeb8 100644 --- a/src/core/providers/meshmemory/qgsmeshmemorydataprovider.cpp +++ b/src/core/providers/meshmemory/qgsmeshmemorydataprovider.cpp @@ -182,7 +182,7 @@ bool QgsMeshMemoryDataProvider::splitDatasetSections( const QString &uri, QgsMes { if ( !success ) break; - std::shared_ptr dataset = std::make_shared(); + auto dataset = std::make_shared(); success = addDatasetValues( sections[i], dataset, datasetGroup.isScalar() ); if ( success ) success = checkDatasetValidity( dataset, datasetGroup.dataType() ); diff --git a/src/core/qgsofflineediting.cpp b/src/core/qgsofflineediting.cpp index 5f9bd0182f1..769ebaaf9f8 100644 --- a/src/core/qgsofflineediting.cpp +++ b/src/core/qgsofflineediting.cpp @@ -180,7 +180,7 @@ void QgsOfflineEditing::synchronize( bool useTransaction ) remoteName.chop( remoteNameSuffix.size() ); const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; // skip-keyword-check - std::shared_ptr remoteLayer = std::make_shared( remoteSource, remoteName, remoteProvider, options ); + auto remoteLayer = std::make_shared( remoteSource, remoteName, remoteProvider, options ); if ( ! remoteLayer->isValid() ) { diff --git a/src/providers/arcgisrest/qgsafsshareddata.cpp b/src/providers/arcgisrest/qgsafsshareddata.cpp index 96765ec53ed..cd7e5682dd5 100644 --- a/src/providers/arcgisrest/qgsafsshareddata.cpp +++ b/src/providers/arcgisrest/qgsafsshareddata.cpp @@ -59,7 +59,7 @@ QgsAfsSharedData::QgsAfsSharedData( const QgsDataSourceUri &uri ) std::shared_ptr QgsAfsSharedData::clone() const { QgsReadWriteLocker locker( mReadWriteLock, QgsReadWriteLocker::Read ); - std::shared_ptr copy = std::make_shared( mDataSource ); + auto copy = std::make_shared( mDataSource ); copy->mLimitBBox = mLimitBBox; copy->mExtent = mExtent; copy->mGeometryType = mGeometryType; diff --git a/src/providers/oracle/qgsoracleproviderconnection.cpp b/src/providers/oracle/qgsoracleproviderconnection.cpp index d5f13c965bf..7a6a6a87398 100644 --- a/src/providers/oracle/qgsoracleproviderconnection.cpp +++ b/src/providers/oracle/qgsoracleproviderconnection.cpp @@ -1351,7 +1351,7 @@ QgsAbstractDatabaseProviderConnection::QueryResult QgsOracleProviderConnection:: if ( feedback && feedback->isCanceled() ) return QgsAbstractDatabaseProviderConnection::QueryResult(); - std::shared_ptr pconn = std::make_shared( QgsDataSourceUri { uri() }.connectionInfo( false ) ); + auto pconn = std::make_shared( QgsDataSourceUri { uri() }.connectionInfo( false ) ); if ( !pconn->get() ) { throw QgsProviderConnectionException( QObject::tr( "Connection failed: %1" ).arg( uri() ) ); diff --git a/tests/src/core/testqgsmeshlayerinterpolator.cpp b/tests/src/core/testqgsmeshlayerinterpolator.cpp index 1898282a075..7b72dab8307 100644 --- a/tests/src/core/testqgsmeshlayerinterpolator.cpp +++ b/tests/src/core/testqgsmeshlayerinterpolator.cpp @@ -91,7 +91,7 @@ void TestQgsMeshLayerInterpolator::testExportRasterBand() QVERIFY( block->isNoData( 10, 10 ) ); auto virtualGroup = std::make_unique( QStringLiteral( "on face" ), QgsMeshDatasetGroupMetadata::DataOnFaces ); - std::shared_ptr dataset = std::make_shared(); + auto dataset = std::make_shared(); dataset->values.resize( 2 ); dataset->values[0] = 12; dataset->values[1] = 36;