mirror of
https://git.disroot.org/80486DX2-66/polonium.git
synced 2024-12-27 23:50:29 +05:30
Merge branch 'main' into load_into_mem
This commit is contained in:
commit
f2ac60ecb5
@ -17,6 +17,9 @@
|
|||||||
#include "file_boundaries.h"
|
#include "file_boundaries.h"
|
||||||
#include "file_type.h"
|
#include "file_type.h"
|
||||||
|
|
||||||
|
/* typedefs */
|
||||||
|
typedef unsigned char byte;
|
||||||
|
|
||||||
/* structures */
|
/* structures */
|
||||||
struct _corrupter_result {
|
struct _corrupter_result {
|
||||||
bool error;
|
bool error;
|
||||||
@ -28,7 +31,7 @@ struct _corrupter_result {
|
|||||||
struct _corrupter_param {
|
struct _corrupter_param {
|
||||||
FILE* file;
|
FILE* file;
|
||||||
uint16_t probability;
|
uint16_t probability;
|
||||||
uint8_t threshold;
|
byte threshold;
|
||||||
size_t passes;
|
size_t passes;
|
||||||
uint8_t config;
|
uint8_t config;
|
||||||
uint32_t* seed;
|
uint32_t* seed;
|
||||||
@ -38,7 +41,6 @@ struct _corrupter_param {
|
|||||||
/* typedefs */
|
/* typedefs */
|
||||||
typedef struct _corrupter_param Corrupter_Param;
|
typedef struct _corrupter_param Corrupter_Param;
|
||||||
typedef struct _corrupter_result Corrupter_Result;
|
typedef struct _corrupter_result Corrupter_Result;
|
||||||
typedef unsigned char byte;
|
|
||||||
|
|
||||||
/* macros: procedures */
|
/* macros: procedures */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
@ -118,7 +118,7 @@ Corrupter_Result* corrupt_file(Corrupter_Param* param) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// generate bit mask
|
// generate bit mask
|
||||||
unsigned char damage_left = (unsigned char) param->threshold;
|
byte damage_left = param->threshold;
|
||||||
static bool bit_mask[CHAR_BIT];
|
static bool bit_mask[CHAR_BIT];
|
||||||
|
|
||||||
for (unsigned char bit = 0; bit < CHAR_BIT; bit++) {
|
for (unsigned char bit = 0; bit < CHAR_BIT; bit++) {
|
||||||
@ -132,7 +132,7 @@ Corrupter_Result* corrupt_file(Corrupter_Param* param) {
|
|||||||
|
|
||||||
bool damaged_byte = false;
|
bool damaged_byte = false;
|
||||||
|
|
||||||
for (unsigned char bit = 0; bit < threshold; bit++) {
|
for (byte bit = 0; bit < threshold; bit++) {
|
||||||
if (bit_mask[bit] == false)
|
if (bit_mask[bit] == false)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user