diff --git a/applications/archive/helpers/archive_browser.c b/applications/archive/helpers/archive_browser.c index 7e302c4e..d52475cc 100644 --- a/applications/archive/helpers/archive_browser.c +++ b/applications/archive/helpers/archive_browser.c @@ -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; }); } diff --git a/applications/archive/helpers/archive_favorites.c b/applications/archive/helpers/archive_favorites.c index c4608480..1e581502 100644 --- a/applications/archive/helpers/archive_favorites.c +++ b/applications/archive/helpers/archive_favorites.c @@ -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); diff --git a/applications/debug_tools/bad_usb.c b/applications/debug_tools/bad_usb.c index c5fc0f24..c86ffbac 100644 --- a/applications/debug_tools/bad_usb.c +++ b/applications/debug_tools/bad_usb.c @@ -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(); diff --git a/applications/gui/modules/button_menu.c b/applications/gui/modules/button_menu.c index 81958f0d..0dbb1366 100644 --- a/applications/gui/modules/button_menu.c +++ b/applications/gui/modules/button_menu.c @@ -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; }); diff --git a/applications/gui/modules/button_panel.c b/applications/gui/modules/button_panel.c index b4cffe05..65fbb90c 100644 --- a/applications/gui/modules/button_panel.c +++ b/applications/gui/modules/button_panel.c @@ -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; } diff --git a/applications/gui/modules/menu.c b/applications/gui/modules/menu.c index 6450b1d3..110ff0c1 100644 --- a/applications/gui/modules/menu.c +++ b/applications/gui/modules/menu.c @@ -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; }); diff --git a/applications/gui/modules/submenu.c b/applications/gui/modules/submenu.c index 105ebd6a..60a1b092 100644 --- a/applications/gui/modules/submenu.c +++ b/applications/gui/modules/submenu.c @@ -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; diff --git a/applications/gui/modules/variable-item-list.c b/applications/gui/modules/variable-item-list.c index 03f04cb6..39f646b6 100644 --- a/applications/gui/modules/variable-item-list.c +++ b/applications/gui/modules/variable-item-list.c @@ -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; }); } diff --git a/applications/gui/modules/widget.c b/applications/gui/modules/widget.c index 76779463..58ca7db2 100755 --- a/applications/gui/modules/widget.c +++ b/applications/gui/modules/widget.c @@ -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; }); } diff --git a/applications/loader/loader.c b/applications/loader/loader.c index 98ce42b1..fb5133df 100644 --- a/applications/loader/loader.c +++ b/applications/loader/loader.c @@ -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); } diff --git a/applications/nfc/scenes/nfc_scene_device_info.c b/applications/nfc/scenes/nfc_scene_device_info.c index d57327b7..1495c127 100755 --- a/applications/nfc/scenes/nfc_scene_device_info.c +++ b/applications/nfc/scenes/nfc_scene_device_info.c @@ -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); diff --git a/applications/nfc/scenes/nfc_scene_read_mifare_ul_success.c b/applications/nfc/scenes/nfc_scene_read_mifare_ul_success.c index b12b14a7..9c8dfc78 100755 --- a/applications/nfc/scenes/nfc_scene_read_mifare_ul_success.c +++ b/applications/nfc/scenes/nfc_scene_read_mifare_ul_success.c @@ -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); } diff --git a/applications/rpc/rpc.c b/applications/rpc/rpc.c index 123f1faa..450daaee 100644 --- a/applications/rpc/rpc.c +++ b/applications/rpc/rpc.c @@ -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; diff --git a/applications/storage-settings/scenes/storage-settings-benchmark.c b/applications/storage-settings/scenes/storage-settings-benchmark.c index bc83e707..454e3a39 100644 --- a/applications/storage-settings/scenes/storage-settings-benchmark.c +++ b/applications/storage-settings/scenes/storage-settings-benchmark.c @@ -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); } diff --git a/applications/storage-settings/scenes/storage-settings-scene-internal-info.c b/applications/storage-settings/scenes/storage-settings-scene-internal-info.c index 389cad0c..8a831610 100644 --- a/applications/storage-settings/scenes/storage-settings-scene-internal-info.c +++ b/applications/storage-settings/scenes/storage-settings-scene-internal-info.c @@ -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); } diff --git a/applications/storage-settings/scenes/storage-settings-scene-sd-info.c b/applications/storage-settings/scenes/storage-settings-scene-sd-info.c index 617b2281..c82d2f14 100644 --- a/applications/storage-settings/scenes/storage-settings-scene-sd-info.c +++ b/applications/storage-settings/scenes/storage-settings-scene-sd-info.c @@ -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); } diff --git a/applications/subghz/scenes/subghz_scene_receiver.c b/applications/subghz/scenes/subghz_scene_receiver.c index 4e8a953f..53b72c1a 100644 --- a/applications/subghz/scenes/subghz_scene_receiver.c +++ b/applications/subghz/scenes/subghz_scene_receiver.c @@ -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, diff --git a/applications/subghz/scenes/subghz_scene_show_error.c b/applications/subghz/scenes/subghz_scene_show_error.c index c02ad34a..d8f2e050 100644 --- a/applications/subghz/scenes/subghz_scene_show_error.c +++ b/applications/subghz/scenes/subghz_scene_show_error.c @@ -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); } diff --git a/applications/subghz/views/subghz_read_raw.c b/applications/subghz/views/subghz_read_raw.c index 7c24654b..fb9d694b 100644 --- a/applications/subghz/views/subghz_read_raw.c +++ b/applications/subghz/views/subghz_read_raw.c @@ -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; }); diff --git a/applications/subghz/views/subghz_receiver.c b/applications/subghz/views/subghz_receiver.c index f854e81d..b158d870 100644 --- a/applications/subghz/views/subghz_receiver.c +++ b/applications/subghz/views/subghz_receiver.c @@ -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; diff --git a/applications/subghz/views/subghz_transmitter.c b/applications/subghz/views/subghz_transmitter.c index b5adf3e9..b9421e4f 100644 --- a/applications/subghz/views/subghz_transmitter.c +++ b/applications/subghz/views/subghz_transmitter.c @@ -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; }); diff --git a/lib/app-scened-template/file-worker.c b/lib/app-scened-template/file-worker.c index 316e7507..a1a3bdf2 100644 --- a/lib/app-scened-template/file-worker.c +++ b/lib/app-scened-template/file-worker.c @@ -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; } diff --git a/lib/flipper_file/file_helper.c b/lib/flipper_file/file_helper.c index c0feb993..0eabf0d1 100644 --- a/lib/flipper_file/file_helper.c +++ b/lib/flipper_file/file_helper.c @@ -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; diff --git a/lib/flipper_file/flipper_file_helper.c b/lib/flipper_file/flipper_file_helper.c index 5b8bfb2d..76711109 100644 --- a/lib/flipper_file/flipper_file_helper.c +++ b/lib/flipper_file/flipper_file_helper.c @@ -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 { diff --git a/lib/mlib b/lib/mlib index 3c83e408..62c8ac3e 160000 --- a/lib/mlib +++ b/lib/mlib @@ -1 +1 @@ -Subproject commit 3c83e4088ccb6d5513c08a7c6475b3cbdba76796 +Subproject commit 62c8ac3e5d4a7a4f8757328e7a80286fde2686b6