Fix more implicit type conversion warnings.
This commit is contained in:
parent
6c433c264c
commit
17e6c32633
|
@ -41,7 +41,7 @@ protected:
|
|||
|
||||
public:
|
||||
virtual bool open() = 0;
|
||||
virtual qint32 sectorSize() const = 0;
|
||||
virtual qint64 sectorSize() const = 0;
|
||||
virtual bool readSectors(void* buffer, qint64 readOffset, qint64 numSectors) = 0;
|
||||
virtual qint64 length() const = 0;
|
||||
virtual bool overlaps(const CopyTarget& target) const = 0;
|
||||
|
|
|
@ -58,7 +58,7 @@ bool CopySourceDevice::open()
|
|||
/** Returns the Device's sector size
|
||||
@return the sector size
|
||||
*/
|
||||
qint32 CopySourceDevice::sectorSize() const
|
||||
qint64 CopySourceDevice::sectorSize() const
|
||||
{
|
||||
return device().logicalSize();
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
public:
|
||||
bool open() override;
|
||||
qint32 sectorSize() const override;
|
||||
qint64 sectorSize() const override;
|
||||
bool readSectors(void* buffer, qint64 readOffset, qint64 numSectors) override;
|
||||
qint64 length() const override;
|
||||
bool overlaps(const CopyTarget& target) const override;
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
@param filename filename of the file to copy from
|
||||
@param sectorsize the sector size to assume for the file, usually the target Device's sector size
|
||||
*/
|
||||
CopySourceFile::CopySourceFile(const QString& filename, qint32 sectorsize) :
|
||||
CopySourceFile::CopySourceFile(const QString& filename, qint64 sectorsize) :
|
||||
CopySource(),
|
||||
m_File(filename),
|
||||
m_SectorSize(sectorsize)
|
||||
|
|
|
@ -36,14 +36,14 @@ class CopyTarget;
|
|||
class CopySourceFile : public CopySource
|
||||
{
|
||||
public:
|
||||
CopySourceFile(const QString& filename, qint32 sectorsize);
|
||||
CopySourceFile(const QString& filename, qint64 sectorsize);
|
||||
|
||||
public:
|
||||
bool open() override;
|
||||
bool readSectors(void* buffer, qint64 readOffset, qint64 numSectors) override;
|
||||
qint64 length() const override;
|
||||
|
||||
qint32 sectorSize() const override {
|
||||
qint64 sectorSize() const override {
|
||||
return m_SectorSize; /**< @return the file's sector size */
|
||||
}
|
||||
bool overlaps(const CopyTarget&) const override {
|
||||
|
@ -66,7 +66,7 @@ protected:
|
|||
|
||||
protected:
|
||||
QFile m_File;
|
||||
qint32 m_SectorSize;
|
||||
qint64 m_SectorSize;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
@param s the size the copy source will (pretend to) have
|
||||
@param sectorsize the sectorsize the copy source will (pretend to) have
|
||||
*/
|
||||
CopySourceShred::CopySourceShred(qint64 s, qint32 sectorsize, bool randomShred) :
|
||||
CopySourceShred::CopySourceShred(qint64 s, qint64 sectorsize, bool randomShred) :
|
||||
CopySource(),
|
||||
m_Size(s),
|
||||
m_SectorSize(sectorsize),
|
||||
|
|
|
@ -34,14 +34,14 @@ class CopyTarget;
|
|||
class CopySourceShred : public CopySource
|
||||
{
|
||||
public:
|
||||
CopySourceShred(qint64 size, qint32 sectorsize, bool randomShred);
|
||||
CopySourceShred(qint64 size, qint64 sectorsize, bool randomShred);
|
||||
|
||||
public:
|
||||
bool open() override;
|
||||
bool readSectors(void* buffer, qint64 readOffset, qint64 numSectors) override;
|
||||
qint64 length() const override;
|
||||
|
||||
qint32 sectorSize() const override {
|
||||
qint64 sectorSize() const override {
|
||||
return m_SectorSize; /**< @return the file's sector size */
|
||||
}
|
||||
bool overlaps(const CopyTarget&) const override {
|
||||
|
@ -67,7 +67,7 @@ protected:
|
|||
|
||||
private:
|
||||
qint64 m_Size;
|
||||
qint32 m_SectorSize;
|
||||
qint64 m_SectorSize;
|
||||
QFile m_SourceFile;
|
||||
};
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ protected:
|
|||
|
||||
public:
|
||||
virtual bool open() = 0;
|
||||
virtual qint32 sectorSize() const = 0;
|
||||
virtual qint64 sectorSize() const = 0;
|
||||
virtual bool writeSectors(void* buffer, qint64 writeOffset, qint64 numSectors) = 0;
|
||||
virtual qint64 firstSector() const = 0;
|
||||
virtual qint64 lastSector() const = 0;
|
||||
|
|
|
@ -54,7 +54,7 @@ bool CopyTargetDevice::open()
|
|||
}
|
||||
|
||||
/** @return the Device's sector size */
|
||||
qint32 CopyTargetDevice::sectorSize() const
|
||||
qint64 CopyTargetDevice::sectorSize() const
|
||||
{
|
||||
return device().logicalSize();
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ public:
|
|||
|
||||
public:
|
||||
bool open() override;
|
||||
qint32 sectorSize() const override;
|
||||
qint64 sectorSize() const override;
|
||||
bool writeSectors(void* buffer, qint64 writeOffset, qint64 numSectors) override;
|
||||
qint64 firstSector() const override {
|
||||
return m_FirstSector; /**< @return the first sector to write to */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
@param filename name of the file to write to
|
||||
@param sectorsize the "sector size" of the file to write to, usually the sector size of the CopySourceDevice
|
||||
*/
|
||||
CopyTargetFile::CopyTargetFile(const QString& filename, qint32 sectorsize) :
|
||||
CopyTargetFile::CopyTargetFile(const QString& filename, qint64 sectorsize) :
|
||||
CopyTarget(),
|
||||
m_File(filename),
|
||||
m_SectorSize(sectorsize)
|
||||
|
|
|
@ -36,13 +36,13 @@ class QString;
|
|||
class CopyTargetFile : public CopyTarget
|
||||
{
|
||||
public:
|
||||
CopyTargetFile(const QString& filename, qint32 sectorsize);
|
||||
CopyTargetFile(const QString& filename, qint64 sectorsize);
|
||||
|
||||
public:
|
||||
bool open() override;
|
||||
bool writeSectors(void* buffer, qint64 writeOffset, qint64 numSectors) override;
|
||||
|
||||
qint32 sectorSize() const override {
|
||||
qint64 sectorSize() const override {
|
||||
return m_SectorSize; /**< @return the file's sector size */
|
||||
}
|
||||
qint64 firstSector() const override {
|
||||
|
@ -62,7 +62,7 @@ protected:
|
|||
|
||||
protected:
|
||||
QFile m_File;
|
||||
qint32 m_SectorSize;
|
||||
qint64 m_SectorSize;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
Device::Device(const QString& name,
|
||||
const QString& deviceNode,
|
||||
const qint32 logicalSize,
|
||||
const qint64 logicalSize,
|
||||
const qint64 totalLogical,
|
||||
const QString& iconName,
|
||||
Device::Type type)
|
||||
|
|
|
@ -54,7 +54,7 @@ public:
|
|||
};
|
||||
|
||||
protected:
|
||||
explicit Device(const QString& name, const QString& deviceNode, const qint32 logicalSize, const qint64 totalLogical, const QString& iconName = QString(), Device::Type type = Device::Disk_Device);
|
||||
explicit Device(const QString& name, const QString& deviceNode, const qint64 logicalSize, const qint64 totalLogical, const QString& iconName = QString(), Device::Type type = Device::Disk_Device);
|
||||
|
||||
public:
|
||||
explicit Device(const Device& other);
|
||||
|
@ -108,7 +108,7 @@ public:
|
|||
m_PartitionTable = ptable;
|
||||
}
|
||||
|
||||
virtual qint32 logicalSize() const {
|
||||
virtual qint64 logicalSize() const {
|
||||
return m_LogicalSize;
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ public:
|
|||
protected:
|
||||
QString m_Name;
|
||||
QString m_DeviceNode;
|
||||
qint32 m_LogicalSize;
|
||||
qint64 m_LogicalSize;
|
||||
qint64 m_TotalLogical;
|
||||
PartitionTable* m_PartitionTable;
|
||||
QString m_IconName;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#define BLKPBSZGET _IO(0x12,123)/* get block physical sector size */
|
||||
#endif
|
||||
|
||||
static qint32 getPhysicalSectorSize(const QString& device_node)
|
||||
static qint64 getPhysicalSectorSize(const QString& device_node)
|
||||
{
|
||||
/*
|
||||
* possible ways of getting the physical sector size for a drive:
|
||||
|
@ -85,7 +85,7 @@ DiskDevice::DiskDevice(const QString& name,
|
|||
qint32 heads,
|
||||
qint32 numSectors,
|
||||
qint32 cylinders,
|
||||
qint32 sectorSize,
|
||||
qint64 sectorSize,
|
||||
const QString& iconName)
|
||||
: Device(name, deviceNode, sectorSize, (static_cast<qint64>(heads) * cylinders * numSectors), iconName, Device::Disk_Device)
|
||||
, m_Heads(heads)
|
||||
|
|
|
@ -48,7 +48,7 @@ class LIBKPMCORE_EXPORT DiskDevice : public Device
|
|||
friend class CoreBackend;
|
||||
|
||||
public:
|
||||
DiskDevice(const QString& name, const QString& deviceNode, qint32 heads, qint32 numSectors, qint32 cylinders, qint32 sectorSize, const QString& iconName = QString());
|
||||
DiskDevice(const QString& name, const QString& deviceNode, qint32 heads, qint32 numSectors, qint32 cylinders, qint64 sectorSize, const QString& iconName = QString());
|
||||
|
||||
public:
|
||||
qint32 heads() const {
|
||||
|
@ -60,10 +60,10 @@ public:
|
|||
qint32 sectorsPerTrack() const {
|
||||
return m_SectorsPerTrack; /**< @return the number of sectors on the Device in CHS notation */
|
||||
}
|
||||
qint32 physicalSectorSize() const {
|
||||
qint64 physicalSectorSize() const {
|
||||
return m_PhysicalSectorSize; /**< @return the physical sector size the Device uses or -1 if unknown */
|
||||
}
|
||||
qint32 logicalSectorSize() const {
|
||||
qint64 logicalSectorSize() const {
|
||||
return m_LogicalSectorSize; /**< @return the logical sector size the Device uses */
|
||||
}
|
||||
qint64 totalSectors() const {
|
||||
|
@ -77,8 +77,8 @@ private:
|
|||
qint32 m_Heads;
|
||||
qint32 m_SectorsPerTrack;
|
||||
qint32 m_Cylinders;
|
||||
qint32 m_LogicalSectorSize;
|
||||
qint32 m_PhysicalSectorSize;
|
||||
qint64 m_LogicalSectorSize;
|
||||
qint64 m_PhysicalSectorSize;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -147,7 +147,7 @@ Partition* LvmDevice::scanPartition(const QString& lvPath, PartitionTable* pTabl
|
|||
fs->setSectorsUsed( (storage.bytesTotal() - storage.bytesFree()) / logicalSize() );
|
||||
}
|
||||
else if (fs->supportGetUsed() == FileSystem::cmdSupportFileSystem)
|
||||
fs->setSectorsUsed(qCeil(fs->readUsedCapacity(lvPath) / static_cast<float>(logicalSize())));
|
||||
fs->setSectorsUsed(qCeil(fs->readUsedCapacity(lvPath) / static_cast<double>(logicalSize())));
|
||||
}
|
||||
|
||||
if (fs->supportGetLabel() != FileSystem::cmdSupportNone) {
|
||||
|
@ -250,7 +250,7 @@ const QStringList LvmDevice::getLVs(const QString& vgName)
|
|||
qint64 LvmDevice::getPeSize(const QString& vgName)
|
||||
{
|
||||
QString val = getField(QStringLiteral("vg_extent_size"), vgName);
|
||||
return val.isEmpty() ? -1 : val.toInt();
|
||||
return val.isEmpty() ? -1 : val.toLongLong();
|
||||
}
|
||||
|
||||
qint64 LvmDevice::getTotalPE(const QString& vgName)
|
||||
|
|
|
@ -162,7 +162,7 @@ public:
|
|||
return m_LastSector; /**< @return the Partition's last sector on the Device */
|
||||
}
|
||||
qint64 sectorsUsed() const;
|
||||
qint32 sectorSize() const {
|
||||
qint64 sectorSize() const {
|
||||
return m_SectorSize; /**< @return the sector size on the Partition's Device */
|
||||
}
|
||||
qint64 length() const {
|
||||
|
@ -293,7 +293,7 @@ private:
|
|||
PartitionTable::Flags m_AvailableFlags;
|
||||
PartitionTable::Flags m_ActiveFlags;
|
||||
bool m_IsMounted;
|
||||
qint32 m_SectorSize;
|
||||
qint64 m_SectorSize;
|
||||
State m_State;
|
||||
};
|
||||
|
||||
|
|
|
@ -134,8 +134,8 @@ public:
|
|||
|
||||
PartitionRole::Roles childRoles(const Partition& p) const;
|
||||
|
||||
int numPrimaries() const;
|
||||
int maxPrimaries() const {
|
||||
qint32 numPrimaries() const;
|
||||
qint32 maxPrimaries() const {
|
||||
return m_MaxPrimaries; /**< @return max number of primary partitions this PartitionTable can handle */
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
static QString getAttrName(qint32 id);
|
||||
static QString getAttrDescription(qint32 id);
|
||||
static QString getPrettyValue(qint64 value, qint64 unit);
|
||||
static QString getPrettyValue(quint64 value, qint64 unit);
|
||||
static SmartAttribute::Assessment getAssessment(const SkSmartAttributeParsedData* a);
|
||||
static QString getRaw(const uint8_t*);
|
||||
|
||||
|
@ -68,7 +68,7 @@ QString SmartAttribute::assessmentToString(Assessment a)
|
|||
}
|
||||
}
|
||||
|
||||
static QString getPrettyValue(qint64 value, qint64 unit)
|
||||
static QString getPrettyValue(quint64 value, qint64 unit)
|
||||
{
|
||||
QString rval;
|
||||
|
||||
|
|
|
@ -36,10 +36,10 @@ SmartStatus::SmartStatus(const QString& device_path) :
|
|||
m_Firmware(),
|
||||
m_Overall(Bad),
|
||||
m_SelfTestStatus(Success),
|
||||
m_Temp(-99),
|
||||
m_BadSectors(-99),
|
||||
m_PowerCycles(-99),
|
||||
m_PoweredOn(-99)
|
||||
m_Temp(0),
|
||||
m_BadSectors(0),
|
||||
m_PowerCycles(0),
|
||||
m_PoweredOn(0)
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
@ -191,7 +191,7 @@ void SmartStatus::update()
|
|||
setInitSuccess(true);
|
||||
}
|
||||
|
||||
QString SmartStatus::tempToString(qint64 mkelvin)
|
||||
QString SmartStatus::tempToString(quint64 mkelvin)
|
||||
{
|
||||
const double celsius = (mkelvin - 273150.0) / 1000.0;
|
||||
const double fahrenheit = 9.0 * celsius / 5.0 + 32;
|
||||
|
|
|
@ -81,16 +81,16 @@ public:
|
|||
const QString& firmware() const {
|
||||
return m_Firmware;
|
||||
}
|
||||
qint64 temp() const {
|
||||
quint64 temp() const {
|
||||
return m_Temp;
|
||||
}
|
||||
qint64 badSectors() const {
|
||||
quint64 badSectors() const {
|
||||
return m_BadSectors;
|
||||
}
|
||||
qint64 powerCycles() const {
|
||||
quint64 powerCycles() const {
|
||||
return m_PowerCycles;
|
||||
}
|
||||
qint64 poweredOn() const {
|
||||
quint64 poweredOn() const {
|
||||
return m_PoweredOn;
|
||||
}
|
||||
const Attributes& attributes() const {
|
||||
|
@ -103,7 +103,7 @@ public:
|
|||
return m_SelfTestStatus;
|
||||
}
|
||||
|
||||
static QString tempToString(qint64 mkelvin);
|
||||
static QString tempToString(quint64 mkelvin);
|
||||
static QString overallAssessmentToString(Overall o);
|
||||
static QString selfTestStatusToString(SmartStatus::SelfTestStatus s);
|
||||
|
||||
|
@ -120,19 +120,19 @@ protected:
|
|||
void setFirmware(const QString& f) {
|
||||
m_Firmware = f;
|
||||
}
|
||||
void setTemp(qint64 t) {
|
||||
void setTemp(quint64 t) {
|
||||
m_Temp = t;
|
||||
}
|
||||
void setInitSuccess(bool b) {
|
||||
m_InitSuccess = b;
|
||||
}
|
||||
void setBadSectors(qint64 s) {
|
||||
void setBadSectors(quint64 s) {
|
||||
m_BadSectors = s;
|
||||
}
|
||||
void setPowerCycles(qint64 p) {
|
||||
void setPowerCycles(quint64 p) {
|
||||
m_PowerCycles = p;
|
||||
}
|
||||
void setPoweredOn(qint64 t) {
|
||||
void setPoweredOn(quint64 t) {
|
||||
m_PoweredOn = t;
|
||||
}
|
||||
void setOverall(Overall o) {
|
||||
|
@ -153,10 +153,10 @@ private:
|
|||
QString m_Firmware;
|
||||
Overall m_Overall;
|
||||
SelfTestStatus m_SelfTestStatus;
|
||||
qint64 m_Temp;
|
||||
qint64 m_BadSectors;
|
||||
qint64 m_PowerCycles;
|
||||
qint64 m_PoweredOn;
|
||||
quint64 m_Temp;
|
||||
quint64 m_BadSectors;
|
||||
quint64 m_PowerCycles;
|
||||
quint64 m_PoweredOn;
|
||||
Attributes m_Attributes;
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
*/
|
||||
VolumeManagerDevice::VolumeManagerDevice(const QString& name,
|
||||
const QString& deviceNode,
|
||||
const qint32 logicalSize,
|
||||
const qint64 logicalSize,
|
||||
const qint64 totalLogical,
|
||||
const QString& iconName,
|
||||
Device::Type type)
|
||||
|
|
|
@ -42,7 +42,7 @@ class LIBKPMCORE_EXPORT VolumeManagerDevice : public Device
|
|||
|
||||
public:
|
||||
|
||||
VolumeManagerDevice(const QString& name, const QString& deviceNode, const qint32 logicalSize, const qint64 totalLogical, const QString& iconName = QString(), Device::Type type = Device::Unknown_Device);
|
||||
VolumeManagerDevice(const QString& name, const QString& deviceNode, const qint64 logicalSize, const qint64 totalLogical, const QString& iconName = QString(), Device::Type type = Device::Unknown_Device);
|
||||
|
||||
/**
|
||||
* @return list of physical device's path that makes up volumeManagerDevice.(e.g: /dev/sda, /dev/sdb1)
|
||||
|
|
|
@ -159,11 +159,11 @@ bool fat16::create(Report& report, const QString& deviceNode)
|
|||
|
||||
bool fat16::updateUUID(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
qint32 t = time(nullptr);
|
||||
qint64 t = time(nullptr);
|
||||
|
||||
char uuid[4];
|
||||
for (auto &u : uuid) {
|
||||
u = t & 0xff;
|
||||
u = static_cast<char>(t & 0xff);
|
||||
t >>= 8;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,11 +48,11 @@ bool fat32::create(Report& report, const QString& deviceNode)
|
|||
|
||||
bool fat32::updateUUID(Report& report, const QString& deviceNode) const
|
||||
{
|
||||
qint32 t = time(nullptr);
|
||||
qint64 t = time(nullptr);
|
||||
|
||||
char uuid[4];
|
||||
for (auto &u : uuid) {
|
||||
u = t & 0xff;
|
||||
u = static_cast<char>(t & 0xff);
|
||||
t >>= 8;
|
||||
}
|
||||
|
||||
|
|
|
@ -337,7 +337,7 @@ void luks::loadInnerFileSystem(const QString& mapperNode)
|
|||
setLabel(m_innerFs->readLabel(mapperNode));
|
||||
setUUID(m_innerFs->readUUID(mapperNode));
|
||||
if (m_innerFs->supportGetUsed() == FileSystem::cmdSupportFileSystem)
|
||||
setSectorsUsed(std::ceil((m_innerFs->readUsedCapacity(mapperNode) + payloadOffset()) / static_cast<double>(sectorSize()) ));
|
||||
setSectorsUsed(static_cast<qint64>(std::ceil((m_innerFs->readUsedCapacity(mapperNode) + payloadOffset()) / static_cast<double>(sectorSize()) )));
|
||||
m_innerFs->scan(mapperNode);
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "fs/filesystem.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
#include <QMouseEvent>
|
||||
|
@ -80,8 +82,8 @@ void PartResizerWidget::init(Device& d, Partition& p, qint64 minFirst, qint64 ma
|
|||
setReadOnly(read_only);
|
||||
setMoveAllowed(move_allowed);
|
||||
|
||||
setMinimumLength(qMax(partition().sectorsUsed(), partition().minimumSectors()));
|
||||
setMaximumLength(qMin(totalSectors(), partition().maximumSectors()));
|
||||
setMinimumLength(std::max(partition().sectorsUsed(), partition().minimumSectors()));
|
||||
setMaximumLength(std::min(totalSectors(), partition().maximumSectors()));
|
||||
|
||||
// set margins to accommodate to top/bottom button asymmetric layouts
|
||||
QStyleOptionButton bOpt;
|
||||
|
@ -142,12 +144,12 @@ long double PartResizerWidget::sectorsPerPixel() const
|
|||
|
||||
int PartResizerWidget::partWidgetStart() const
|
||||
{
|
||||
return handleWidth() + (partition().firstSector() - minimumFirstSector()) / sectorsPerPixel();
|
||||
return static_cast<int>(handleWidth() + (partition().firstSector() - minimumFirstSector()) / sectorsPerPixel());
|
||||
}
|
||||
|
||||
int PartResizerWidget::partWidgetWidth() const
|
||||
{
|
||||
return partition().length() / sectorsPerPixel();
|
||||
return static_cast<int>(partition().length() / sectorsPerPixel());
|
||||
}
|
||||
|
||||
void PartResizerWidget::updatePositions()
|
||||
|
@ -287,13 +289,13 @@ void PartResizerWidget::mouseMoveEvent(QMouseEvent* event)
|
|||
int x = event->pos().x() - m_Hotspot;
|
||||
|
||||
if (draggedWidget() == &leftHandle()) {
|
||||
const qint64 newFirstSector = qMax(minimumFirstSector() + x * sectorsPerPixel(), 0.0L);
|
||||
const qint64 newFirstSector = static_cast<qint64>(std::max(minimumFirstSector() + x * sectorsPerPixel(), 0.0L));
|
||||
updateFirstSector(newFirstSector);
|
||||
} else if (draggedWidget() == &rightHandle()) {
|
||||
const qint64 newLastSector = qMin(static_cast<qint64>(minimumFirstSector() + (x - rightHandle().width()) * sectorsPerPixel()), maximumLastSector());
|
||||
const qint64 newLastSector = static_cast<qint64>(std::min(static_cast<qint64>(minimumFirstSector() + (x - rightHandle().width()) * sectorsPerPixel()), maximumLastSector()));
|
||||
updateLastSector(newLastSector);
|
||||
} else if (draggedWidget() == &partWidget() && moveAllowed()) {
|
||||
const qint64 newFirstSector = qMax(minimumFirstSector() + (x - handleWidth()) * sectorsPerPixel(), 0.0L);
|
||||
const qint64 newFirstSector = static_cast<qint64>(std::max(minimumFirstSector() + (x - handleWidth()) * sectorsPerPixel(), 0.0L));
|
||||
movePartition(newFirstSector);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ void PartWidget::paintEvent(QPaintEvent*)
|
|||
if (partition() == nullptr)
|
||||
return;
|
||||
|
||||
const int usedPercentage = partition()->used() * 100 / partition()->capacity();
|
||||
const int usedPercentage = static_cast<int>(partition()->used() * 100 / partition()->capacity());
|
||||
const int w = width() * usedPercentage / 100;
|
||||
|
||||
QPainter painter(this);
|
||||
|
|
|
@ -83,7 +83,7 @@ bool levelChildrenWidths(QList<qint32>& childrenWidth, const QList<qint32>& minC
|
|||
// if we have adjusted one or more partitions (and not ALL of them, because in that
|
||||
// case, nothing will help us), go through the partitions again and reduce the
|
||||
// on screen widths of those big enough anyway
|
||||
const qint32 reduce = ceil(1.0 * adjust / numReducable);
|
||||
const qint32 reduce = static_cast<qint32>(std::ceil(1.0 * adjust / numReducable));
|
||||
for (qint32 i = 0; i < childrenWidth.size(); i++)
|
||||
if (childrenWidth[i] > minChildrenWidth[i])
|
||||
childrenWidth[i] -= reduce;
|
||||
|
@ -115,7 +115,7 @@ void PartWidgetBase::positionChildren(const QWidget* destWidget, const Partition
|
|||
|
||||
// calculate unleveled width for each child and store it
|
||||
for (const auto &p : partitions) {
|
||||
childrenWidth.append(p->length() * destWidgetWidth / totalLength);
|
||||
childrenWidth.append(static_cast<qint32>(p->length() * destWidgetWidth / totalLength));
|
||||
|
||||
// Calculate the minimum width for the widget. This is easy for primary and logical partitions: they
|
||||
// just have a fixed min width (configured in m_MinWidth). But for extended partitions things
|
||||
|
|
|
@ -30,6 +30,9 @@ class Partition;
|
|||
class PartWidget;
|
||||
class QWidget;
|
||||
|
||||
bool distributeLostPixels(QList<qint32>& childrenWidth, qint32 lostPixels);
|
||||
bool levelChildrenWidths(QList<qint32>& childrenWidth, const QList<qint32>& minChildrenWidth, const qint32 destWidgetWidth);
|
||||
|
||||
/** Base class for all widgets that need to position Partitions.
|
||||
@author Volker Lanz <vl@fidra.de>
|
||||
*/
|
||||
|
|
|
@ -105,21 +105,21 @@ typedef struct _GPTDiskData GPTDiskData;
|
|||
@param d the Device in question
|
||||
@return the first sector usable by a Partition
|
||||
*/
|
||||
static quint64 firstUsableSector(const Device& d)
|
||||
static qint64 firstUsableSector(const Device& d)
|
||||
{
|
||||
PedDevice* pedDevice = ped_device_get(d.deviceNode().toLatin1().constData());
|
||||
PedDisk* pedDisk = pedDevice ? ped_disk_new(pedDevice) : nullptr;
|
||||
|
||||
quint64 rval = 0;
|
||||
qint64 rval = 0;
|
||||
if (pedDisk)
|
||||
rval = pedDisk->dev->bios_geom.sectors;
|
||||
rval = static_cast<qint64>(pedDisk->dev->bios_geom.sectors);
|
||||
|
||||
if (pedDisk && strcmp(pedDisk->type->name, "gpt") == 0) {
|
||||
GPTDiskData* gpt_disk_data = reinterpret_cast<GPTDiskData*>(pedDisk->disk_specific);
|
||||
PedGeometry* geom = reinterpret_cast<PedGeometry*>(&gpt_disk_data->data_area);
|
||||
|
||||
if (geom)
|
||||
rval = geom->start;
|
||||
rval = static_cast<qint64>(geom->start);
|
||||
else
|
||||
rval += 32;
|
||||
}
|
||||
|
@ -133,16 +133,16 @@ static quint64 firstUsableSector(const Device& d)
|
|||
@param d the Device in question
|
||||
@return the last sector usable by a Partition
|
||||
*/
|
||||
static quint64 lastUsableSector(const Device& d)
|
||||
static qint64 lastUsableSector(const Device& d)
|
||||
{
|
||||
PedDevice* pedDevice = ped_device_get(d.deviceNode().toLatin1().constData());
|
||||
PedDisk* pedDisk = pedDevice ? ped_disk_new(pedDevice) : nullptr;
|
||||
|
||||
quint64 rval = 0;
|
||||
qint64 rval = 0;
|
||||
if (pedDisk)
|
||||
rval = static_cast< quint64 >( pedDisk->dev->bios_geom.sectors ) *
|
||||
pedDisk->dev->bios_geom.heads *
|
||||
pedDisk->dev->bios_geom.cylinders - 1;
|
||||
rval = static_cast< qint64 >( pedDisk->dev->bios_geom.sectors ) *
|
||||
static_cast< qint64 >( pedDisk->dev->bios_geom.heads ) *
|
||||
static_cast< qint64 >( pedDisk->dev->bios_geom.cylinders - 1 );
|
||||
|
||||
if (pedDisk && strcmp(pedDisk->type->name, "gpt") == 0) {
|
||||
GPTDiskData* gpt_disk_data = reinterpret_cast<GPTDiskData*>(pedDisk->disk_specific);
|
||||
|
@ -446,8 +446,8 @@ QList<Device*> LibPartedBackend::scanDevices(bool excludeReadOnly)
|
|||
deviceNodes << deviceNode;
|
||||
}
|
||||
|
||||
quint32 totalDevices = deviceNodes.length();
|
||||
for (quint32 i = 0; i < totalDevices; ++i) {
|
||||
int totalDevices = deviceNodes.length();
|
||||
for (int i = 0; i < totalDevices; ++i) {
|
||||
const QString deviceNode = deviceNodes[i];
|
||||
|
||||
emitScanProgress(deviceNode, i * 100 / totalDevices);
|
||||
|
|
Loading…
Reference in New Issue