MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / UpdateBlockSize

Method UpdateBlockSize

lib/mdflib/mdflib/src/mdfblock.cpp:749–770  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

747}
748
749void 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/*
773void MdfBlock::UpdateBlockSize(std::FILE *file, size_t bytes) {

Callers 2

SaveQueueMethod · 0.80
SaveQueueMethod · 0.80

Calls 1

SetFilePositionFunction · 0.85

Tested by

no test coverage detected