From aec066359a4553294c0e144f97bc85600388f175 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Wed, 28 Oct 2020 10:41:48 -0400 Subject: [PATCH 1/2] [libcalamares] Fix coding style --- src/libcalamares/partition/PartitionQuery.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcalamares/partition/PartitionQuery.cpp b/src/libcalamares/partition/PartitionQuery.cpp index beba6b9bc..af281f65b 100644 --- a/src/libcalamares/partition/PartitionQuery.cpp +++ b/src/libcalamares/partition/PartitionQuery.cpp @@ -67,11 +67,15 @@ findPartitionByPath( const QList< Device* >& devices, const QString& path ) } for ( auto device : devices ) + { for ( auto it = PartitionIterator::begin( device ); it != PartitionIterator::end( device ); ++it ) + { if ( ( *it )->partitionPath() == path.simplified() ) { return *it; } + } + } return nullptr; } @@ -81,11 +85,15 @@ findPartitions( const QList< Device* >& devices, std::function< bool( Partition* { QList< Partition* > results; for ( auto device : devices ) + { for ( auto it = PartitionIterator::begin( device ); it != PartitionIterator::end( device ); ++it ) + { if ( criterionFunction( *it ) ) { results.append( *it ); } + } + } return results; } From 03df5f689152fe31a69d19222f9be0ed18935c8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20PORTAY?= Date: Wed, 28 Oct 2020 11:38:01 -0400 Subject: [PATCH 2/2] [libcalamares] Fix constness of functions --- src/libcalamares/partition/PartitionQuery.cpp | 4 ++-- src/libcalamares/partition/PartitionQuery.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcalamares/partition/PartitionQuery.cpp b/src/libcalamares/partition/PartitionQuery.cpp index af281f65b..4c9c1549d 100644 --- a/src/libcalamares/partition/PartitionQuery.cpp +++ b/src/libcalamares/partition/PartitionQuery.cpp @@ -27,14 +27,14 @@ using ::Device; using ::Partition; bool -isPartitionFreeSpace( Partition* partition ) +isPartitionFreeSpace( const Partition* partition ) { return partition->roles().has( PartitionRole::Unallocated ); } bool -isPartitionNew( Partition* partition ) +isPartitionNew( const Partition* partition ) { #if defined( WITH_KPMCORE4API ) constexpr auto NewState = Partition::State::New; diff --git a/src/libcalamares/partition/PartitionQuery.h b/src/libcalamares/partition/PartitionQuery.h index 817966d35..9ef5f41f6 100644 --- a/src/libcalamares/partition/PartitionQuery.h +++ b/src/libcalamares/partition/PartitionQuery.h @@ -34,14 +34,14 @@ using ::Device; using ::Partition; /** @brief Is this a free-space area? */ -bool isPartitionFreeSpace( Partition* ); +bool isPartitionFreeSpace( const Partition* ); /** @brief Is this partition newly-to-be-created? * * Returns true if the partition is planned to be created by the installer as * opposed to already existing on the disk. */ -bool isPartitionNew( Partition* ); +bool isPartitionNew( const Partition* ); /** * Iterates on all devices and return the first partition which is (already)