[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.
This commit is contained in:
Adriaan de Groot 2019-05-13 13:54:09 +02:00
parent 90975b62bf
commit 6db09f0679

View File

@ -176,6 +176,8 @@ PartitionSize::operator< ( const PartitionSize& other ) const
switch ( m_unit ) switch ( m_unit )
{ {
case SizeUnit::None:
return false;
case SizeUnit::Percent: case SizeUnit::Percent:
return ( m_value < other.m_value ); return ( m_value < other.m_value );
case SizeUnit::Byte: case SizeUnit::Byte:
@ -184,8 +186,6 @@ PartitionSize::operator< ( const PartitionSize& other ) const
case SizeUnit::GiB: case SizeUnit::GiB:
return ( toBytes() < other.toBytes () ); return ( toBytes() < other.toBytes () );
} }
return false;
} }
bool bool
@ -196,6 +196,8 @@ PartitionSize::operator> ( const PartitionSize& other ) const
switch ( m_unit ) switch ( m_unit )
{ {
case SizeUnit::None:
return false;
case SizeUnit::Percent: case SizeUnit::Percent:
return ( m_value > other.m_value ); return ( m_value > other.m_value );
case SizeUnit::Byte: case SizeUnit::Byte:
@ -204,8 +206,6 @@ PartitionSize::operator> ( const PartitionSize& other ) const
case SizeUnit::GiB: case SizeUnit::GiB:
return ( toBytes() > other.toBytes () ); return ( toBytes() > other.toBytes () );
} }
return false;
} }
bool bool
@ -216,6 +216,8 @@ PartitionSize::operator== ( const PartitionSize& other ) const
switch ( m_unit ) switch ( m_unit )
{ {
case SizeUnit::None:
return false;
case SizeUnit::Percent: case SizeUnit::Percent:
return ( m_value == other.m_value ); return ( m_value == other.m_value );
case SizeUnit::Byte: case SizeUnit::Byte:
@ -224,8 +226,6 @@ PartitionSize::operator== ( const PartitionSize& other ) const
case SizeUnit::GiB: case SizeUnit::GiB:
return ( toBytes() == other.toBytes () ); return ( toBytes() == other.toBytes () );
} }
return false;
} }
} // namespace Calamares } // namespace Calamares