Fix reading files from buffer

This commit is contained in:
Maschell 2021-01-24 15:45:15 +01:00
parent f79ae3847e
commit 9d43e49e7b

View File

@ -14,7 +14,7 @@ int FileReader::read(uint8_t *buffer, uint32_t size) {
if (toRead == 0) {
return 0;
}
memcpy(buffer, input_buffer, toRead);
memcpy(buffer, input_buffer + input_pos, toRead);
input_pos += toRead;
return toRead;
} else if (isReadFromFile) {
@ -45,6 +45,6 @@ FileReader::FileReader(uint8_t *buffer, uint32_t size) {
this->input_buffer = buffer;
this->input_size = size;
this->input_pos = 0;
this->isReadFromBuffer = false;
this->isReadFromBuffer = true;
this->isReadFromFile = false;
}