fix pointer (again)

This commit is contained in:
2026-05-01 15:22:35 +02:00
parent 42a1567b32
commit e017aeca0b
+10 -9
View File
@@ -17,19 +17,19 @@ extern "C"
} }
#endif #endif
const static char* randomsrc = (char*)"/dev/urandom"; const static char *randomsrc = (char *)"/dev/urandom";
Shred::Shred() Shred::Shred()
{ {
#ifdef ADAPTIVE_CHUNK_SIZE #ifdef ADAPTIVE_CHUNK_SIZE
// Allocate aligned buffers for maximum chunk size // Allocate aligned buffers for maximum chunk size
if (posix_memalign((void**)&caTfngData, 4096, CHUNK_SIZE_MAX) != 0) if (posix_memalign((void **)&caTfngData, 4096, CHUNK_SIZE_MAX) != 0)
{ {
Logger::logThis()->error("Failed to allocate aligned buffer for tfng data"); Logger::logThis()->error("Failed to allocate aligned buffer for tfng data");
caTfngData = nullptr; caTfngData = nullptr;
} }
if (posix_memalign((void**)&caReadBuffer, 4096, CHUNK_SIZE_MAX) != 0) if (posix_memalign((void **)&caReadBuffer, 4096, CHUNK_SIZE_MAX) != 0)
{ {
Logger::logThis()->error("Failed to allocate aligned buffer for read buffer"); Logger::logThis()->error("Failed to allocate aligned buffer for read buffer");
caReadBuffer = nullptr; caReadBuffer = nullptr;
@@ -83,7 +83,7 @@ void Shred::startMeasurement()
* \param file descriptor for signaling * \param file descriptor for signaling
* \return 0 on success, -1 on error * \return 0 on success, -1 on error
*/ */
void Shred::evaluateThroughput(Drive* drive) void Shred::evaluateThroughput(Drive *drive)
{ {
auto measurementEndTime = std::chrono::high_resolution_clock::now(); auto measurementEndTime = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = measurementEndTime - measurementStartTime; std::chrono::duration<double> elapsed = measurementEndTime - measurementStartTime;
@@ -129,7 +129,7 @@ void Shred::evaluateThroughput(Drive* drive)
* \param pointer to Drive instance * \param pointer to Drive instance
* \return void * \return void
*/ */
void Shred::adjustChunkSize(Drive* drive) void Shred::adjustChunkSize(Drive *drive)
{ {
size_t oldChunkSize = currentChunkSize; size_t oldChunkSize = currentChunkSize;
@@ -190,10 +190,10 @@ size_t Shred::getCurrentChunkSize() const
* \param file descriptor for signaling * \param file descriptor for signaling
* \return 0 on success, -1 on error * \return 0 on success, -1 on error
*/ */
int Shred::shredDrive(Drive* drive, int* ipSignalFd) int Shred::shredDrive(Drive *drive, int *ipSignalFd)
{ {
ostringstream address; ostringstream address;
address << (void const*)&(*drive); address << (void const *)&(*drive);
Logger::logThis()->info("Shred-Task started - Drive: " + drive->getModelName() + "-" + drive->getSerial() + " @" + address.str()); Logger::logThis()->info("Shred-Task started - Drive: " + drive->getModelName() + "-" + drive->getSerial() + " @" + address.str());
// Mark as started but NOT shredded yet // Mark as started but NOT shredded yet
@@ -229,7 +229,8 @@ int Shred::shredDrive(Drive* drive, int* ipSignalFd)
#endif #endif
#ifndef DRYRUN #ifndef DRYRUN
const char* cpDrivePath = drive->getPath().c_str(); string sDrivePath = drive->getPath();
const char *cpDrivePath = sDrivePath.c_str();
unsigned char ucKey[TFNG_KEY_SIZE]; unsigned char ucKey[TFNG_KEY_SIZE];
#ifdef ADAPTIVE_CHUNK_SIZE #ifdef ADAPTIVE_CHUNK_SIZE
@@ -635,7 +636,7 @@ long Shred::getDriveSizeInBytes(fileDescriptor file)
* \param signal file descriptor * \param signal file descriptor
* \return checksum value (0 = all zeros) * \return checksum value (0 = all zeros)
*/ */
unsigned int Shred::uiCalcChecksum(fileDescriptor file, Drive* drive, int* ipSignalFd) unsigned int Shred::uiCalcChecksum(fileDescriptor file, Drive *drive, int *ipSignalFd)
{ {
unsigned int uiChecksum = 0; unsigned int uiChecksum = 0;
unsigned long ulDriveByteCounter = 0U; unsigned long ulDriveByteCounter = 0U;