copy one area to another */
| 319 | copy one area to another |
| 320 | */ |
| 321 | bool StorageAccess::copy_area(const StorageAccess &source) const |
| 322 | { |
| 323 | // we deliberately allow for copies from smaller areas. This |
| 324 | // allows for a partial backup region for parameters |
| 325 | uint16_t total = MIN(source.size(), size()); |
| 326 | uint16_t ofs = 0; |
| 327 | while (total > 0) { |
| 328 | uint8_t block[32]; |
| 329 | uint16_t n = MIN(sizeof(block), total); |
| 330 | if (!source.read_block(block, ofs, n) || |
| 331 | !write_block(ofs, block, n)) { |
| 332 | return false; |
| 333 | } |
| 334 | total -= n; |
| 335 | ofs += n; |
| 336 | } |
| 337 | return true; |
| 338 | } |
| 339 | |
| 340 | #if AP_SDCARD_STORAGE_ENABLED |
| 341 | /* |
no test coverage detected