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