Copy an open file handle to make a duplicate with its own position. Intended for use on files opened in read-only mode. We assume that FatFs doesn't keep a count of open files, so it's OK for us to just make a copy of the FIL structure.
| 778 | // Copy an open file handle to make a duplicate with its own position. Intended for use on files opened in read-only mode. |
| 779 | // We assume that FatFs doesn't keep a count of open files, so it's OK for us to just make a copy of the FIL structure. |
| 780 | void FileStore::CopyFrom(const FileStore *f) noexcept |
| 781 | { |
| 782 | usageMode = FileUseMode::readOnly; |
| 783 | #if HAS_EMBEDDED_FILES |
| 784 | fileIndex = f->fileIndex; |
| 785 | #else |
| 786 | file = f->file; |
| 787 | writeBuffer = nullptr; |
| 788 | crc.Reset(); |
| 789 | calcCrc = false; |
| 790 | #endif |
| 791 | closeRequested = false; |
| 792 | openCount = 1; |
| 793 | reprap.VolumesUpdated(); |
| 794 | } |
| 795 | |
| 796 | #endif |
| 797 |
no test coverage detected