[FL-2655, FL-2650] Buffered file streams (#1424)

* Initial buffered file stream implementation
* Fix logical errors
* Fix more logical errors
* Minimally working implementation
* Adapt infrared unit tests for buffered streams
* Increase read buffer size from 512 to 1K
* Correct naming and formatting
* More code improvements
* Allow passing access and open modes for buffered streams
* Implement tests for buffered streams
* Better file and method names
* Add comments and correct formatting
* Use buffered streams in Infrared
* Fix compilation error
This commit is contained in:
Georgii Surkov
2022-07-22 19:00:25 +03:00
committed by GitHub
parent ec57dd310a
commit 16e598b2c0
10 changed files with 501 additions and 11 deletions

View File

@@ -51,9 +51,9 @@ bool infrared_brute_force_calculate_messages(InfraredBruteForce* brute_force) {
bool success = false;
Storage* storage = furi_record_open("storage");
FlipperFormat* ff = flipper_format_file_alloc(storage);
FlipperFormat* ff = flipper_format_buffered_file_alloc(storage);
success = flipper_format_file_open_existing(ff, brute_force->db_filename);
success = flipper_format_buffered_file_open_existing(ff, brute_force->db_filename);
if(success) {
string_t signal_name;
string_init(signal_name);
@@ -95,8 +95,9 @@ bool infrared_brute_force_start(
if(*record_count) {
Storage* storage = furi_record_open("storage");
brute_force->ff = flipper_format_file_alloc(storage);
success = flipper_format_file_open_existing(brute_force->ff, brute_force->db_filename);
brute_force->ff = flipper_format_buffered_file_alloc(storage);
success =
flipper_format_buffered_file_open_existing(brute_force->ff, brute_force->db_filename);
if(!success) {
flipper_format_free(brute_force->ff);
brute_force->ff = NULL;