Exemplo n.º 1
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));
}
Exemplo n.º 2
0
void Bwn::Set(const Bwx& aBwx)
{
    iPtr = aBwx.Ptr();
    ASSERT(iPtr != NULL);
    iBytes = aBwx.Bytes();
    iMaxBytes = aBwx.MaxBytes();
}
Exemplo n.º 3
0
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);
}
Exemplo n.º 4
0
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;
}
Exemplo n.º 5
0
Arquivo: Fifo.cpp Projeto: ACDN/ohNet
void FifoByte::Read(Bwx& aBuffer, TUint aBytes)
{
    aBuffer.SetBytes(0);
    for (TUint i = 0; i < aBytes; i++) {
        aBuffer.Append(Fifo<TByte>::Read());
    }
}
Exemplo n.º 6
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();
    }
}
Exemplo n.º 7
0
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);
}
Exemplo n.º 8
0
void ReceiverManager2Receiver::SenderMetadata(Bwx& aValue) const
{
	iMutex.Wait();
	try {
		aValue.ReplaceThrow(iMetadata);
	}
	catch (BufferOverflow) {
		aValue.Replace(Brx::Empty());
	}
	iMutex.Signal();
}
Exemplo n.º 9
0
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;
}
Exemplo n.º 10
0
void ReceiverManager2Receiver::TransportState(Bwx& aValue) const
{
	iMutex.Wait();
	try {
		aValue.ReplaceThrow(iTransportState);
	}
	catch (BufferOverflow) {
		aValue.Replace(Brx::Empty());
	}
	iMutex.Signal();
}
Exemplo n.º 11
0
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] = '-';
            }
        }
    }
}
Exemplo n.º 12
0
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('/');
}
Exemplo n.º 13
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);
}
Exemplo n.º 14
0
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());
}
Exemplo n.º 15
0
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);
}
Exemplo n.º 16
0
Bwn::Bwn(const Bwx& aBwx) : Bwx(aBwx.Bytes(), aBwx.MaxBytes()), iPtr(aBwx.Ptr())
{
    ASSERT(iPtr != NULL);
}
Exemplo n.º 17
0
Arquivo: Fifo.cpp Projeto: ACDN/ohNet
void FifoByte::Read(Bwx& aBuffer)
{
    Read(aBuffer, aBuffer.MaxBytes());
}
Exemplo n.º 18
0
void FileBrx::Read(Bwx& aBuffer)
{
    Read(aBuffer, aBuffer.MaxBytes());
}
Exemplo n.º 19
0
void DviProtocolUpnp::GetUriDeviceXml(Bwx& aUri, const Brx& aUriBase)
{
    aUri.Replace(aUriBase);
    aUri.Append(kDeviceXmlName);
}
Exemplo n.º 20
0
void FileAnsii::Read(Bwx& aBuffer)
{
    Read(aBuffer, aBuffer.BytesRemaining());
}