コード例 #1
0
/**
 * @internalTechnology
 * Writes DER-encoded bit string contents to aBuf. Prepends
 * the actual bit string octets with extra octet containing
 * number of unused bits in the last octet. Before writing,
 * converts contents of the bit string to big-endian form.
 * @param aBuf Buffer to write to; must be long enough;
 *     see #CalculateContentsLengthDER method.
 */
void CASN1EncBitString::WriteContentsDERL(TDes8& aBuf) const
{
    if (iContents->Length() > 0)
    {
        aBuf[0] = iPadding;
        TUint len = iContents->Length();
        // We do not need to swap bits, as it is already done.
        aBuf.Replace(1, len, *iContents);
    }
    else
    {
        // no padding octet for the empty bit string
        aBuf.SetLength(0);
    }
}
コード例 #2
0
ファイル: client.cpp プロジェクト: cdaffara/symbiandump-os2
void RTestExecuteLogServ::WriteL(TDes8& aLogBuffer)
/**
 * @param aLogBuffer - pre-formatted narrow buffer
 * 
 * Synchronous write to the server
 */
	{
	_LIT8(KEnd,"\r\n");
	// Check to see if there's room to add CRLF
	if(aLogBuffer.Length()+2 > aLogBuffer.MaxLength())
		{
		HBufC8* buffer = NULL;
		TRAPD(err, buffer=HBufC8::NewL(aLogBuffer.Length()+2));
		if (KErrNoMemory == err)
			{
			aLogBuffer.Replace(aLogBuffer.Length()-2, 2, KEnd);
			TIpcArgs args;
			args.Set(0,&aLogBuffer);
			args.Set(1,aLogBuffer.Length());
			User::LeaveIfError(SendReceive(EWriteLog,args));
			}
		else
			{
			CleanupStack::PushL(buffer);
			TPtr8 ptr(buffer->Des());
			ptr.Copy(aLogBuffer);
			ptr.Append(KEnd);
			TIpcArgs args;
			args.Set(0,&ptr);
			args.Set(1,ptr.Length());
			User::LeaveIfError(SendReceive(EWriteLog,args));
			CleanupStack::PopAndDestroy(buffer);
			}
		}
	else
		{
		aLogBuffer.Append(KEnd);
		TIpcArgs args;
		args.Set(0,&aLogBuffer);
		args.Set(1,aLogBuffer.Length());
		User::LeaveIfError(SendReceive(EWriteLog,args));
		}
	}
コード例 #3
0
ファイル: EcmtMMCEvent.cpp プロジェクト: fedor4ever/packaging
// -----------------------------------------------------------------------------
// CEcmtMMCEvent::WinsRemovableDrivesL
// Public method to get descrpitor containing removable drives
// -----------------------------------------------------------------------------
//
void CEcmtMMCEvent::WinsRemovableDrivesL( TDes8& aBuff )
	{
	//update list to get number of drives up to date
	iWinsRemDrives->UpdateRemDrives();
	//allocate space for drive letters string
	char* drives = new char[sizeof(char)* 3* iWinsRemDrives->NumOfDrives()+1];
	User::LeaveIfNull( drives );
	//get letters
	iWinsRemDrives->GetRemovableDrives( drives );
	const TPtrC8 iWinsDrives( (const TUint8*) drives, (TInt) strlen(drives) );
	aBuff.Copy( iWinsDrives );
	//remove / from string
	TChar ch('\\');
	TInt pos=aBuff.Locate( ch );
	while ( pos != KErrNotFound )
	{
		aBuff.Replace( pos, 1, KBlank );
		pos=aBuff.Locate( ch );
	}
		
	delete [] drives;
	}