Is it possible to change CryptFileDevice to accept any QIODevice instead of just QFileDevice?
Looking throught the code, most of it seems to already work fine. These are parts I'm not sure about:
- When opening a device we probably should check
bytesAvailable() instead of size(). And if that's 0 we may still want to try and read the header first if the device is sequential.
seek(0)here and here won't always work but might be unnecessary.
- reimplementing
seek should check the return value of m_device->seek
- appending to a device might not work for sequential devices
QIODevice::bytesAvailable probably needs an override
fileName() only exists for QFileDevice. It might be fine to try and dynamic_cast the device and return an empty string if that fails.
Is it possible to change
CryptFileDeviceto accept anyQIODeviceinstead of justQFileDevice?Looking throught the code, most of it seems to already work fine. These are parts I'm not sure about:
bytesAvailable()instead ofsize(). And if that's0we may still want to try and read the header first if the device is sequential.seek(0)here and here won't always work but might be unnecessary.seekshould check the return value ofm_device->seekQIODevice::bytesAvailableprobably needs an overridefileName()only exists forQFileDevice. It might be fine to try anddynamic_castthe device and return an empty string if that fails.