| 747 | } |
| 748 | |
| 749 | void MdfBlock::UpdateBlockSize(std::streambuf& buffer, uint64_t bytes) { |
| 750 | auto pos = FilePosition(); |
| 751 | if (pos <= 0) { |
| 752 | throw std::runtime_error("Invalid file position"); |
| 753 | } |
| 754 | |
| 755 | if (IsMdf4()) { |
| 756 | if (block_length_ != static_cast<uint64_t>(bytes)) { |
| 757 | block_length_ = static_cast<uint64_t>(bytes); |
| 758 | pos += 8; |
| 759 | SetFilePosition(buffer, pos); |
| 760 | WriteNumber(buffer, block_length_); |
| 761 | } |
| 762 | } else { |
| 763 | if (block_size_ != static_cast<uint32_t>(bytes)) { |
| 764 | block_size_ = static_cast<uint32_t>(bytes); |
| 765 | pos += 2; |
| 766 | SetFilePosition(buffer, pos); |
| 767 | WriteNumber(buffer, block_size_); |
| 768 | } |
| 769 | } |
| 770 | } |
| 771 | |
| 772 | /* |
| 773 | void MdfBlock::UpdateBlockSize(std::FILE *file, size_t bytes) { |
no test coverage detected