예제 #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));
}
예제 #2
0
파일: FileAnsii.cpp 프로젝트: SiMet/ohNet
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);
}
예제 #3
0
파일: Buffer.cpp 프로젝트: ACDN/ohNet
void Bwn::Set(const Bwx& aBwx)
{
    iPtr = aBwx.Ptr();
    ASSERT(iPtr != NULL);
    iBytes = aBwx.Bytes();
    iMaxBytes = aBwx.MaxBytes();
}
예제 #4
0
파일: MdnsPlatform.cpp 프로젝트: ACDN/ohNet
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);
}
예제 #5
0
파일: Ssdp.cpp 프로젝트: DoomHammer/ohNet
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] = '-';
            }
        }
    }
}
예제 #6
0
파일: Buffer.cpp 프로젝트: ACDN/ohNet
Bwn::Bwn(const Bwx& aBwx) : Bwx(aBwx.Bytes(), aBwx.MaxBytes()), iPtr(aBwx.Ptr())
{
    ASSERT(iPtr != NULL);
}