|
|
@ -24,10 +24,10 @@ typedef enum Corruption { |
|
|
|
} Corruption; |
|
|
|
} Corruption; |
|
|
|
|
|
|
|
|
|
|
|
// Possible funcion errors
|
|
|
|
// Possible funcion errors
|
|
|
|
typedef enum CorruptError { |
|
|
|
typedef enum CorruptResult { |
|
|
|
SUCCESS, |
|
|
|
SUCCESS, |
|
|
|
ERR_NULLPTR, |
|
|
|
ERR_NULLPTR, |
|
|
|
} CorruptError; |
|
|
|
} CorruptResult; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Corrupts byte via bit manipulation
|
|
|
|
// Corrupts byte via bit manipulation
|
|
|
@ -42,7 +42,7 @@ int corrupt_char(int byte) { |
|
|
|
Corrupts the file with specified corruption method. Returns 0 if
|
|
|
|
Corrupts the file with specified corruption method. Returns 0 if
|
|
|
|
successful, 1 - if FILE is NULL. |
|
|
|
successful, 1 - if FILE is NULL. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
CorruptError corrupt(FILE* file, Corruption corruption) { |
|
|
|
CorruptResult corrupt(FILE* file, Corruption corruption) { |
|
|
|
if (!file) { |
|
|
|
if (!file) { |
|
|
|
return ERR_NULLPTR; |
|
|
|
return ERR_NULLPTR; |
|
|
|
} else if (feof(file)) { |
|
|
|
} else if (feof(file)) { |
|
|
@ -80,7 +80,7 @@ int main(int argc, char** argv) { |
|
|
|
unsigned int file_path_index = 0; |
|
|
|
unsigned int file_path_index = 0; |
|
|
|
FILE* file = NULL; |
|
|
|
FILE* file = NULL; |
|
|
|
Corruption corruption_method = CORRUPTION_BITMAGIC; |
|
|
|
Corruption corruption_method = CORRUPTION_BITMAGIC; |
|
|
|
CorruptError result; |
|
|
|
CorruptResult result; |
|
|
|
|
|
|
|
|
|
|
|
unsigned int i = 1; |
|
|
|
unsigned int i = 1; |
|
|
|
while (i < argc) { |
|
|
|
while (i < argc) { |
|
|
|