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(); }
TUint Ascii::AppendDec(Bwx& aBuffer, TInt64 aValue) { Bws<20> reversed; // Maximum value requires 20 digits if (aValue == 0) { aBuffer.Append('0'); return (1); } TUint extra = 0; if (aValue < 0) { aBuffer.Append('-'); extra++; } while(aValue != 0) { reversed.Append((TChar)('0' + abs((TInt)(aValue % 10)))); aValue = aValue / 10; } for (TUint i = reversed.Bytes(); i > 0; i--) { aBuffer.Append(reversed[i - 1]); } return (reversed.Bytes() + extra); }
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; }
void FifoByte::Read(Bwx& aBuffer, TUint aBytes) { aBuffer.SetBytes(0); for (TUint i = 0; i < aBytes; i++) { aBuffer.Append(Fifo<TByte>::Read()); } }
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(); } }
TBool CSource::Visible(Bwx& aSystemName, Bwx& aType, Bwx& aName) { aSystemName.Replace(iSystemName); aType.Replace(iType); iLockable.Wait(); aName.Replace(iName); TBool visible = iVisible; iMutex.Signal(); return (visible); }
void ReceiverManager2Receiver::SenderMetadata(Bwx& aValue) const { iMutex.Wait(); try { aValue.ReplaceThrow(iMetadata); } catch (BufferOverflow) { aValue.Replace(Brx::Empty()); } iMutex.Signal(); }
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 ReceiverManager2Receiver::TransportState(Bwx& aValue) const { iMutex.Wait(); try { aValue.ReplaceThrow(iTransportState); } catch (BufferOverflow) { aValue.Replace(Brx::Empty()); } iMutex.Signal(); }
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] = '-'; } } } }
void DviDevice::GetUriBase(Bwx& aUriBase, TIpAddress aInterface, TUint aPort, IDvProtocol& aProtocol) { const Brx& name = aProtocol.ProtocolName(); aUriBase.Append(Http::kUriPrefix); Endpoint endpt(aPort, aInterface); Endpoint::EndpointBuf buf; endpt.AppendEndpoint(buf); aUriBase.Append(buf); aUriBase.Append('/'); Uri::Escape(aUriBase, iUdn); aUriBase.Append('/'); aUriBase.Append(name); aUriBase.Append('/'); }
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); }
TUint Ascii::AppendDec(Bwx& aBuffer, TUint64 aValue) { Bws<20> reversed; // Maximum value requires 20 digits if (aValue == 0) { aBuffer.Append('0'); return (1); } while(aValue > 0) { reversed.Append((TChar)('0' + aValue % 10)); aValue = aValue / 10; } for (TUint i = reversed.Bytes(); i > 0; i--) { aBuffer.Append(reversed[i - 1]); } return (reversed.Bytes()); }
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); }
Bwn::Bwn(const Bwx& aBwx) : Bwx(aBwx.Bytes(), aBwx.MaxBytes()), iPtr(aBwx.Ptr()) { ASSERT(iPtr != NULL); }
void FifoByte::Read(Bwx& aBuffer) { Read(aBuffer, aBuffer.MaxBytes()); }
void FileBrx::Read(Bwx& aBuffer) { Read(aBuffer, aBuffer.MaxBytes()); }
void DviProtocolUpnp::GetUriDeviceXml(Bwx& aUri, const Brx& aUriBase) { aUri.Replace(aUriBase); aUri.Append(kDeviceXmlName); }
void FileAnsii::Read(Bwx& aBuffer) { Read(aBuffer, aBuffer.BytesRemaining()); }