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)); }
void Bwn::Set(const Bwx& aBwx) { iPtr = aBwx.Ptr(); ASSERT(iPtr != NULL); iBytes = aBwx.Bytes(); iMaxBytes = aBwx.MaxBytes(); }
TInt OpenHome::Os::NetworkReceiveFrom(THandle aHandle, Bwx& aBuffer, Endpoint& aEndpoint) { TIpAddress address; TUint16 port; TInt ret = OsNetworkReceiveFrom(aHandle, (uint8_t*)aBuffer.Ptr(), aBuffer.MaxBytes(), &address, &port); if (ret != -1) { aEndpoint.SetAddress(address); aEndpoint.SetPort(port); } return ret; }
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); }
Bwn::Bwn(const Bwx& aBwx) : Bwx(aBwx.Bytes(), aBwx.MaxBytes()), iPtr(aBwx.Ptr()) { ASSERT(iPtr != NULL); }