mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-11-22 17:33:13 +03:00
Lib: update m-lib to latest release. Update m-lib usage across project. (#818)
This commit is contained in:
parent
b2356c7318
commit
2e46ec36a7
@ -104,7 +104,7 @@ void archive_file_array_swap(ArchiveBrowserView* browser, int8_t d) {
|
||||
void archive_file_array_rm_all(ArchiveBrowserView* browser) {
|
||||
with_view_model(
|
||||
browser->view, (ArchiveBrowserViewModel * model) {
|
||||
files_array_clean(model->files);
|
||||
files_array_reset(model->files);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ bool archive_favorites_read(void* context) {
|
||||
}
|
||||
|
||||
archive_add_item(browser, &file_info, string_get_cstr(buffer));
|
||||
string_clean(buffer);
|
||||
string_reset(buffer);
|
||||
}
|
||||
}
|
||||
string_clear(buffer);
|
||||
|
@ -226,7 +226,7 @@ static void badusb_worker(void* context) {
|
||||
ret = 0;
|
||||
break;
|
||||
}
|
||||
string_clean(line);
|
||||
string_reset(line);
|
||||
} else {
|
||||
string_push_back(line, buffer[i]);
|
||||
}
|
||||
@ -239,7 +239,7 @@ static void badusb_worker(void* context) {
|
||||
evt.worker.state = WorkerStateNoFile;
|
||||
osMessageQueuePut(app->event_queue, &evt, 0, osWaitForever);
|
||||
}
|
||||
string_clean(line);
|
||||
string_reset(line);
|
||||
string_clear(line);
|
||||
|
||||
furi_hal_hid_kb_release_all();
|
||||
|
@ -246,7 +246,7 @@ void button_menu_clean(ButtonMenu* button_menu) {
|
||||
|
||||
with_view_model(
|
||||
button_menu->view, (ButtonMenuModel * model) {
|
||||
ButtonMenuItemArray_clean(model->items);
|
||||
ButtonMenuItemArray_reset(model->items);
|
||||
model->position = 0;
|
||||
return true;
|
||||
});
|
||||
|
@ -139,8 +139,8 @@ void button_panel_clean(ButtonPanel* button_panel) {
|
||||
}
|
||||
model->reserve_x = 0;
|
||||
model->reserve_y = 0;
|
||||
LabelList_clean(model->labels);
|
||||
ButtonMatrix_clean(model->button_matrix);
|
||||
LabelList_reset(model->labels);
|
||||
ButtonMatrix_reset(model->button_matrix);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@ -150,8 +150,8 @@ static ButtonItem** button_panel_get_item(ButtonPanelModel* model, size_t x, siz
|
||||
|
||||
furi_check(x < model->reserve_x);
|
||||
furi_check(y < model->reserve_y);
|
||||
ButtonArray_t* button_array = ButtonMatrix_get_at(model->button_matrix, x);
|
||||
ButtonItem** button_item = ButtonArray_get_at(*button_array, y);
|
||||
ButtonArray_t* button_array = ButtonMatrix_safe_get(model->button_matrix, x);
|
||||
ButtonItem** button_item = ButtonArray_safe_get(*button_array, y);
|
||||
return button_item;
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ void menu_clean(Menu* menu) {
|
||||
furi_assert(menu);
|
||||
with_view_model(
|
||||
menu->view, (MenuModel * model) {
|
||||
MenuItemArray_clean(model->items);
|
||||
MenuItemArray_reset(model->items);
|
||||
model->position = 0;
|
||||
return true;
|
||||
});
|
||||
|
@ -174,7 +174,7 @@ void submenu_clean(Submenu* submenu) {
|
||||
|
||||
with_view_model(
|
||||
submenu->view, (SubmenuModel * model) {
|
||||
SubmenuItemArray_clean(model->items);
|
||||
SubmenuItemArray_reset(model->items);
|
||||
model->position = 0;
|
||||
model->window_position = 0;
|
||||
model->header = NULL;
|
||||
|
@ -295,7 +295,7 @@ void variable_item_list_clean(VariableItemList* variable_item_list) {
|
||||
VariableItemArray_next(it)) {
|
||||
string_clear(VariableItemArray_ref(it)->current_value_text);
|
||||
}
|
||||
VariableItemArray_clean(model->items);
|
||||
VariableItemArray_reset(model->items);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ void widget_clear(Widget* widget) {
|
||||
element->free(element);
|
||||
ElementArray_next(it);
|
||||
}
|
||||
ElementArray_clean(model->element);
|
||||
ElementArray_reset(model->element);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ LoaderStatus loader_start(Loader* instance, const char* name, const char* args)
|
||||
thread_args = (void*)string_get_cstr(instance->args);
|
||||
FURI_LOG_I(TAG, "Start %s app with args: %s", name, args);
|
||||
} else {
|
||||
string_clean(instance->args);
|
||||
string_reset(instance->args);
|
||||
FURI_LOG_I(TAG, "Start %s app with no args", name);
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ void nfc_scene_device_info_on_exit(void* context) {
|
||||
} else if(nfc->dev->format == NfcDeviceSaveFormatMifareUl) {
|
||||
// Clear TextBox
|
||||
text_box_clean(nfc->text_box);
|
||||
string_clean(nfc->text_box_store);
|
||||
string_reset(nfc->text_box_store);
|
||||
} else if(nfc->dev->format == NfcDeviceSaveFormatBankCard) {
|
||||
// Clear Bank Card
|
||||
bank_card_clear(nfc->bank_card);
|
||||
|
@ -126,5 +126,5 @@ void nfc_scene_read_mifare_ul_success_on_exit(void* context) {
|
||||
// Clean TextBox
|
||||
TextBox* text_box = nfc->text_box;
|
||||
text_box_clean(text_box);
|
||||
string_clean(nfc->text_box_store);
|
||||
string_reset(nfc->text_box_store);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ void rpc_print_data(const char* prefix, uint8_t* buffer, size_t size) {
|
||||
string_cat_printf(str, "}\r\n");
|
||||
|
||||
printf("%s", string_get_cstr(str));
|
||||
string_clean(str);
|
||||
string_reset(str);
|
||||
string_reserve(str, 100 + size * 3);
|
||||
|
||||
string_cat_printf(str, "%s HEX(%d): {", prefix, size);
|
||||
@ -367,7 +367,7 @@ static void rpc_free_session(RpcSession* session) {
|
||||
}
|
||||
free(session->system_contexts);
|
||||
osMutexDelete(session->callbacks_mutex);
|
||||
RpcHandlerDict_clean(session->rpc->handlers);
|
||||
RpcHandlerDict_reset(session->rpc->handlers);
|
||||
|
||||
session->context = NULL;
|
||||
session->closed_callback = NULL;
|
||||
|
@ -157,5 +157,5 @@ void storage_settings_scene_benchmark_on_exit(void* context) {
|
||||
dialog_ex_set_result_callback(dialog_ex, NULL);
|
||||
dialog_ex_set_context(dialog_ex, NULL);
|
||||
|
||||
string_clean(app->text_string);
|
||||
string_reset(app->text_string);
|
||||
}
|
||||
|
@ -64,5 +64,5 @@ void storage_settings_scene_internal_info_on_exit(void* context) {
|
||||
dialog_ex_set_result_callback(dialog_ex, NULL);
|
||||
dialog_ex_set_context(dialog_ex, NULL);
|
||||
|
||||
string_clean(app->text_string);
|
||||
string_reset(app->text_string);
|
||||
}
|
||||
|
@ -70,5 +70,5 @@ void storage_settings_scene_sd_info_on_exit(void* context) {
|
||||
dialog_ex_set_result_callback(dialog_ex, NULL);
|
||||
dialog_ex_set_context(dialog_ex, NULL);
|
||||
|
||||
string_clean(app->text_string);
|
||||
string_reset(app->text_string);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ void subghz_scene_add_to_history_callback(SubGhzProtocolCommon* parser, void* co
|
||||
if(subghz_history_add_to_history(
|
||||
subghz->txrx->history, parser, subghz->txrx->frequency, subghz->txrx->preset)) {
|
||||
subghz_parser_reset(subghz->txrx->parser);
|
||||
string_clean(str_buff);
|
||||
string_reset(str_buff);
|
||||
subghz_history_get_text_item_menu(
|
||||
subghz->txrx->history, str_buff, subghz_history_get_item(subghz->txrx->history) - 1);
|
||||
subghz_receiver_add_item_to_menu(
|
||||
@ -67,7 +67,7 @@ void subghz_scene_receiver_on_enter(void* context) {
|
||||
//Load history to receiver
|
||||
subghz_receiver_exit(subghz->subghz_receiver);
|
||||
for(uint8_t i = 0; i < subghz_history_get_item(subghz->txrx->history); i++) {
|
||||
string_clean(str_buff);
|
||||
string_reset(str_buff);
|
||||
subghz_history_get_text_item_menu(subghz->txrx->history, str_buff, i);
|
||||
subghz_receiver_add_item_to_menu(
|
||||
subghz->subghz_receiver,
|
||||
|
@ -44,5 +44,5 @@ void subghz_scene_show_error_on_exit(void* context) {
|
||||
popup_set_context(popup, NULL);
|
||||
popup_set_timeout(popup, 0);
|
||||
popup_disable_timeout(popup);
|
||||
string_clean(subghz->error_str);
|
||||
string_reset(subghz->error_str);
|
||||
}
|
||||
|
@ -223,9 +223,9 @@ void subghz_read_raw_exit(void* context) {
|
||||
instance->callback(SubghzCustomEventViewReadRAWIDLE, instance->context);
|
||||
model->satus = SubghzReadRAWStatusStart;
|
||||
}
|
||||
string_clean(model->frequency_str);
|
||||
string_clean(model->preset_str);
|
||||
string_clean(model->sample_write);
|
||||
string_reset(model->frequency_str);
|
||||
string_reset(model->preset_str);
|
||||
string_reset(model->sample_write);
|
||||
free(model->rssi_history);
|
||||
return true;
|
||||
});
|
||||
|
@ -168,7 +168,7 @@ void subghz_receiver_draw(Canvas* canvas, SubghzReceiverModel* model) {
|
||||
}
|
||||
canvas_draw_icon(canvas, 1, 2 + i * FRAME_HEIGHT, ReceiverItemIcons[item_menu->type]);
|
||||
canvas_draw_str(canvas, 15, 9 + i * FRAME_HEIGHT, string_get_cstr(str_buff));
|
||||
string_clean(str_buff);
|
||||
string_reset(str_buff);
|
||||
}
|
||||
if(scrollbar) {
|
||||
elements_scrollbar_pos(canvas, 128, 0, 49, model->idx, model->history_item);
|
||||
@ -226,15 +226,15 @@ void subghz_receiver_exit(void* context) {
|
||||
SubghzReceiver* subghz_receiver = context;
|
||||
with_view_model(
|
||||
subghz_receiver->view, (SubghzReceiverModel * model) {
|
||||
string_clean(model->frequency_str);
|
||||
string_clean(model->preset_str);
|
||||
string_clean(model->history_stat_str);
|
||||
string_reset(model->frequency_str);
|
||||
string_reset(model->preset_str);
|
||||
string_reset(model->history_stat_str);
|
||||
for
|
||||
M_EACH(item_menu, model->history->data, SubGhzReceiverMenuItemArray_t) {
|
||||
string_clear(item_menu->item_str);
|
||||
item_menu->type = 0;
|
||||
}
|
||||
SubGhzReceiverMenuItemArray_clean(model->history->data);
|
||||
SubGhzReceiverMenuItemArray_reset(model->history->data);
|
||||
model->idx = 0;
|
||||
model->list_offset = 0;
|
||||
model->history_item = 0;
|
||||
|
@ -93,9 +93,9 @@ bool subghz_transmitter_input(InputEvent* event, void* context) {
|
||||
if(event->key == InputKeyBack && event->type == InputTypeShort) {
|
||||
with_view_model(
|
||||
subghz_transmitter->view, (SubghzTransmitterModel * model) {
|
||||
string_clean(model->frequency_str);
|
||||
string_clean(model->preset_str);
|
||||
string_clean(model->key_str);
|
||||
string_reset(model->frequency_str);
|
||||
string_reset(model->preset_str);
|
||||
string_reset(model->key_str);
|
||||
model->show_button = 0;
|
||||
return false;
|
||||
});
|
||||
|
@ -114,7 +114,7 @@ bool file_worker_read(FileWorker* file_worker, void* buffer, uint16_t bytes_to_r
|
||||
}
|
||||
|
||||
bool file_worker_read_until(FileWorker* file_worker, string_t str_result, char separator) {
|
||||
string_clean(str_result);
|
||||
string_reset(str_result);
|
||||
const uint8_t buffer_size = 32;
|
||||
uint8_t buffer[buffer_size];
|
||||
|
||||
@ -328,7 +328,7 @@ bool file_worker_read_until_buffered(
|
||||
// fs_api->file.read now supports up to 512 bytes reading at a time
|
||||
furi_assert(file_buf_size <= 512);
|
||||
|
||||
string_clean(str_result);
|
||||
string_reset(str_result);
|
||||
size_t newline_index = 0;
|
||||
bool found_eol = false;
|
||||
bool max_length_exceeded = false;
|
||||
@ -367,7 +367,7 @@ bool file_worker_read_until_buffered(
|
||||
file_worker->file, &file_buf[*file_buf_cnt], file_buf_size - *file_buf_cnt);
|
||||
if(storage_file_get_error(file_worker->file) != FSE_OK) {
|
||||
file_worker_show_error_internal(file_worker, "Cannot read\nfile");
|
||||
string_clean(str_result);
|
||||
string_reset(str_result);
|
||||
*file_buf_cnt = 0;
|
||||
break;
|
||||
}
|
||||
@ -376,7 +376,7 @@ bool file_worker_read_until_buffered(
|
||||
}
|
||||
}
|
||||
|
||||
if(max_length_exceeded) string_clean(str_result);
|
||||
if(max_length_exceeded) string_reset(str_result);
|
||||
|
||||
return string_size(str_result) || *file_buf_cnt;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ bool file_helper_write_hex(File* file, const uint8_t* data, const uint16_t data_
|
||||
}
|
||||
|
||||
bool file_helper_read_line(File* file, string_t str_result) {
|
||||
string_clean(str_result);
|
||||
string_reset(str_result);
|
||||
const uint8_t buffer_size = 32;
|
||||
uint8_t buffer[buffer_size];
|
||||
|
||||
@ -109,7 +109,7 @@ bool file_helper_seek_to_next_line(File* file) {
|
||||
}
|
||||
|
||||
bool file_helper_read_value(File* file, string_t value, bool* last) {
|
||||
string_clean(value);
|
||||
string_reset(value);
|
||||
const uint8_t buffer_size = 32;
|
||||
uint8_t buffer[buffer_size];
|
||||
bool result = false;
|
||||
|
@ -12,7 +12,7 @@ const char* flipper_file_scratchpad = "/any/.scratch.pad";
|
||||
#endif
|
||||
|
||||
bool flipper_file_read_valid_key(File* file, string_t key) {
|
||||
string_clean(key);
|
||||
string_reset(key);
|
||||
bool found = false;
|
||||
bool error = false;
|
||||
const uint8_t buffer_size = 32;
|
||||
@ -27,7 +27,7 @@ bool flipper_file_read_valid_key(File* file, string_t key) {
|
||||
for(uint16_t i = 0; i < bytes_were_read; i++) {
|
||||
if(buffer[i] == flipper_file_eoln) {
|
||||
// EOL found, clean data, start accumulating data and set the new_line flag
|
||||
string_clean(key);
|
||||
string_reset(key);
|
||||
accumulate = true;
|
||||
new_line = true;
|
||||
} else if(buffer[i] == flipper_file_eolr) {
|
||||
@ -43,7 +43,7 @@ bool flipper_file_read_valid_key(File* file, string_t key) {
|
||||
// this can only be if we have previously found some kind of key, so
|
||||
// clear the data, set the flag that we no longer want to accumulate data
|
||||
// and reset the new_line flag
|
||||
string_clean(key);
|
||||
string_reset(key);
|
||||
accumulate = false;
|
||||
new_line = false;
|
||||
} else {
|
||||
|
2
lib/mlib
2
lib/mlib
@ -1 +1 @@
|
||||
Subproject commit 3c83e4088ccb6d5513c08a7c6475b3cbdba76796
|
||||
Subproject commit 62c8ac3e5d4a7a4f8757328e7a80286fde2686b6
|
Loading…
Reference in New Issue
Block a user