当前位置: 首页>>代码示例>>C++>>正文


C++ TPtr8::Fill方法代码示例

本文整理汇总了C++中TPtr8::Fill方法的典型用法代码示例。如果您正苦于以下问题:C++ TPtr8::Fill方法的具体用法?C++ TPtr8::Fill怎么用?C++ TPtr8::Fill使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TPtr8的用法示例。


在下文中一共展示了TPtr8::Fill方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: Send

TInt RIpcFuzzTest::Fuzz8L(TInt aMsg, TInt aArgCount)
	{
	HBufC8* buf = HBufC8::NewLC(255);
	TPtr8 ptr = buf->Des();
	ptr.Fill(Math::Random(),255);
	
	TIpcArgs args;
	
	for(TInt i = 0; i < aArgCount;i++)
		{
		args.Set(i,&ptr);
		}
	
	TInt ret;
	
	if(IsFunctionAsynchronous(aMsg))
		{
		ret = Send(aMsg, args);
		User::After(KAsynchDelay);
		}
	else
		{
		ret = SendReceive(aMsg, args);
		}

	CleanupStack::PopAndDestroy(buf);
	return ret;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:28,代码来源:t_logservIPC.cpp

示例2: WriteOomTest

/**
@SYMTestCaseID			PDS-SQL-UT-4207
@SYMTestCaseDesc		RFileBuf64::Write() OOM test.
						The test calls RFileBuf64:Write() in an OOM
						simulation loop and verifies that no memory is leaked.
						The test also check that RFileBuf::DoSetCapacity() correctly operates in
						"out of memory" situation.
@SYMTestActions			RFileBuf64::Write() OOM test.
@SYMTestExpectedResults Test must not fail
@SYMTestPriority		High
@SYMDEF					380056
*/
void WriteOomTest()
	{
	HBufC8* databuf = HBufC8::New(KPageSize);
	TEST(databuf != NULL);
	TPtr8 dataptr = databuf->Des();
	dataptr.SetLength(KPageSize);
	dataptr.Fill(TChar(KChar));
	
	TInt err = KErrNoMemory;
	TInt failingAllocationNo = 0;
	TheTest.Printf(_L("Iteration:\r\n"));
	while(err == KErrNoMemory)
		{
		TheTest.Printf(_L(" %d"), ++failingAllocationNo);

		(void)TheFs.Delete(KTestFile);
		
		MarkHandles();
		MarkAllocatedCells();
		
		__UHEAP_MARK;
		__UHEAP_SETBURSTFAIL(RAllocator::EBurstFailNext, failingAllocationNo, KBurstRate);

		const TInt KDefaultBufCapacity = 1024;
		RFileBuf64 fbuf(KDefaultBufCapacity);
		err = fbuf.Create(TheFs, KTestFile, EFileWrite | EFileRead);
		if(err == KErrNone)
			{
			err = fbuf.Write(0LL, dataptr);
			}
		fbuf.Close();
		
		__UHEAP_RESET;
		__UHEAP_MARKEND;

		CheckAllocatedCells();
		CheckHandles();
		}
	TEST2(err, KErrNone);
	RFile64 file;
	err = file.Open(TheFs, KTestFile, EFileRead);
	TEST2(err, KErrNone);
	dataptr.Zero();
	err = file.Read(dataptr);
	TEST2(err, KErrNone);
	file.Close();
	TEST2(dataptr.Length(), KPageSize);
	for(TInt i=0;i<KPageSize;++i)
		{
		TEST(dataptr[i] == KChar);
		}
	TheTest.Printf(_L("\r\n=== OOM Test succeeded at heap failure rate of %d ===\r\n"), failingAllocationNo);
	
	//The file is left undeleted - to be used in ReadOomTest().
	delete databuf;
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:68,代码来源:t_sqlfilebuf64.cpp

示例3: RunTestL

void RIpcServerCloseTest::RunTestL(const TDesC& aTargetSrvName, TInt aNumber, TInt aArgCount)
	{
	TVersion version(0,0,0);
	TInt err = KErrNotFound;
	TInt numberOfAttempts = 3;
	
	while(err!=KErrNone && numberOfAttempts>0)
		{
		err = CreateSession(aTargetSrvName, version, 200);

		if(err!=KErrNone)
			{
			// wait then try again if err!=0
			TheTest.Printf(_L("CreateSession returned: %d"), err);
			User::After(1000000);
			numberOfAttempts--;
			}
		}
	
	TheTest(err == KErrNone);
	
	HBufC8* buf = HBufC8::NewLC(255);
	TPtr8 ptr = buf->Des();
	ptr.Fill(Math::Random(),255);
		
	TIpcArgs args;
		
	for(TInt i = 0; i < aArgCount ;i++)
		{
		args.Set(i,&ptr);
		}
	
	TheTest.Printf(_L("Sending request to: %d with %d args"), aNumber, aArgCount);
	
	TRequestStatus status;
	
	SendReceive(aNumber, args, status);
	
	User::WaitForRequest(status);
	
	TheTest.Printf(_L("Status value from sending request: %d with %d args"), status.Int(), aArgCount);
	
	TheTest(status.Int() == KErrNotSupported);

	CleanupStack::PopAndDestroy(buf);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:46,代码来源:T_BaflDefect.cpp


注:本文中的TPtr8::Fill方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。