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

Method SkipByte

lib/mdflib/mdflib/src/readcache.cpp:534–582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

532}
533
534bool ReadCache::SkipByte() {
535 if ( file_index_ < data_size_) {
536 if (file_buffer_.empty()) {
537 const auto nof_bytes = StepFilePosition(buffer_, 1);
538 if (nof_bytes != 1) {
539 return false;
540 }
541 }
542 ++file_index_;
543 ++data_count_;
544 return true;
545 }
546
547 file_index_ = 0;
548 data_size_ = 0;
549 if (block_index_ >= block_list_.size()) {
550 return false;
551 }
552
553 auto* current_block = block_list_[block_index_];
554 ++block_index_;
555 if (current_block == nullptr) {
556 return false;
557 }
558 data_size_ = current_block->DataSize();
559 if (current_block->BlockType() == "DZ") {
560 try {
561 file_buffer_.resize(static_cast<size_t>(data_size_) );
562 } catch (const std::exception&) {
563 return false;
564 }
565 } else {
566 file_buffer_.clear();
567 SetFilePosition(buffer_, current_block->DataPosition());
568 }
569
570 if (file_index_ >= data_size_) {
571 return false;
572 }
573 if (file_buffer_.empty()) {
574 const auto reads = StepFilePosition(buffer_, 1);
575 if (reads != 1) {
576 return false;
577 }
578 }
579 ++file_index_;
580 ++data_count_;
581 return true;
582}
583
584void ReadCache::SetOffsetFilter(const std::vector<uint64_t> &offset_list) {
585 offset_filter_.clear();

Callers

nothing calls this directly

Calls 9

StepFilePositionFunction · 0.85
SetFilePositionFunction · 0.85
emptyMethod · 0.80
DataPositionMethod · 0.80
sizeMethod · 0.45
DataSizeMethod · 0.45
BlockTypeMethod · 0.45
resizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected