Example #1
0
File: Fifo.cpp Project: ACDN/ohNet
void FifoByte::Read(Bwx& aBuffer, TUint aBytes)
{
    aBuffer.SetBytes(0);
    for (TUint i = 0; i < aBytes; i++) {
        aBuffer.Append(Fifo<TByte>::Read());
    }
}
Example #2
0
static void AppendUint32(Bwx& aBuf, TUint aNum)
{
    TUint bytes = aBuf.Bytes();
    ASSERT(bytes + sizeof(TUint32) <= aBuf.MaxBytes());
    memcpy(const_cast<TByte*>(aBuf.Ptr()+bytes), &aNum, sizeof(TUint32));
    aBuf.SetBytes(bytes + sizeof(TUint32));
}
Example #3
0
void ReaderBinary::ReadReplace(TUint aBytes, Bwx& aBuffer)
{
    ASSERT(aBytes <= aBuffer.MaxBytes());
    aBuffer.SetBytes(0);
    while (aBytes > 0) {
        Brn buf = iReader.Read(aBytes);
        aBuffer.Append(buf);
        aBytes -= buf.Bytes();
    }
}
Example #4
0
void FileAnsii::Read(Bwx& aBuffer, TUint32 aBytes)
{
    // IFile implementations must check read length
    ASSERT(aBytes);
    // Check there's enough space in read buffer
    ASSERT(aBytes <= aBuffer.BytesRemaining());
    // Find read pointer
    TByte* p = const_cast<TByte*>(aBuffer.Ptr()) + aBuffer.Bytes();
    // Do the read
    TUint bytesRead = (TUint)fread(p, 1, aBytes, iFilePtr);
    // Register the new content with the buffer
    aBuffer.SetBytes(aBuffer.Bytes() + bytesRead);
    // throw if entire read wasn't performed
    if ( bytesRead == 0 )
        THROW(FileReadError);
}