1
0
mirror of https://git.disroot.org/80486DX2-66/polonium.git synced 2024-12-26 15:10:40 +05:30

Merge branch 'main' into load_into_mem

This commit is contained in:
Intel A80486DX2-66 2024-11-18 00:31:54 +03:00
commit 6a4104b3d9
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B
3 changed files with 4 additions and 10 deletions

View File

@ -2,7 +2,7 @@
**Project status:** :warning: Work In Progress
**Polonium** is a deliberate file corrupter simulating Polonium radiation,
**Polonium** is a deliberate file corrupter simulating polonium radiation,
damaging files as if bits of file are exposed to it. It modifies file contents,
causing degradation or information loss by bit flipping. Written in ISO C99.

View File

@ -12,19 +12,13 @@ static bool get_chance(uint16_t desired_chance) {
if (desired_chance == UINT16_MAX)
return true;
uint16_t cdf[UINT16_MAX_PLUS_1];
memset(cdf, 0, sizeof(cdf));
for (uint16_t i = 0; i < UINT16_MAX; i++)
cdf[i] = (i <= desired_chance) ? i + 1 : cdf[i - 1];
uint16_t random_number = mt_next() & UINT16_MAX;
return random_number < cdf[desired_chance];
return random_number < desired_chance;
}
static bool is_line_ending(byte c) {
return (c == '\n' || c == '\r');
return c == '\n' || c == '\r';
}
Corrupter_Result* corrupt_file(Corrupter_Param* param) {

View File

@ -96,7 +96,7 @@ static char* correct_slashes(const char* path) {
static char* my_basename(const char* raw_path) {
char* path =
#ifdef SYSNT
#ifdef SYS_NT
correct_slashes
#else
strdup