void FileBrx::Read(Bwx& aBuffer, TUint32 aBytes) { ASSERT(aBytes <= aBuffer.MaxBytes()); TUint32 bytes = ( iCursor + aBytes > Bytes() ? Bytes() - iCursor : aBytes ); aBuffer.Replace(iBuffer->Split(iCursor, bytes)); iCursor += bytes; }
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(); }
void MdnsPlatform::AppendTxtRecord(Bwx& aBuffer, const TChar* aKey, const TChar* aValue) { ASSERT((strlen(aKey) + strlen(aValue) + 3) <= (aBuffer.MaxBytes()-aBuffer.Bytes())); TByte length = (TByte)(strlen(aKey) + strlen(aValue) + 1); aBuffer.Append(length); aBuffer.Append(aKey); aBuffer.Append('='); aBuffer.Append(aValue); }
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(); } }
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 FifoByte::Read(Bwx& aBuffer) { Read(aBuffer, aBuffer.MaxBytes()); }
void FileBrx::Read(Bwx& aBuffer) { Read(aBuffer, aBuffer.MaxBytes()); }
Bwn::Bwn(const Bwx& aBwx) : Bwx(aBwx.Bytes(), aBwx.MaxBytes()), iPtr(aBwx.Ptr()) { ASSERT(iPtr != NULL); }