forked from romixlab/qmsgpack
QIODevice::read() can read any number of bytes less than the amount requested if there wasn't that much data available. If the result is >= 0, we haven't actually hit EOF yet and should continue trying to read data. Since QIODevice::read() doesn't block, we use QIODevice::waitForReadyRead() to avoid spinning waiting for input to arrive. If we encounter EOF or another error during a read, we set the ReadPastEnd status and walk away as normal.