1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-28 06:24:10 +01:00

Merged in LP-622_fix_gcc-9_GCS_compilation (pull request #544)

LP-622 - fix gcc-9 and higher GCS compilation errors

Approved-by: TheOtherCliff
This commit is contained in:
Eric Price 2022-02-15 23:40:01 +00:00
commit 7314423351

View File

@ -229,13 +229,15 @@ void FlightLogManager::retrieveLogs(int flightToRetrieve)
// cycle until there is space for another object
while (start + header_len + 1 < data_len) {
memset(&fields, 0xFF, total_len);
memcpy(&fields, &logEntry->getData().Data[start], header_len);
uint8_t *tmp = logEntry->getData().Data; // avoid compiler warning regarding addressing a temporary make sure tmp lives until after memcpy
memcpy(&fields, &tmp[start], header_len);
// check wether a packed object is found
// note that empty data blocks are set as 0xFF in flight side to minimize flash wearing
// thus as soon as this read outside of used area, the test will fail as lenght would be 0xFFFF
quint32 toread = header_len + fields.Size;
if (!(toread + start > data_len)) {
memcpy(&fields, &logEntry->getData().Data[start], toread);
uint8_t *tmp = logEntry->getData().Data; // avoid compiler warning regarding addressing a temporary make sure tmp lives until after memcpy
memcpy(&fields, &tmp[start], toread);
ExtendedDebugLogEntry *subEntry = new ExtendedDebugLogEntry();
subEntry->setData(fields, m_objectManager);
m_logEntries << subEntry;