本文整理汇总了C++中TDesC8::Size方法的典型用法代码示例。如果您正苦于以下问题:C++ TDesC8::Size方法的具体用法?C++ TDesC8::Size怎么用?C++ TDesC8::Size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TDesC8
的用法示例。
在下文中一共展示了TDesC8::Size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnContentL
// -----------------------------------------------------------------------------
// CRoapParser::OnContentL
// -----------------------------------------------------------------------------
//
void CRoapParser::OnContentL(
const TDesC8& aBytes,
TInt /*aErrorCode*/)
{
if ( !iContent )
{
iContent = HBufC8::NewL(aBytes.Size());
*iContent = aBytes;
}
else
{
iContent = iContent->ReAllocL(iContent->Size() + aBytes.Size());
TPtr8 c(iContent->Des());
c.Append(aBytes);
}
}
示例2: InitialiseL
void CHMAC::InitialiseL(const TDesC8& aKey)
{
InitBlockSizeL();
// initialisation
if (iDigest)
{
iDigest->Reset();
if( (TUint32)aKey.Size() > iBlockSize)
{
iInnerPad = iDigest->Final(aKey);
}
else
{
iInnerPad = aKey;
}
TUint i;
for (i=iInnerPad.Size();i<iBlockSize;i++)
iInnerPad.Append(0);
iOuterPad=iInnerPad;
const TUint8 Magic1=0x36, Magic2=0x5c;
for (i=0;i<iBlockSize;i++)
{
iInnerPad[i]^=Magic1;
iOuterPad[i]^=Magic2;
}
//start inner hash
iDigest->Hash(iInnerPad);
}
}
示例3: Update
EXPORT_C TBool TBtreeInlineIndexOrg::Update(TAny *aNode,TInt aPos,const TDesC8& anEntry) const
{
__ASSERT_DEBUG(anEntry.Size()<=KeySize(),Panic(EBadEntrySize));
__ASSERT_DEBUG(aPos<Node(aNode)->iHead.iCount,Panic(EBadEntryPos));
Mem::Copy(Entry(Node(aNode),aPos)->iKey,anEntry.Ptr(),KeySize());
return ETrue;
}
示例4: stream
// -----------------------------------------------------------------------------
// BufferToArrayL
// Created buffer will contain <amount of elements:int32, element data1, element data2...>
// -----------------------------------------------------------------------------
//
LOCAL_C RPointerArray<HBufC8> BufferToArrayL( TDesC8& aBuffer )
{
TInt32 count = 0;
HBufC8* element = NULL;
RPointerArray<HBufC8> array;
TInt size = aBuffer.Size();
RMemReadStream stream( (TAny*)( aBuffer.Ptr() ), size );
CleanupClosePushL( stream );
CleanupResetAndDestroyPushL( array );
// amount of elements
count = stream.ReadInt32L();
// for each in RPointerArray
for ( TInt i = 0; i < count; i++ )
{
// Read the element and append it to array
element = HBufC8::NewLC( stream, KMaxElementLength );
array.AppendL( element );
CleanupStack::Pop( element );
}
CleanupStack::Pop( &array );
CleanupStack::PopAndDestroy( &stream );
return array;
}
示例5:
void CRC2::SetKey(const TDesC8& aKey, TInt aEffectiveKeyLenBits)
{
TUint keyLen = (TUint)aKey.Size();
iKey.Copy(aKey);
iEffectiveKeyLenBits = aEffectiveKeyLenBits;
TUint8 L[KRC2MaxKeySizeBytes];
Mem::Copy((TUint8*)&L[0], (TUint8*)&aKey[0], keyLen);
TInt maxKeySizeBytes = (TInt)KRC2MaxKeySizeBytes;
TInt expandedKeyLen = (TInt)KRC2ExpandedKeyLen;
TInt i = keyLen;
for (; i < maxKeySizeBytes; i++)
{
L[i] = RC2_TABLE::PITABLE[(L[i-1] + L[i-keyLen]) & 255];
}
TUint T8 = (aEffectiveKeyLenBits+7) / 8;
TUint8 TM = (TUint8)(255 >> ((8-(iEffectiveKeyLenBits%8))%8));
L[128-T8] = RC2_TABLE::PITABLE[L[128-T8] & TM];
for (i=127-T8; i>=0; i--)
L[i] = RC2_TABLE::PITABLE[L[i+1] ^ L[i+T8]];
for (i=0; i < expandedKeyLen; i++)
iK[i] = (TUint16)(L[2*i] + (L[2*i+1] << 8));
}
示例6: DoAddL
void CCheckedCertStore::DoAddL( const TDesC& aLabel,
TCertificateFormat aFormat,
TCertificateOwnerType aCertificateOwnerType,
const TKeyIdentifier* aSubjectKeyId,
const TKeyIdentifier* aIssuerKeyId,
const TDesC8& aCert,
const TBool aDeletable,
TRequestStatus& aStatus)
{
// Store caller parameters for later use
aStatus = KRequestPending;
iCallerStatus = &aStatus;
iFormat = aFormat;
iCertificateOwnerType = aCertificateOwnerType;
iSubjectKeyId = aSubjectKeyId;
iIssuerKeyId = aIssuerKeyId;
iDeletable = aDeletable;
// Store (copy) aCert (cert data) into iCertificate[:HBufC8]
assert(!iCertificate);
iCertificate = HBufC8::NewMaxL(aCert.Size());
TPtr8 theCert(iCertificate->Des());
theCert.FillZ();
theCert.Copy(aCert);
// Store (copy) aLabel (cert label) into iCertLabel[:HBufC]
assert(!iCertLabel);
iCertLabel = HBufC::NewMaxL(aLabel.Length());
TPtr theLabel(iCertLabel->Des());
theLabel.FillZ();
theLabel.Copy(aLabel);
// Checks subject key ID with certificate data, and sets up key filter
// which is used later to determine whether there is a key with the
// appropriate subject and thus, if it is OK to add the certificate
ComputeAndCheckSubjectKeyIdL();
// Is keystore checking required? Only if a user certificate
if (EUserCertificate==aCertificateOwnerType)
{
InitialiseKeyStoreL(EInitKeyStoreForAdd);
}
else
{
iState = EAdd;
// try new method first
iWritableCertStore->Add( *iCertLabel, // call new method
iFormat,
iCertificateOwnerType,
iSubjectKeyId,
iIssuerKeyId,
*iCertificate,
iDeletable, // with deletable param
iStatus );
SetActive();
}
}
示例7:
TPtrC8 CMD4Impl::Hash(const TDesC8& aMessage)
{
DoUpdate(aMessage.Ptr(),aMessage.Size());
StoreState();
DoFinal();
RestoreState();
return iHash;
}
示例8: BufferedWriteL
// --------------------------------------------------------------------------------------
// Appends given string to output buffer. If the serializer's
// output type is file, the output buffer is released to the output stream
// after reaching a specified threshold and the output buffer is cleared.
// --------------------------------------------------------------------------------------
//
void CXmlEngSerializerXOP::BufferedWriteL(const TDesC8& aString, TBool aFlush)
{
if(aFlush)
{
if(iOutputBufferPtr->Size() > 0)
{
if( iTmpOutputStream->Write(iOutputBuffer->Des()) == -1)
{
User::Leave(iTmpOutputStream->CheckError());
}
iOutputBufferPtr->Delete(0, iOutputBufferPtr->Size());
}
if( iTmpOutputStream->Write(aString) == -1)
{
User::Leave(iTmpOutputStream->CheckError());
}
iDataWritten += aString.Size();
return;
}
// first, check if data is in the buffer and added string will not fit
// -> flush buffer
if(iOutputBufferPtr->Size() > 0 &&
iOutputBufferPtr->Size() + aString.Size() > iOutputBufferPtr->MaxSize())
{
if( iTmpOutputStream->Write(iOutputBuffer->Des()) == -1)
{
User::Leave(iTmpOutputStream->CheckError());
}
iOutputBufferPtr->Delete(0, iOutputBufferPtr->Size());
}
// if string alone doesn't fit in the buffer -> save string
if(aString.Size() > iOutputBufferPtr->MaxSize())
{
if( iTmpOutputStream->Write(aString) == -1)
{
User::Leave(iTmpOutputStream->CheckError());
}
}
// if string fits into the buffer -> append it
else
{
iOutputBufferPtr->Append(aString);
}
iDataWritten += aString.Size();
}
示例9: pckg
// -----------------------------------------------------------------------------
// CG711PayloadFormatRead::ConfigurePayloadFormatL
// Configure payload decoding parameters.
// -----------------------------------------------------------------------------
//
void CG711PayloadFormatRead::ConfigurePayloadFormatL( const TDesC8& aConfigParams )
{
DP_G711_READ( "CG711PayloadFormatRead::ConfigurePayloadFormatL" );
__ASSERT_ALWAYS( aConfigParams.Size() == sizeof( TMccCodecInfo ),
User::Leave( KErrArgument ) );
TMccCodecInfoBuffer infoBuffer;
infoBuffer.Copy( aConfigParams );
if ( !infoBuffer() .iIsUpdate )
{
iCInfo = infoBuffer();
// Calculates frames/packet, frame size and frame time interval
iFramesPerPacket = TInt8( iCInfo.iMaxPtime / iCInfo.iHwFrameTime );
iCInfo.iFrameSize =
static_cast<TUint>( KDefaultSampleRateInkHz * iCInfo.iHwFrameTime );
iFrameTimeInterval = TInt64( iCInfo.iHwFrameTime );
// Create two frame buffers used in data transfer with datapath.
// Space for two byte additional header needed by HW codec is reserved.
iFrameBufferOne =
CMMFDataBuffer::NewL( iCInfo.iFrameSize + KVoIPHeaderLength );
iFrameBufferTwo =
CMMFDataBuffer::NewL( iCInfo.iFrameSize + KVoIPHeaderLength );
// PayloadBuffer contains data received from network
TInt plSize = iCInfo.iFrameSize * iFramesPerPacket;
DP_G711_READ3( "CG711PayloadFormatRead::ConfigurePayloadFormatL \
FramesPerPacket: %d, FrameSize: %d" , iFramesPerPacket, iCInfo.iFrameSize );
if ( EGenRedUsed == iCInfo.iAlgoUsed )
{
DP_G711_READ2( "CG711PayloadFormatRead::ConfigurePayloadFormatL, RED LEVEL: %d",
iCInfo.iRedundancyCount );
if ( iCInfo.iRedundancyCount )
{
plSize *= iCInfo.iRedundancyCount;
}
CPayloadFormatRead* redDecoder
= static_cast<CPayloadFormatRead*>( iClip );
TMccRedPayloadReadConfig config;
config.iRedBlockCount = iCInfo.iRedundancyCount;
config.iMaxPayloadSize = iCInfo.iFrameSize * iFramesPerPacket;
config.iNumOfEncodings = 1;
config.iRedPayloadType = iCInfo.iRedundantPayload;
config.InitPayloadTypes();
config.iEncPayloadTypes[0] = iCInfo.iPayloadType;
TMccRedPayloadReadPckg pckg( config );
redDecoder->ConfigurePayloadFormatL( pckg );
}
iSourceBuffer = CreateClipBufferL( plSize, iSourceBufOwnership );
}
示例10: Write
TInt RFileX::Write(const TDesC8& aDes)
//
// Write and update the file pos
//
{
TheCurrentBase+=aDes.Size();
return(RFile::Write(aDes));
}
示例11: Write
TInt CTestFileOutputStream::Write(const TDesC8 &aBuffer)
{
TRAP(iError,WriteL(aBuffer));
if(iError)
{
return -1;
}
return aBuffer.Size();
};
示例12: ptr
TPtrC8 CMD5Impl::Hash(const TDesC8& aMessage)
{
TPtrC8 ptr(KNullDesC8());
DoUpdate(aMessage.Ptr(),aMessage.Size());
StoreState();
DoFinal();
ptr.Set(iHash);
RestoreState();
return ptr;
}
示例13: CompareBuffers
// -----------------------------------------------------------------------------
// CAmrPayloadDecoder::CompareBuffers
// Compares contents of two buffers.
// -----------------------------------------------------------------------------
//
TBool CAmrPayloadDecoder::CompareBuffers( const TDesC8& aBuffer,
const TAmrFrame& aFrameToCmp,
TInt aOctetsToCmp ) const
{
DP_AMR_DECODE( "CAmrPayloadDecoder::CompareBuffers" );
TBool isSame( ETrue );
if ( EAmrFrameNoData == aFrameToCmp.iFrameType )
{
if ( aBuffer.Size() )
{
return EFalse;
}
else
{
return ETrue;
}
}
else
{
if ( 0 == aBuffer.Size() )
{
return EFalse;
}
}
TStreamDecoder decoder;
decoder.Initialize( aFrameToCmp.iFrameData, 0, aFrameToCmp.iBitIndex );
TInt octetsToCmp = aOctetsToCmp < aBuffer.Size() ? aOctetsToCmp : aBuffer.Size();
for ( TInt i = 0; i < octetsToCmp && isSame; i++ )
{
TUint8 val = TUint8( decoder.Decode( KBitsIn1Byte ) );
if ( aBuffer[i] != val )
{
isSame = EFalse;
}
}
return isSame;
}
示例14: asciiToHex
void XQAccessPointManagerPrivate::asciiToHex(const TDesC8& aSource,
HBufC8*& aDest)
{
_LIT(hex, "0123456789ABCDEF");
TInt size = aSource.Size();
TPtr8 ptr = aDest->Des();
for (TInt ii = 0; ii < size; ii++) {
TText8 ch = aSource[ii];
ptr.Append( hex()[(ch/16)&0x0f] );
ptr.Append( hex()[ch&0x0f] );
}
}
示例15: ConstructL
// -----------------------------------------------------------------------------
// CRemConKeyEvent::ConstructL
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CRemConKeyEvent::ConstructL( const TRemConKeyEventData& aKeyEvent,
const TUid& aInterfaceUID,
const TUint& aOperationID,
TDesC8& aParameter )
{
COM_TRACE_2( "[AccFW:RemConConverter] CRemConKeyEvent::ConstructL( %d, %d )", aKeyEvent, aOperationID );
iKeyEvent = aKeyEvent;
iInterfaceUID = aInterfaceUID;
iOperationID = aOperationID;
iParameter = HBufC8::NewL( aParameter.Size() );
iParameter->Des().Copy( aParameter );
}