M*LIB: non-inlined strings, FuriString primitive (#1795)

* Quicksave 1
* Header stage complete
* Source stage complete
* Lint & merge fixes
* Includes
* Documentation step 1
* FBT: output free size considering BT STACK
* Documentation step 2
* py lint
* Fix music player plugin
* unit test stage 1: string allocator, mem, getters, setters, appends, compare, search.
* unit test: string equality
* unit test: string replace
* unit test: string start_with, end_with
* unit test: string trim
* unit test: utf-8
* Rename
* Revert fw_size changes
* Simplify CLI backspace handling
* Simplify CLI character insert
* Merge fixes
* Furi: correct filenaming and spelling
* Bt: remove furi string include

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Sergey Gavrilov
2022-10-06 01:15:23 +10:00
committed by GitHub
parent 0f9ea925d3
commit 4bf29827f8
370 changed files with 5597 additions and 3963 deletions

View File

@@ -18,10 +18,10 @@ struct SubGhzReadRAW {
};
typedef struct {
string_t frequency_str;
string_t preset_str;
string_t sample_write;
string_t file_name;
FuriString* frequency_str;
FuriString* preset_str;
FuriString* sample_write;
FuriString* file_name;
uint8_t* rssi_history;
bool rssi_history_end;
uint8_t ind_write;
@@ -46,8 +46,8 @@ void subghz_read_raw_add_data_statusbar(
furi_assert(instance);
with_view_model(
instance->view, (SubGhzReadRAWModel * model) {
string_set_str(model->frequency_str, frequency_str);
string_set_str(model->preset_str, preset_str);
furi_string_set(model->frequency_str, frequency_str);
furi_string_set(model->preset_str, preset_str);
return true;
});
}
@@ -78,7 +78,7 @@ void subghz_read_raw_update_sample_write(SubGhzReadRAW* instance, size_t sample)
with_view_model(
instance->view, (SubGhzReadRAWModel * model) {
string_printf(model->sample_write, "%d spl.", sample);
furi_string_printf(model->sample_write, "%d spl.", sample);
return false;
});
}
@@ -216,10 +216,10 @@ void subghz_read_raw_draw(Canvas* canvas, SubGhzReadRAWModel* model) {
uint8_t graphics_mode = 1;
canvas_set_color(canvas, ColorBlack);
canvas_set_font(canvas, FontSecondary);
canvas_draw_str(canvas, 5, 7, string_get_cstr(model->frequency_str));
canvas_draw_str(canvas, 40, 7, string_get_cstr(model->preset_str));
canvas_draw_str(canvas, 5, 7, furi_string_get_cstr(model->frequency_str));
canvas_draw_str(canvas, 40, 7, furi_string_get_cstr(model->preset_str));
canvas_draw_str_aligned(
canvas, 126, 0, AlignRight, AlignTop, string_get_cstr(model->sample_write));
canvas, 126, 0, AlignRight, AlignTop, furi_string_get_cstr(model->sample_write));
canvas_draw_line(canvas, 0, 14, 115, 14);
canvas_draw_line(canvas, 0, 48, 115, 48);
@@ -243,7 +243,7 @@ void subghz_read_raw_draw(Canvas* canvas, SubGhzReadRAWModel* model) {
30,
AlignCenter,
AlignCenter,
string_get_cstr(model->file_name),
furi_string_get_cstr(model->file_name),
true);
break;
@@ -372,8 +372,8 @@ bool subghz_read_raw_input(InputEvent* event, void* context) {
model->status = SubGhzReadRAWStatusStart;
model->rssi_history_end = false;
model->ind_write = 0;
string_set_str(model->sample_write, "0 spl.");
string_reset(model->file_name);
furi_string_set(model->sample_write, "0 spl.");
furi_string_reset(model->file_name);
instance->callback(SubGhzCustomEventViewReadRAWErase, instance->context);
}
return true;
@@ -423,8 +423,8 @@ void subghz_read_raw_set_status(
model->status = SubGhzReadRAWStatusStart;
model->rssi_history_end = false;
model->ind_write = 0;
string_reset(model->file_name);
string_set_str(model->sample_write, "0 spl.");
furi_string_reset(model->file_name);
furi_string_set(model->sample_write, "0 spl.");
return true;
});
break;
@@ -441,8 +441,8 @@ void subghz_read_raw_set_status(
model->status = SubGhzReadRAWStatusLoadKeyIDLE;
model->rssi_history_end = false;
model->ind_write = 0;
string_set_str(model->file_name, file_name);
string_set_str(model->sample_write, "RAW");
furi_string_set(model->file_name, file_name);
furi_string_set(model->sample_write, "RAW");
return true;
});
break;
@@ -451,10 +451,10 @@ void subghz_read_raw_set_status(
instance->view, (SubGhzReadRAWModel * model) {
model->status = SubGhzReadRAWStatusLoadKeyIDLE;
if(!model->ind_write) {
string_set_str(model->file_name, file_name);
string_set_str(model->sample_write, "RAW");
furi_string_set(model->file_name, file_name);
furi_string_set(model->sample_write, "RAW");
} else {
string_reset(model->file_name);
furi_string_reset(model->file_name);
}
return true;
});
@@ -501,10 +501,10 @@ SubGhzReadRAW* subghz_read_raw_alloc() {
with_view_model(
instance->view, (SubGhzReadRAWModel * model) {
string_init(model->frequency_str);
string_init(model->preset_str);
string_init(model->sample_write);
string_init(model->file_name);
model->frequency_str = furi_string_alloc();
model->preset_str = furi_string_alloc();
model->sample_write = furi_string_alloc();
model->file_name = furi_string_alloc();
model->rssi_history = malloc(SUBGHZ_READ_RAW_RSSI_HISTORY_SIZE * sizeof(uint8_t));
return true;
});
@@ -517,10 +517,10 @@ void subghz_read_raw_free(SubGhzReadRAW* instance) {
with_view_model(
instance->view, (SubGhzReadRAWModel * model) {
string_clear(model->frequency_str);
string_clear(model->preset_str);
string_clear(model->sample_write);
string_clear(model->file_name);
furi_string_free(model->frequency_str);
furi_string_free(model->preset_str);
furi_string_free(model->sample_write);
furi_string_free(model->file_name);
free(model->rssi_history);
return true;
});