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 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); }
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 Ssdp::CanonicalDomainToUpnp(const Brx& aCanonicalDomain, Bwx& aUpnpDomain) // was UpnpDomain { if (aCanonicalDomain == kUpnpOrg) { aUpnpDomain.Replace(kSchemasUpnpOrg); } else { aUpnpDomain.Replace(aCanonicalDomain); for (TUint i = 0; i < aUpnpDomain.Bytes(); i++) { if (aUpnpDomain[i] == '.') { aUpnpDomain[i] = '-'; } } } }
Bwn::Bwn(const Bwx& aBwx) : Bwx(aBwx.Bytes(), aBwx.MaxBytes()), iPtr(aBwx.Ptr()) { ASSERT(iPtr != NULL); }