Browse Source

AP_FlashStorage: fixed build error with -O0

master
Andrew Tridgell 6 years ago
parent
commit
d2c9db3f1f
  1. 4
      libraries/AP_FlashStorage/AP_FlashStorage.cpp

4
libraries/AP_FlashStorage/AP_FlashStorage.cpp

@ -315,7 +315,9 @@ bool AP_FlashStorage::write_all() @@ -315,7 +315,9 @@ bool AP_FlashStorage::write_all()
debug("write_all to sector %u at %u with reserved_space=%u\n",
current_sector, write_offset, reserved_space);
for (uint16_t ofs=0; ofs<storage_size; ofs += max_write) {
uint8_t n = MIN(max_write, storage_size-ofs);
// local variable needed to overcome problem with MIN() macro and -O0
const uint8_t max_write_local = max_write;
uint8_t n = MIN(max_write_local, storage_size-ofs);
if (!all_zero(ofs, n)) {
if (!write(ofs, n)) {
return false;

Loading…
Cancel
Save