本文整理汇总了C++中TBuf::Alloc方法的典型用法代码示例。如果您正苦于以下问题:C++ TBuf::Alloc方法的具体用法?C++ TBuf::Alloc怎么用?C++ TBuf::Alloc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBuf
的用法示例。
在下文中一共展示了TBuf::Alloc方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LogErrorAndLeave
// ---------------------------------------------------------
// CPosTp17::StartL
//
// (other items were commented in a header).
// ---------------------------------------------------------
//
void CPosTp17::StartL()
{
#ifdef __WINS__
_LIT(KNotSupported, "Test case is not supported on WINS, exucute it on target!");
LogErrorAndLeave(KNotSupported);
#else
_LIT(KErrors, "One or several Dll's have an incorrect size");
SetupTestDataL();
RFs session;
User::LeaveIfError(session.Connect());
CleanupClosePushL(session);
RFile file;
TBuf<1> drive= _L("c");
TBuf<KMaxDllFileNameLength> name;
name.Copy(iDllNames[0]);
name.Replace(0,1,drive);
if (file.Open(session, name, EFileRead) != KErrNone)
{
iLog->Put(_L("(Flashed) Use Drive Z:"));
drive.Copy(_L("z"));
}
else iLog->Put(_L("(Nonflashed) Use Drive C:"));
file.Close();
TBool errors=EFalse;
for (TInt i=0; i<iDllNames.Count(); i++)
{
name.Copy(iDllNames[i]);
name.Replace(0,1,drive);
//User::LeaveIfError(file.Open(session, name, EFileRead));
TInt err = file.Open(session, name, EFileRead);
if (err != KErrNone)
{
TBuf<70> buffe;
buffe.Append(_L("Error when opening file "));
buffe.Append(name);
LogErrorAndLeave(buffe, err);
}
CleanupClosePushL(file);
TInt fileSize=0;
file.Size(fileSize);
if (fileSize > iFootprints[i])
{
errors = ETrue;
_LIT(KDllSizeErr, "ERROR: %S is to big (%d), Max allowed ROM footprint is %d");
TBuf<255> info;
HBufC* temp = name.Alloc();
info.Format(KDllSizeErr, temp, fileSize, iFootprints[i]);
delete temp;
iLog->Put(info);
}
else
{
// Always log .dll size
_LIT(KDllSizeDebug, "%S is (%d), Max allowed ROM footprint is %d");
TBuf<255> info;
HBufC* temp = name.Alloc();
info.Format(KDllSizeDebug, temp, fileSize, iFootprints[i]);
delete temp;
iLog->Put(info);
}
CleanupStack::PopAndDestroy(&file);
}
CleanupStack::PopAndDestroy(&session);
if (errors)
{
LogErrorAndLeave(KErrors);
}
#endif
}