Skip to content

Commit

Permalink
Merge pull request #45 from DarkFlippers/refactor
Browse files Browse the repository at this point in the history
fix: invalid calls
  • Loading branch information
derskythe authored Sep 11, 2023
2 parents 1cc7ea2 + 320ba13 commit c7bc793
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion scenes/subbrute_scene_load_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void subbrute_scene_load_file_on_enter(void* context) {
DialogsFileBrowserOptions browser_options;
dialog_file_browser_set_basic_options(&browser_options, SUBBRUTE_FILE_EXT, &I_sub1_10px);

SubBruteFileResult load_result = SubBruteFileResultUnknown;
SubBruteFileResult load_result;
// TODO: DELETE IT
#ifdef SUBBRUTE_FAST_TRACK
bool res = true;
Expand Down
2 changes: 1 addition & 1 deletion scenes/subbrute_scene_save_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ bool subbrute_scene_save_name_on_event(void* context, SceneManagerEvent event) {
FURI_LOG_D(TAG, "Saving: %s", instance->text_store);
#endif
bool success = false;
if(strcmp(instance->text_store, "")) {
if(strcmp(instance->text_store, "") != 0) {
furi_string_reset(instance->file_path);
furi_string_cat_printf(
instance->file_path,
Expand Down
1 change: 1 addition & 0 deletions scenes/subbrute_scene_setup_extra.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ static void subbrute_scene_setup_extra_init_var_list(SubBruteState* instance, bo
}
} else {
item = variable_item_list_add(var_list, "Show Extra", 0, NULL, NULL);
variable_item_set_current_value_index(item, 0);
}

variable_item_list_set_enter_callback(var_list, setup_extra_enter_callback, instance);
Expand Down
4 changes: 2 additions & 2 deletions subbrute_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ uint8_t subbrute_device_load_from_file(SubBruteDevice* instance, const char* fil
#ifdef FURI_DEBUG
FURI_LOG_D(TAG, "subbrute_device_load_from_file: %s", file_path);
#endif
SubBruteFileResult result = SubBruteFileResultUnknown;
SubBruteFileResult result;

Storage* storage = furi_record_open(RECORD_STORAGE);
FlipperFormat* fff_data_file = flipper_format_file_alloc(storage);
Expand Down Expand Up @@ -335,7 +335,7 @@ uint8_t subbrute_device_load_from_file(SubBruteDevice* instance, const char* fil
break;
}
uint64_t data = 0;
for(uint8_t i = 0; i < sizeof(uint64_t); i++) {
for(size_t i = 0; i < sizeof(uint64_t); i++) {
data = (data << 8) | key_data[i];
}
#if FURI_DEBUG
Expand Down
12 changes: 6 additions & 6 deletions subbrute_protocols.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,7 @@ SubBruteFileProtocol subbrute_protocol_file_protocol_name(FuriString* name) {
void subbrute_protocol_create_candidate_for_existing_file(
FuriString* candidate,
uint64_t step,
uint8_t bit_index,
size_t bit_index,
uint64_t file_key,
bool two_bytes) {
uint8_t p[8];
Expand All @@ -583,7 +583,7 @@ void subbrute_protocol_create_candidate_for_existing_file(
uint8_t high_byte = (step >> 8) & 0xff;

size_t size = sizeof(uint64_t);
for(uint8_t i = 0; i < size; i++) {
for(size_t i = 0; i < size; i++) {
if(i == bit_index - 1 && two_bytes) {
furi_string_cat_printf(candidate, "%02X %02X", high_byte, low_byte);
i++;
Expand Down Expand Up @@ -618,7 +618,7 @@ void subbrute_protocol_create_candidate_for_default(
uint64_t total = 0;
for(size_t j = 0; j < 8; j++) {
total |= lut[step % 3] << (2 * j);
double sub_step = step / 3;
double sub_step = (double)step / 3;
step = (uint64_t)floor(sub_step);
}
total <<= 9;
Expand All @@ -635,7 +635,7 @@ void subbrute_protocol_create_candidate_for_default(
uint64_t total = 0;
for(size_t j = 0; j < 8; j++) {
total |= lut[step % 3] << (2 * j);
double sub_step = step / 3;
double sub_step = (double)step / 3;
step = (uint64_t)floor(sub_step);
}
total <<= 9;
Expand All @@ -654,7 +654,7 @@ void subbrute_protocol_create_candidate_for_default(
uint64_t total = 0;
for(size_t j = 0; j < 8; j++) {
total |= lut[step % 3] << (2 * j);
double sub_step = step / 3;
double sub_step = (double)step / 3;
step = (uint64_t)floor(sub_step);
}
total <<= 8;
Expand All @@ -670,7 +670,7 @@ void subbrute_protocol_create_candidate_for_default(
}

size_t size = sizeof(uint64_t);
for(uint8_t i = 0; i < size; i++) {
for(size_t i = 0; i < size; i++) {
if(p[i] != 0) {
furi_string_cat_printf(candidate, "%02X", p[i]);
} else {
Expand Down
2 changes: 1 addition & 1 deletion views/subbrute_attack_view.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ void subbrute_attack_view_draw(Canvas* canvas, void* context) {
canvas, x - icon_width_with_offset, y - icon_v_offset, model->icon);
// Progress bar
// Resolution: 128x64 px
float progress_value = (float)model->current_step / model->max_value;
float progress_value = (float)model->current_step / (float)model->max_value;
elements_progress_bar(canvas, 8, 37, 110, progress_value > 1 ? 1 : progress_value);

snprintf(
Expand Down

0 comments on commit c7bc793

Please sign in to comment.