| 296 | } |
| 297 | |
| 298 | FilePosition FileStore::Length() const noexcept |
| 299 | { |
| 300 | switch (usageMode) |
| 301 | { |
| 302 | case FileUseMode::free: |
| 303 | REPORT_INTERNAL_ERROR; |
| 304 | return 0; |
| 305 | |
| 306 | case FileUseMode::readOnly: |
| 307 | #if HAS_SBC_INTERFACE |
| 308 | if (reprap.UsingSbcInterface()) |
| 309 | { |
| 310 | return length; |
| 311 | } |
| 312 | #endif |
| 313 | #if HAS_MASS_STORAGE |
| 314 | return f_size(&file); |
| 315 | #elif HAS_EMBEDDED_FILES |
| 316 | return EmbeddedFiles::Length(fileIndex); |
| 317 | #else |
| 318 | return 0; |
| 319 | #endif |
| 320 | |
| 321 | case FileUseMode::readWrite: |
| 322 | #if HAS_SBC_INTERFACE |
| 323 | if (reprap.UsingSbcInterface()) |
| 324 | { |
| 325 | return (writeBuffer != nullptr) ? length + writeBuffer->BytesStored() : length; |
| 326 | } |
| 327 | #endif |
| 328 | #if HAS_MASS_STORAGE |
| 329 | return (writeBuffer != nullptr) ? f_size(&file) + writeBuffer->BytesStored() : f_size(&file); |
| 330 | #else |
| 331 | return 0; |
| 332 | #endif |
| 333 | |
| 334 | case FileUseMode::invalidated: |
| 335 | default: |
| 336 | return 0; |
| 337 | } |
| 338 | } |
| 339 | |
| 340 | #endif |
| 341 |
no test coverage detected