From 6db09f06796cf9abaa460b5c76ceabb1cee8fa42 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 13 May 2019 13:54:09 +0200 Subject: [PATCH] [libcalamares] Handle all SizeUnit cases inside switch - Although None will be filtered out already by unitsComparable(), include it in the switch to avoid a warning .. then we can drop the post-switch return since the switch covers all possible values of the enum. --- src/libcalamares/partition/PartitionSize.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libcalamares/partition/PartitionSize.cpp b/src/libcalamares/partition/PartitionSize.cpp index 98db92985..8eb399585 100644 --- a/src/libcalamares/partition/PartitionSize.cpp +++ b/src/libcalamares/partition/PartitionSize.cpp @@ -176,6 +176,8 @@ PartitionSize::operator< ( const PartitionSize& other ) const switch ( m_unit ) { + case SizeUnit::None: + return false; case SizeUnit::Percent: return ( m_value < other.m_value ); case SizeUnit::Byte: @@ -184,8 +186,6 @@ PartitionSize::operator< ( const PartitionSize& other ) const case SizeUnit::GiB: return ( toBytes() < other.toBytes () ); } - - return false; } bool @@ -196,6 +196,8 @@ PartitionSize::operator> ( const PartitionSize& other ) const switch ( m_unit ) { + case SizeUnit::None: + return false; case SizeUnit::Percent: return ( m_value > other.m_value ); case SizeUnit::Byte: @@ -204,8 +206,6 @@ PartitionSize::operator> ( const PartitionSize& other ) const case SizeUnit::GiB: return ( toBytes() > other.toBytes () ); } - - return false; } bool @@ -216,6 +216,8 @@ PartitionSize::operator== ( const PartitionSize& other ) const switch ( m_unit ) { + case SizeUnit::None: + return false; case SizeUnit::Percent: return ( m_value == other.m_value ); case SizeUnit::Byte: @@ -224,8 +226,6 @@ PartitionSize::operator== ( const PartitionSize& other ) const case SizeUnit::GiB: return ( toBytes() == other.toBytes () ); } - - return false; } } // namespace Calamares