autoformat all sources

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

View File

@ -13,13 +13,11 @@
class Delete
{
protected:
public:
static void deleteDrive(Drive *drive);
private:
Delete(void);
};
#endif // DELETE_H_

View File

@ -14,7 +14,9 @@ class Drive
{
public:
enum TaskState {NONE,
enum TaskState
{
NONE,
SHRED_SELECTED,
SHRED_ACTIVE, // shred iterations active
CHECK_ACTIVE, // optional checking active
@ -60,7 +62,6 @@ private:
void setTimestamp();
protected:
public:
Drive(string path)
{
@ -101,7 +102,6 @@ public:
void calculateTaskDuration();
time_t getTaskDuration();
};
#endif // DRIVE_H_

View File

@ -68,7 +68,6 @@ private:
~Logger();
public:
void info(string s);
void warning(string s);
void error(string s);

View File

@ -39,11 +39,9 @@ typedef struct
t_driveData driveData;
} t_msgQueueData;
class Printer
{
protected:
public:
static Printer *getPrinter();
void print(Drive *drive);
@ -54,7 +52,5 @@ private:
int msqid;
Printer();
~Printer();
};
#endif // PRINTER_H_

View File

@ -69,7 +69,8 @@ using namespace std;
extern Logger *logging;
template <typename T, typename I> T* iterator_to_pointer(I i)
template <typename T, typename I>
T *iterator_to_pointer(I i)
{
return (&(*i));
}
@ -77,13 +78,11 @@ template <typename T, typename I> T* iterator_to_pointer(I i)
class reHDD
{
protected:
public:
reHDD(void);
static void app_logic();
private:
static void searchDrives(list<Drive> *plistDrives);
static void printDrives(list<Drive> *plistDrives);
static void startShredAllDrives(list<Drive> *plistDrives);

View File

@ -17,7 +17,6 @@
#include <unistd.h>
#include <string.h>
#define CHUNK_SIZE 1024 * 1024 * 32 // amount of bytes that are overwritten at once --> 32MB
#define TFNG_DATA_SIZE CHUNK_SIZE // amount of bytes used by tfng
@ -31,9 +30,7 @@ typedef int fileDescriptor;
class Shred
{
protected:
public:
Shred();
~Shred();
int shredDrive(Drive *drive, int *ipSignalFd);
@ -53,7 +50,6 @@ private:
unsigned long getDriveSizeInBytes(fileDescriptor file);
unsigned int uiCalcChecksum(fileDescriptor file, Drive *drive, int *ipSignalFd);
void cleanup();
};
#endif // SHRED_H_

View File

@ -13,7 +13,6 @@
class SMART
{
protected:
public:
static void readSMARTData(Drive *drive);

View File

@ -20,10 +20,19 @@
class TUI
{
protected:
public:
enum UserInput { UpKey, DownKey, Abort, Shred, ShredAll, Delete, Enter, ESC, Undefined};
enum UserInput
{
UpKey,
DownKey,
Abort,
Shred,
ShredAll,
Delete,
Enter,
ESC,
Undefined
};
struct MenuState
{
bool bAbort;

View File

@ -98,7 +98,8 @@ string Drive::sPowerCyclesToText()
string Drive::sTemperatureToText()
{
return to_string(getTemperature())+" C";;
return to_string(getTemperature()) + " C";
;
}
void Drive::setTaskPercentage(double d32TaskPercentage)
@ -114,7 +115,6 @@ double Drive::getTaskPercentage(void)
return this->d32TaskPercentage;
}
/**
* \brief set S.M.A.R.T. values in model
* \param string modelFamily

View File

@ -5,7 +5,6 @@
* @date 04.09.2020
*/
#include "../../include/reHDD.h" //for logger settings
#include "../../include/logger/logger.h"
@ -153,7 +152,6 @@ string Logger::getMacAddress()
if (ioctl(s, SIOCGIFHWADDR, &ifr) < 0)
{
strcpy(ifr.ifr_name, "eno1");
}
unsigned char *hwaddr = (unsigned char *)ifr.ifr_hwaddr.sa_data;
@ -229,5 +227,3 @@ Logger* Logger::logThis()
return single; // return existing obj
}
}

View File

@ -58,12 +58,13 @@ void Printer::print(Drive* drive)
if (-1 == msgsnd(this->msqid, &msgQueueData, sizeof(t_msgQueueData) - sizeof(long), 0))
{
Logger::logThis()->error("Printer: Send mgs queue failed!");
}else{
}
else
{
Logger::logThis()->info("Printer: print triggered - Drive: " + drive->getSerial());
}
}
/**
* \brief return a instance of the printer
* \return printer obj

View File

@ -8,7 +8,8 @@
#include "../include/reHDD.h"
#ifdef __cplusplus
extern "C" {
extern "C"
{
#endif
#include "../tfnoisegen/tfprng.h"
#ifdef __cplusplus
@ -89,7 +90,8 @@ int Shred::shredDrive(Drive* drive, int* ipSignalFd)
tfng_prng_seedkey(ucKey);
this->ulDriveByteSize = getDriveSizeInBytes(driveFileDiscr);
drive->sShredSpeed.chronoShredTimestamp = std::chrono::system_clock::now();; //set inital timestamp for speed metric
drive->sShredSpeed.chronoShredTimestamp = std::chrono::system_clock::now();
; // set inital timestamp for speed metric
drive->sShredSpeed.ulSpeedMetricBytesWritten = 0U; // uses to calculate speed metric
#ifdef LOG_LEVEL_HIGH

View File

@ -11,7 +11,6 @@ static std::mutex mxUIrefresh;
TUI::TUI(void)
{
}
/**