示例#1
0
bool Message::isComplete()
{
    // if the length hasn't been read or the buffer has some reading to do
    if(!msgHasReadLength || bytesLeftToRead())
    {
        return false;
    }

    return true;
}
示例#2
0
文件: Packet.cpp 项目: rabedik/hifi
qint64 Packet::readData(char* dest, qint64 maxSize) {
    // we're either reading what is left from the current position or what was asked to be read
    qint64 numBytesToRead = std::min(bytesLeftToRead(), maxSize);

    if (numBytesToRead > 0) {
        int currentPosition = pos();

        // read out the data
        memcpy(dest, _payloadStart + currentPosition, numBytesToRead);
    }

    return numBytesToRead;
}