autoformat all sources

This commit is contained in:
2024-04-24 22:31:09 +02:00
parent e4a73556d6
commit 70dda97ae2
16 changed files with 746 additions and 752 deletions

View File

@ -54,16 +54,16 @@ uint32_t Drive::getTemperature(void)
string Drive::sCapacityToText()
{
char acBuffer[16];
double dSize = (double) getCapacity();
double dSize = (double)getCapacity();
uint16_t u16UnitIndex = 0;
const char* units[] = {"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"};
while (dSize >= 1000) //using the marketing capacity
{
dSize /= 1000;
u16UnitIndex++;
}
const char *units[] = {"B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"};
while (dSize >= 1000) // using the marketing capacity
{
dSize /= 1000;
u16UnitIndex++;
}
sprintf(acBuffer, "%.*f %s", u16UnitIndex-3, dSize, units[u16UnitIndex]);
sprintf(acBuffer, "%.*f %s", u16UnitIndex - 3, dSize, units[u16UnitIndex]);
return acBuffer;
}
@ -80,8 +80,8 @@ string Drive::sPowerOnHoursToText()
stringstream streamDays;
stringstream streamYears;
dDays = (double) ((double)u32Hours/(double)24U);
dYears = (double) ((double)u32Hours/(double)8760U);
dDays = (double)((double)u32Hours / (double)24U);
dYears = (double)((double)u32Hours / (double)8760U);
streamDays << fixed << setprecision(0) << dDays;
streamYears << fixed << setprecision(1) << dYears;
@ -98,23 +98,23 @@ string Drive::sPowerCyclesToText()
string Drive::sTemperatureToText()
{
return to_string(getTemperature())+" C";;
return to_string(getTemperature()) + " C";
;
}
void Drive::setTaskPercentage(double d32TaskPercentage)
{
if(d32TaskPercentage <= 100)
{
this->d32TaskPercentage = d32TaskPercentage;
this->setTimestamp(); //set timestamp for this progress for detecting a frozen drive
}
if (d32TaskPercentage <= 100)
{
this->d32TaskPercentage = d32TaskPercentage;
this->setTimestamp(); // set timestamp for this progress for detecting a frozen drive
}
}
double Drive::getTaskPercentage(void)
{
return this->d32TaskPercentage;
}
/**
* \brief set S.M.A.R.T. values in model
* \param string modelFamily
@ -127,14 +127,14 @@ double Drive::getTaskPercentage(void)
* \param uint32_t temperature
* \return void
*/
void Drive::setDriveSMARTData( string modelFamily,
string modelName,
string serial,
uint64_t capacity,
uint32_t errorCount,
uint32_t powerOnHours,
uint32_t powerCycle,
uint32_t temperature)
void Drive::setDriveSMARTData(string modelFamily,
string modelName,
string serial,
uint64_t capacity,
uint32_t errorCount,
uint32_t powerOnHours,
uint32_t powerCycle,
uint32_t temperature)
{
this->sSmartData.sModelFamily = modelFamily;
this->sSmartData.sModelName = modelName;
@ -179,11 +179,11 @@ void Drive::checkFrozenDrive(void)
time_t u32localtime;
time(&u32localtime);
if((u32localtime - this->u32Timestamp) >= (FROZEN_TIMEOUT*60) && (this->u32Timestamp > 0) && (this->getTaskPercentage() < 100.0))
{
Logger::logThis()->warning("Drive Frozen: " + this->getModelName() + " " + this->getSerial());
this->bWasDeleted = false;
this->bWasShredded = false;
this->state = Drive::FROZEN;
}
if ((u32localtime - this->u32Timestamp) >= (FROZEN_TIMEOUT * 60) && (this->u32Timestamp > 0) && (this->getTaskPercentage() < 100.0))
{
Logger::logThis()->warning("Drive Frozen: " + this->getModelName() + " " + this->getSerial());
this->bWasDeleted = false;
this->bWasShredded = false;
this->state = Drive::FROZEN;
}
}