mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-13 05:06:30 +04:00
[FL-1505] Add RAW format (#576)
* Add RAW format * F5 stubs for build to pass * Fix saving decoded signal error * Irda: set ISR before starting timer, remove explicit NVIC configuration Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
#include "file_reader/file_reader.hpp"
|
||||
#include <file_reader.h>
|
||||
|
||||
std::string FileReader::getline(File* file) {
|
||||
std::string str;
|
||||
size_t newline_index = 0;
|
||||
bool found_eol = false;
|
||||
bool max_length_exceeded = false;
|
||||
|
||||
while(1) {
|
||||
if(file_buf_cnt > 0) {
|
||||
@@ -20,7 +21,12 @@ std::string FileReader::getline(File* file) {
|
||||
furi_assert(0);
|
||||
}
|
||||
|
||||
str.append(file_buf, end_index);
|
||||
if (max_line_length && (str.size() + end_index > max_line_length))
|
||||
max_length_exceeded = true;
|
||||
|
||||
if (!max_length_exceeded)
|
||||
str.append(file_buf, end_index);
|
||||
|
||||
memmove(file_buf, &file_buf[end_index], file_buf_cnt - end_index);
|
||||
file_buf_cnt = file_buf_cnt - end_index;
|
||||
if(found_eol) break;
|
||||
@@ -33,6 +39,9 @@ std::string FileReader::getline(File* file) {
|
||||
}
|
||||
}
|
||||
|
||||
if (max_length_exceeded)
|
||||
str.clear();
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user