| 20 | class FileMemorySource : public MemorySource { |
| 21 | public: |
| 22 | explicit FileMemorySource(const std::filesystem::path& p) |
| 23 | : name_(p.string()) |
| 24 | { |
| 25 | fp_ = LMPFS_FOPEN64(p); |
| 26 | if (!fp_) throw_error("Cannot open dump file: {}", p.string()); |
| 27 | LMPFS_FSEEK64(fp_, 0, SEEK_END); |
| 28 | size_ = static_cast<u64>(LMPFS_FTELL64(fp_)); |
| 29 | LMPFS_FSEEK64(fp_, 0, SEEK_SET); |
| 30 | log::debug("Opened dump source '{}' ({} bytes)", name_, size_); |
| 31 | } |
| 32 | ~FileMemorySource() override { if (fp_) std::fclose(fp_); } |
| 33 | |
| 34 | u64 size() const override { return size_; } |
nothing calls this directly
no test coverage detected