MCPcopy Create free account
hub / github.com/SmingHub/Sming / readMemoryBlock

Method readMemoryBlock

Sming/Core/Data/Stream/SectionStream.cpp:125–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125uint16_t SectionStream::readMemoryBlock(char* data, int bufSize)
126{
127 if(currentSectionIndex < 0) {
128 nextSection();
129 }
130
131 if(finished || currentSectionIndex < 0) {
132 return 0;
133 }
134
135 auto sect = &sections[currentSectionIndex];
136 if(sectionOffset >= sect->size) {
137 if(nextRecord()) {
138 ++sect->recordIndex;
139 ++sect->recordCount;
140 readOffset = stream->seekFrom(sect->start, SeekOrigin::Start);
141 sectionOffset = 0;
142 } else {
143 nextSection();
144 if(finished) {
145 return 0;
146 }
147 sect = &sections[currentSectionIndex];
148 }
149 }
150
151 bufSize = std::min(uint32_t(bufSize), sect->size - sectionOffset);
152
153 return stream->readMemoryBlock(data, bufSize);
154}
155
156int SectionStream::seekFrom(int offset, SeekOrigin origin)
157{

Callers 1

scanSourceMethod · 0.45

Calls 2

minFunction · 0.85
seekFromMethod · 0.45

Tested by

no test coverage detected