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 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.º 3
0
void Bwn::Set(const Bwx& aBwx)
{
    iPtr = aBwx.Ptr();
    ASSERT(iPtr != NULL);
    iBytes = aBwx.Bytes();
    iMaxBytes = aBwx.MaxBytes();
}
Exemplo n.º 4
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.º 5
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.º 6
0
Bwn::Bwn(const Bwx& aBwx) : Bwx(aBwx.Bytes(), aBwx.MaxBytes()), iPtr(aBwx.Ptr())
{
    ASSERT(iPtr != NULL);
}