3 Commits

Author SHA1 Message Date
localhorst 716ab5614f add comments 2026-05-01 15:28:02 +02:00
localhorst e017aeca0b fix pointer (again) 2026-05-01 15:22:35 +02:00
localhorst 42a1567b32 Fix error handling if shred failes (#96)
fixes #95

Reviewed-on: #96
Co-authored-by: localhorst <localhorst@mosad.xyz>
Co-committed-by: localhorst <localhorst@mosad.xyz>
2026-05-01 15:18:31 +02:00
3 changed files with 24 additions and 111 deletions
-92
View File
@@ -1,92 +0,0 @@
# reHDD Code Style - clang-format configuration
# Based on analyzed codebase formatting
BasedOnStyle: LLVM
# Indentation
IndentWidth: 4
TabWidth: 4
UseTab: Never
ContinuationIndentWidth: 4
# Braces
BreakBeforeBraces: Allman
# Allman style:
# if (condition)
# {
# statement;
# }
# Spacing
SpaceAfterCStyleCast: false
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
# Alignment
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: false
# Line breaks
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
# Column limit
ColumnLimit: 0
# 0 = no limit (observed in the code)
# Breaking
BinPackArguments: true
BinPackParameters: true
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: false
# Pointers and references
PointerAlignment: Left
# Type *variable (not Type* variable)
# Include sorting
SortIncludes: false
# Keep includes in original order
# Comments
ReflowComments: false
# Don't reformat comments
# Access modifiers
AccessModifierOffset: -4
# public: is outdented
# Constructor initializers
ConstructorInitializerIndentWidth: 6
# Observed 6 spaces for initializer lists
# Other
Cpp11BracedListStyle: true
FixNamespaceComments: true
IncludeBlocks: Preserve
IndentCaseLabels: false
IndentPPDirectives: None
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
PenaltyBreakBeforeFirstCallParameter: 100
PenaltyBreakComment: 300
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
+7 -2
View File
@@ -229,7 +229,8 @@ int Shred::shredDrive(Drive* drive, int* ipSignalFd)
#endif
#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];
#ifdef ADAPTIVE_CHUNK_SIZE
@@ -454,8 +455,10 @@ int Shred::shredDrive(Drive* drive, int* ipSignalFd)
if ((d32Percent - d32TmpPercent) >= 0.01)
{
// set shred percentage
drive->setTaskPercentage(d32TmpPercent);
d32TmpPercent = d32Percent;
// signal process in shredding
write(*ipSignalFd, "A", 1);
}
@@ -562,7 +565,7 @@ double Shred::calcProgress()
unsigned int uiMaxShredIteration = SHRED_ITERATIONS;
#ifdef ZERO_CHECK
uiMaxShredIteration++;
uiMaxShredIteration++; // increment because we will check after SHRED_ITERATIONS the drive for non-zero bytes
#endif
if (this->ulDriveByteSize == 0)
@@ -640,6 +643,8 @@ unsigned int Shred::uiCalcChecksum(fileDescriptor file, Drive* drive, int* ipSig
unsigned int uiChecksum = 0;
unsigned long ulDriveByteCounter = 0U;
Logger::logThis()->info("Check-Task: Starting checksum verification - Drive: " + drive->getSerial());
#ifdef ADAPTIVE_CHUNK_SIZE
size_t checkChunkSize = CHUNK_SIZE_MAX;
#else