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


C++ CFileReader::ReadBlockL方法代码示例

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


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

示例1: doTestStepL


//.........这里部分代码省略.........
						{
						// block size is in bits so to allocate the correct number of bytes divide by 8
						// iv is left on the cleanup stack for the duration of the test and deleted in a conditional at the end of the outer block.
						// If this conditional block changes, take care to update the condition for deleting this allocated IV, near the end of this function.
						iv = HBufC8::NewLC(blockSize/8);	
						
						// blocksize is in bits so to allocate the correct number of 8 byte chunks divide by 64
						for(TInt i = 0 ; i <blockSize/64 ; i++)
						{
							iv->Des().Append(_L8("12345678"));
						}
		
						TRAP_LOG(err,impl->SetIvL(iv->Des())); 
						}
					
					// convert to bytesize
					blockSize/=8;
					blockSize += iOffset;
					
					//read from src file
					CFileReader* srcData = CFileReader::NewLC(srcPath,blockSize);
					
					// first step is to read from the src file one block
					// at a time, encrypt that block and then write
					// the encrypted block out to a temporary file.
					CFileWriter* encryptedDataWriter = CFileWriter::NewLC(TPtrC(KTempEncryptedFilePath));
					
					TInt numBlocks = srcData->NumBlocks();
					
					INFO_PRINTF1(_L("Starting Incremental Encryption..."));
					
					for(TInt i = 1 ; i <= numBlocks ; i++)
						{
						TRAP_LOG(err,srcData->ReadBlockL());
					
						//Create buffer for encrypted data
						TInt maxOutputLength = impl->MaxFinalOutputLength(TPtrC8(*srcData).Length());
						HBufC8* encrypted =	HBufC8::NewLC(maxOutputLength);
						TPtr8 encryptedPtr = encrypted->Des();
					
						if(i == numBlocks)
							{
							TRAP(err,impl->ProcessFinalL(*srcData, encryptedPtr));
							
							if(err != KErrNone)
								{
								ERR_PRINTF3(_L("*** ERROR:%d - ProcessFinalL() Block=%d ***"),err,i);
								User::Leave(err);	
								}
							}
						else
							{
							TRAP(err,impl->ProcessL(*srcData, encryptedPtr));
							
							if(err != KErrNone)
								{
								ERR_PRINTF3(_L("*** ERROR:%d - ProcessL() Block=%d ***"),err,i);
								User::Leave(err);	
								}
							}	
						
						TRAP_LOG(err,encryptedDataWriter->WriteBlockL(encryptedPtr));
					
						CleanupStack::PopAndDestroy(encrypted); 
						}
						
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:66,代码来源:symmetriccipherobjectreusestep.cpp


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