| 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 | /** |
nothing calls this directly
no test coverage detected