[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:
@@ -115,6 +115,12 @@ FlipperFormat* flipper_format_string_alloc();
|
||||
*/
|
||||
FlipperFormat* flipper_format_file_alloc(Storage* storage);
|
||||
|
||||
/**
|
||||
* Allocate FlipperFormat as file, buffered read-only mode.
|
||||
* @return FlipperFormat* pointer to a FlipperFormat instance
|
||||
*/
|
||||
FlipperFormat* flipper_format_buffered_file_alloc(Storage* storage);
|
||||
|
||||
/**
|
||||
* Open existing file.
|
||||
* Use only if FlipperFormat allocated as a file.
|
||||
@@ -124,6 +130,15 @@ FlipperFormat* flipper_format_file_alloc(Storage* storage);
|
||||
*/
|
||||
bool flipper_format_file_open_existing(FlipperFormat* flipper_format, const char* path);
|
||||
|
||||
/**
|
||||
* Open existing file, read-only with buffered read operations.
|
||||
* Use only if FlipperFormat allocated as a file.
|
||||
* @param flipper_format Pointer to a FlipperFormat instance
|
||||
* @param path File path
|
||||
* @return True on success
|
||||
*/
|
||||
bool flipper_format_buffered_file_open_existing(FlipperFormat* flipper_format, const char* path);
|
||||
|
||||
/**
|
||||
* Open existing file for writing and add values to the end of file.
|
||||
* Use only if FlipperFormat allocated as a file.
|
||||
@@ -159,6 +174,14 @@ bool flipper_format_file_open_new(FlipperFormat* flipper_format, const char* pat
|
||||
*/
|
||||
bool flipper_format_file_close(FlipperFormat* flipper_format);
|
||||
|
||||
/**
|
||||
* Closes the file, use only if FlipperFormat allocated as a buffered file.
|
||||
* @param flipper_format
|
||||
* @return true
|
||||
* @return false
|
||||
*/
|
||||
bool flipper_format_buffered_file_close(FlipperFormat* flipper_format);
|
||||
|
||||
/**
|
||||
* Free FlipperFormat.
|
||||
* @param flipper_format Pointer to a FlipperFormat instance
|
||||
|
Reference in New Issue
Block a user