| 13 | } |
| 14 | |
| 15 | QByteArray QMappedFileBuffer::read(qint64 offset, int length) { |
| 16 | if(offset >= this->length()) |
| 17 | return {}; |
| 18 | |
| 19 | if(offset + length >= this->length()) |
| 20 | length = this->length() - offset; |
| 21 | |
| 22 | return QByteArray::fromRawData( |
| 23 | reinterpret_cast<const char*>(m_mappeddata + offset), length); |
| 24 | } |
| 25 | |
| 26 | bool QMappedFileBuffer::read(QIODevice* iodevice) { |
| 27 | m_device = qobject_cast<QFile*>(iodevice); |