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

Method checkFillBuffer

lib/src/device/BlockDeviceOutputStream.cpp:127–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125 */
126
127 bool BlockDeviceOutputStream::checkFillBuffer(uint32_t toWrite) {
128
129 // if we are at the start of the block and we want to write less
130 // than a full block then we need to get the current contents of
131 // that block from the device
132
133 if(_indexInBlock==0) {
134
135 // cannot write anything at this point - we've run out of blocks
136
137 if(_blockIndex==_device.getTotalBlocksOnDevice())
138 return errorProvider.set(ErrorProvider::ERROR_PROVIDER_BLOCK_DEVICE_OUTPUT_STREAM,E_DEVICE_FULL);
139
140 // need to read if we write less than a block
141
142 if(toWrite<_device.getBlockSizeInBytes())
143 return _device.readBlock(_block,_blockIndex);
144 }
145
146 return true;
147 }
148
149
150 /**

Callers

nothing calls this directly

Calls 4

setMethod · 0.45
getBlockSizeInBytesMethod · 0.45
readBlockMethod · 0.45

Tested by

no test coverage detected