mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-28 01:45:36 -04:00
Clang: refactor units-converters, reduce warnings
This commit is contained in:
parent
31fa9e4251
commit
a06911e9aa
4 changed files with 82 additions and 33 deletions
|
@ -25,6 +25,7 @@
|
|||
#include "core/PartUtils.h"
|
||||
|
||||
#include "utils/CalamaresUtilsSystem.h"
|
||||
#include "utils/Units.h"
|
||||
#include "JobQueue.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "GlobalStorage.h"
|
||||
|
@ -36,25 +37,10 @@
|
|||
|
||||
namespace PartitionActions
|
||||
{
|
||||
constexpr qint64 operator ""_MiB( unsigned long long m )
|
||||
{
|
||||
return m * static_cast< qint64 >( 1024 ) * 1024;
|
||||
}
|
||||
|
||||
constexpr qint64 operator ""_GiB( unsigned long long m )
|
||||
{
|
||||
return operator ""_MiB(m) * static_cast< qint64 >( 1024 );
|
||||
}
|
||||
|
||||
constexpr qint64 toMiB( unsigned long long m )
|
||||
{
|
||||
return operator ""_MiB( m );
|
||||
}
|
||||
|
||||
constexpr qint64 toGiB( unsigned long long m )
|
||||
{
|
||||
return operator ""_GiB( m );
|
||||
}
|
||||
using CalamaresUtils::GiBtoBytes;
|
||||
using CalamaresUtils::MiBtoBytes;
|
||||
using CalamaresUtils::operator""_GiB;
|
||||
using CalamaresUtils::operator""_MiB;
|
||||
|
||||
qint64
|
||||
swapSuggestion( const qint64 availableSpaceB )
|
||||
|
@ -140,11 +126,11 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||
empty_space_size = 1;
|
||||
}
|
||||
|
||||
qint64 firstFreeSector = toMiB(empty_space_size) / dev->logicalSize() + 1;
|
||||
qint64 firstFreeSector = MiBtoBytes(empty_space_size) / dev->logicalSize() + 1;
|
||||
|
||||
if ( isEfi )
|
||||
{
|
||||
qint64 lastSector = firstFreeSector + ( toMiB(uefisys_part_size) / dev->logicalSize() );
|
||||
qint64 lastSector = firstFreeSector + ( MiBtoBytes(uefisys_part_size) / dev->logicalSize() );
|
||||
core->createPartitionTable( dev, PartitionTable::gpt );
|
||||
Partition* efiPartition = KPMHelpers::createNewPartition(
|
||||
dev->partitionTable(),
|
||||
|
@ -175,7 +161,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, const QString& luksPass
|
|||
qint64 availableSpaceB = ( dev->totalLogical() - firstFreeSector ) * dev->logicalSize();
|
||||
suggestedSwapSizeB = swapSuggestion( availableSpaceB );
|
||||
qint64 requiredSpaceB =
|
||||
toGiB( gs->value( "requiredStorageGB" ).toDouble() + 0.1 + 2.0 ) +
|
||||
GiBtoBytes( gs->value( "requiredStorageGB" ).toDouble() + 0.1 + 2.0 ) +
|
||||
suggestedSwapSizeB;
|
||||
|
||||
// If there is enough room for ESP + root + swap, create swap, otherwise don't.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue