MCPcopy Create free account
hub / github.com/andysworkshop/stm32plus / requireBytes

Method requireBytes

lib/src/device/BlockDeviceInputStream.cpp:191–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

189 */
190
191 int16_t BlockDeviceInputStream::requireBytes() {
192
193 // if the index has hit the end, advance to new block
194
195 if(_indexInBlock==_device.getBlockSizeInBytes()) {
196
197 _indexInBlock=0;
198 _blockIndex++;
199
200 // check for end of the device
201
202 if(_blockIndex==_device.getTotalBlocksOnDevice())
203 return E_END_OF_STREAM;
204 }
205
206 // if we're at position zero then new bytes must be read in
207
208 if(_indexInBlock==0)
209 if(!_device.readBlock(_block,_blockIndex))
210 return E_STREAM_ERROR;
211
212 return ErrorProvider::ERROR_NO_ERROR;
213 }
214}

Callers

nothing calls this directly

Calls 3

getBlockSizeInBytesMethod · 0.45
readBlockMethod · 0.45

Tested by

no test coverage detected