| 79 | } |
| 80 | |
| 81 | bool FlatFileSeq::Flush(const FlatFilePos& pos, bool finalize) |
| 82 | { |
| 83 | FILE* file = Open(FlatFilePos(pos.nFile, 0)); // Avoid fseek to nPos |
| 84 | if (!file) { |
| 85 | return error("%s: failed to open file %d", __func__, pos.nFile); |
| 86 | } |
| 87 | if (finalize && !TruncateFile(file, pos.nPos)) { |
| 88 | fclose(file); |
| 89 | return error("%s: failed to truncate file %d", __func__, pos.nFile); |
| 90 | } |
| 91 | if (!FileCommit(file)) { |
| 92 | fclose(file); |
| 93 | return error("%s: failed to commit file %d", __func__, pos.nFile); |
| 94 | } |
| 95 | DirectoryCommit(m_dir); |
| 96 | |
| 97 | fclose(file); |
| 98 | return true; |
| 99 | } |
nothing calls this directly
no test coverage detected