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:
@@ -118,36 +118,36 @@ bool plantain_4k_parser_parse(NfcDeviceData* dev_data) {
|
||||
card_number = (card_number << 8) | card_number_arr[i];
|
||||
}
|
||||
// Convert card number to string
|
||||
string_t card_number_str;
|
||||
string_init(card_number_str);
|
||||
FuriString* card_number_str;
|
||||
card_number_str = furi_string_alloc();
|
||||
// Should look like "361301047292848684"
|
||||
// %llu doesn't work for some reason in sprintf, so we use string_push_uint64 instead
|
||||
string_push_uint64(card_number, card_number_str);
|
||||
// Add suffix with luhn checksum (1 digit) to the card number string
|
||||
string_t card_number_suffix;
|
||||
string_init(card_number_suffix);
|
||||
FuriString* card_number_suffix;
|
||||
card_number_suffix = furi_string_alloc();
|
||||
|
||||
// The number to calculate the checksum on doesn't fit into uint64_t, idk
|
||||
//uint8_t luhn_checksum = plantain_calculate_luhn(card_number);
|
||||
|
||||
// // Convert luhn checksum to string
|
||||
// string_t luhn_checksum_str;
|
||||
// string_init(luhn_checksum_str);
|
||||
// FuriString* luhn_checksum_str;
|
||||
// luhn_checksum_str = furi_string_alloc();
|
||||
// string_push_uint64(luhn_checksum, luhn_checksum_str);
|
||||
|
||||
string_cat_printf(card_number_suffix, "-");
|
||||
furi_string_cat_printf(card_number_suffix, "-");
|
||||
// FURI_LOG_D("plant4k", "Card checksum: %d", luhn_checksum);
|
||||
string_cat_printf(card_number_str, string_get_cstr(card_number_suffix));
|
||||
furi_string_cat_printf(card_number_str, furi_string_get_cstr(card_number_suffix));
|
||||
// Free all not needed strings
|
||||
string_clear(card_number_suffix);
|
||||
// string_clear(luhn_checksum_str);
|
||||
furi_string_free(card_number_suffix);
|
||||
// furi_string_free(luhn_checksum_str);
|
||||
|
||||
string_printf(
|
||||
furi_string_printf(
|
||||
dev_data->parsed_data,
|
||||
"\e#Plantain\nN:%s\nBalance:%d\n",
|
||||
string_get_cstr(card_number_str),
|
||||
furi_string_get_cstr(card_number_str),
|
||||
balance);
|
||||
string_clear(card_number_str);
|
||||
furi_string_free(card_number_str);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user