本文整理汇总了C++中TBuf8::FillZ方法的典型用法代码示例。如果您正苦于以下问题:C++ TBuf8::FillZ方法的具体用法?C++ TBuf8::FillZ怎么用?C++ TBuf8::FillZ使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TBuf8
的用法示例。
在下文中一共展示了TBuf8::FillZ方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddBrowseGroupRecord
void AddBrowseGroupRecord(CSdpDatabase& aDb, TUUID aBrowseUUID)
{
CSdpServRecord* theRec = aDb.NewRecordL();
TBuf8<2> attrId;
TBuf8<4> val;
attrId.FillZ(2);
val.FillZ(4);
// Set Attr 1 (service class list) to list with One UUID = 0x1001
attrId[0] = 0x00;
attrId[1] = 0x01;
theRec->BuildUintL(attrId)->BuildDESL()
->StartListL()
->BuildUUIDL(TUUID(TUint16(KBrowseGroupDescriptorServiceClassUUID))) // BrowseGroup(DescriptorList)
->EndListL();
// Set Attr 0x005 (browse group list) to public root
attrId[0] = 0x00;
attrId[1] = 0x05;
theRec->BuildUintL(attrId)->BuildDESL()
->StartListL()
->BuildUUIDL(TUUID(TUint16(0x1002))) // publicBrowseRoot
->EndListL();
// Set Attr 0x200 (default Name) to string
attrId[1] = 0x00;
attrId[0] = 0x02;
theRec->BuildUintL(attrId)->BuildUUIDL(aBrowseUUID);
}
示例2: AddBrowsableRecord
void AddBrowsableRecord(CSdpDatabase& aDb, TUUID aBrowseUUID)
{
CSdpServRecord* theRec = aDb.NewRecordL();
TBuf8<2> attrId;
TBuf8<4> val;
attrId.FillZ(2);
val.FillZ(4);
// Set Attr 1 (service class list) to list with UUID = 0x1108
attrId[0] = 0x00;
attrId[1] = 0x01;
theRec->BuildUintL(attrId)->BuildDESL()
->StartListL()
->BuildUUIDL(TUUID(0x1108))
->EndListL();
// Set Attr 0x005 (browse group list) to public root
attrId[0] = 0x00;
attrId[1] = 0x05;
theRec->BuildUintL(attrId)->BuildDESL()
->StartListL()
->BuildUUIDL(aBrowseUUID) // publicBrowseRoot
->EndListL();
}
示例3: ZeroFillBlock
TInt CSuspendTest::ZeroFillBlock( TInt aBlockNumber )
//
// Zero-fills and entire block
// The requires that writing works
//
{
test.Printf( _L("Zero-filling block %d\n"), aBlockNumber );
//
// Create a buffer full of zeros
//
const TInt KZeroBufSize = 512;
TBuf8<KZeroBufSize> buf;
buf.FillZ( buf.MaxLength() );
//
// Write the data out to the Flash
//
TInt writeCount = iBlockSize / KZeroBufSize;
TInt r = KErrNone;
TUint blockBaseOffset = aBlockNumber * iBlockSize;
TInt pos = blockBaseOffset;
for( ; (writeCount > 0) && (KErrNone == r); writeCount-- )
{
r = iDrive.Write( pos, buf );
if( r != KErrNone )
{
test.Printf( _L("... FAIL: write failed (%d) at offset 0x%x\n"), pos );
}
pos += KZeroBufSize;
}
return r;
}
示例4: strcpy
OMX_ERRORTYPE
CBellagioOpenMaxSymbianLoader::ComponentNameEnum(OMX_STRING cComponentName,
OMX_U32 nNameLength,
OMX_U32 nIndex)
{
TInt count = 0;
count = componentInfos.Count();
if (count < 1)
{
return OMX_ErrorComponentNotFound;
}
if (nIndex > (count - 1))
{
return OMX_ErrorNoMore;
}
TBuf8<257> name;
name.FillZ();
name.Zero();
CnvUtfConverter::ConvertFromUnicodeToUtf8(name, (componentInfos[nIndex])->DisplayName());
name.ZeroTerminate();
if (nNameLength < name.Length() - 1)
{
return OMX_ErrorUndefined;
}
strcpy((char*)cComponentName, (char*)name.Ptr());
return OMX_ErrorNone;
}
示例5: TestRemovedMethods
void TestRemovedMethods()
//
// Test deprecated but exported methods
//
{
test.Start(_L("Test removed methods of RNotifier class"));
// connect to server
RNotifier n;
TInt r = n.Connect();
test(r==KErrNone);
test.Next(_L("StartNotifierAndGetResponse (5-params with dllUid)"));
TBuf8<128> response;
response.SetMax();
response.FillZ();
response.Zero();
TRequestStatus stat;
n.StartNotifierAndGetResponse(stat,KUidTestTextNotifier1,KUidTestTextNotifier2,*&KStartData,response);
User::WaitForRequest(stat);
test(stat==KErrNotSupported);
test.Next(_L("StartNotifier (4-params with dllUid)"));
test(n.StartNotifier(KUidTestTextNotifier2,KUidTestTextNotifier1,*&KStartData,response)==KErrNotSupported);
test.Next(_L("Test removed method LoadNotifiers()"));
test(n.LoadNotifiers(KUidTestTextNotifier1)==KErrNotSupported);
test.Next(_L("Test removed method UnloadNotifiers()"));
test(n.UnloadNotifiers(KUidTestTextNotifier1)==KErrNotSupported);
test.Next(_L("Close connection to notifier server"));
n.Close();
test.End();
}
示例6: SaveServicePropValue
EXPORT_C TMTPResponseCode MMTPServiceHandler::SaveServicePropValue(
CRepository& aRepository, TUint aColumnNum, TMTPTypeGuid& aNewData)
{
TInt ret;
TMTPResponseCode responseCode = EMTPRespCodeOK;
TBuf8<KMTPTypeINT128Size> data;
data.FillZ(data.MaxLength());
TUint64 upperValue = aNewData.UpperValue();
TUint64 lowerValue = aNewData.LowerValue();
/**
Least significant 64-bit buffer offset.
*/
const TInt KMTPTypeUint128OffsetLS = 0;
/**
Most significant 64-bit buffer offset.
*/
const TInt KMTPTypeUint128OffsetMS = 8;
memcpy(&data[KMTPTypeUint128OffsetMS], &upperValue, sizeof(upperValue));
memcpy(&data[KMTPTypeUint128OffsetLS], &lowerValue, sizeof(lowerValue));
ret = aRepository.Set(aColumnNum, data);
if (KErrNone != ret)
{
responseCode = EMTPRespCodeGeneralError;
}
return responseCode;
}
示例7: DoMemoryLeakTests
void DoMemoryLeakTests(TUid aUid,TBool aCheckMNotifierManager)
{
TInt r;
TRequestStatus stat;
test.Start(_L("Connect to notifier server"));
RNotifier n;
r = n.Connect();
test(r==KErrNone);
test.Next(_L("Get Notifier Server Heap Info"));
static TBuf8<128> heapInfo1;
heapInfo1.Zero();
n.StartNotifierAndGetResponse(stat,aUid,KHeapData,heapInfo1);
User::WaitForRequest(stat);
n.CancelNotifier(aUid);
TInt heapCellCount=stat.Int();
test(heapCellCount>0);
test.Next(_L("Repeated StartNotifierAndGetResponse"));
for(TInt i=0; i<1000; i++)
{
TBuf8<128> response;
response.SetMax();
response.FillZ();
response.Zero();
n.StartNotifierAndGetResponse(stat,aUid,aCheckMNotifierManager?*&KMNotifierManager:*&KStartData,response);
User::WaitForRequest(stat);
n.CancelNotifier(aUid);
test(stat==KErrNone);
test(response==KResponseData);
}
test.Next(_L("Check Notifier Server Heap Info"));
static TBuf8<128> heapInfo2;
heapInfo2.Zero();
n.StartNotifierAndGetResponse(stat,aUid,KHeapData,heapInfo2);
User::WaitForRequest(stat);
n.CancelNotifier(aUid);
test(stat==heapCellCount);
TInt size1, size2;
TLex8 lex(heapInfo1);
r = lex.Val(size1);
test(r==KErrNone);
lex.Assign(heapInfo2);
r = lex.Val(size2);
test(r==KErrNone);
//allocated size after should not be greater than before BUT may be less with new allocator
test(size2 <= size1);
test.Next(_L("Close connection to notifier server"));
n.Close();
test.End();
}
示例8: CreateManyLargFiles
static void CreateManyLargFiles(TInt aNumber)
//
// Make a directory with aNumber entries
//
{
RFile64 f;
TInt maxEntry=aNumber;
test.Printf(_L("Create a directory with %d entries\n"),aNumber);
TFileName sessionPath;
TInt r=TheFs.SessionPath(sessionPath);
test_KErrNone(r);
r=TheFs.MkDir(_L("\\F32-TST\\"));
test((r==KErrNone)||(r==KErrAlreadyExists));
r=TheFs.MkDir(_L("\\F32-TST\\BENCH_DELETE\\"));
test((r==KErrNone)||(r==KErrAlreadyExists));
TBuf8<8> WriteData =_L8("Wibbleuy");
for (TInt i=0; i<maxEntry; i++)
{
TFileName baseName=_L("\\F32-TST\\BENCH_DELETE\\FILE");
baseName.AppendNum(i);
r=f.Replace(TheFs,baseName,EFileWrite);
test_KErrNone(r);
r = f.SetSize(K3GB);
test_KErrNone(r);
r=f.Write((K3GB-30),WriteData);
test_KErrNone(r);
f.Flush();
f.Close();
}
test.Printf(_L("Test all entries have been created successfully\n"));
TBuf8<8> ReadData;
TInt64 Size=0;
for (TInt j=0; j<=maxEntry; j++)
{
TFileName baseName=_L("\\F32-TST\\BENCH_DELETE\\FILE");
baseName.AppendNum(j);
TInt r=f.Open(TheFs,baseName,EFileRead);
if (r!=KErrNone)
{
test_Value(r, r == KErrNotFound && j==maxEntry);
return;
}
ReadData.FillZ();
r=f.Read((K3GB-30),ReadData);
test_KErrNone(r);
test(f.Size(Size)==KErrNone);
test(K3GB == Size);
test(ReadData==WriteData);
f.Close();
}
}
示例9: DoCleanumpTests
void DoCleanumpTests(TUid aUid,TBool aCheckMNotifierManager)
{
TInt r;
test.Start(_L("Connect to notifier server"));
RNotifier n;
r = n.Connect();
test(r==KErrNone);
test.Next(_L("StartNotifierAndGetResponse"));
TBuf8<128> response;
response.SetMax();
response.FillZ();
response.Zero();
TRequestStatus stat;
n.StartNotifierAndGetResponse(stat,aUid,aCheckMNotifierManager?*&KMNotifierManager:*&KStartData,response);
User::WaitForRequest(stat);
test(stat==KErrNone);
test(response==KResponseData);
test.Next(_L("Close connection to notifier server"));
n.Close();
test.Next(_L("Connect to notifier server"));
r = n.Connect();
test(r==KErrNone);
test.Next(_L("StartNotifierAndGetResponse (to check previous notifier was cancelled)"));
response.SetMax();
response.FillZ();
response.Zero();
n.StartNotifierAndGetResponse(stat,aUid,aCheckMNotifierManager?*&KMNotifierManagerWithCancelCheck:*&KStartWithCancelCheckData,response);
User::WaitForRequest(stat);
test(stat==KTestNotifierWasPreviouselyCanceled);
test(response==KResponseData);
test.Next(_L("Close connection to notifier server"));
n.Close();
test.End();
}
示例10:
TInt CFloggerTest017_02::DoTestCheckWriteL()
{
User::After(KTimeToLog);
RFile theFile;
HBufC8 * hBuffer;
TInt listfilesize;
TInt returnCode;
RFs fileSystem; //For file operation create a file system
TBuf8<256> testData; //To hold the test descriptor
_LIT(KLogFile,"c:\\logs\\log.txt"); // the log file path
_LIT8(KOOMError, "#Logs may be lost out of memory!!"); // Error message
User::LeaveIfError(fileSystem.Connect());
//Open the file in the read mode
User::LeaveIfError(theFile.Open(fileSystem,KLogFile,EFileRead));
CleanupClosePushL(theFile);
User::LeaveIfError(returnCode = theFile.Size(listfilesize)); //Size of the file
hBuffer = HBufC8::New(listfilesize); //Allocate the buffer
CleanupStack::PushL(hBuffer);
TPtr8 ptrString = hBuffer->Des(); ; //To hold the buffer
// Read from position 0: start of file
returnCode = theFile.Read(ptrString);
testData.FillZ();
testData.Copy(KEightSpaces8); //Copy the test descriptor
returnCode = ptrString.Find(testData); //find the test descriptor in the buffer read
//from the file
if (returnCode == KErrNotFound) // Check for the error message in the log
{
returnCode = ptrString.Find(KOOMError);
if (returnCode > 0)
User::Leave(KErrNoMemory);
}
CleanupStack::PopAndDestroy(hBuffer);
CleanupStack::PopAndDestroy(); //theFile
if (returnCode > 0)
return KErrNone;
else
return KErrGeneral;
}
示例11: TestCliServDataParam3L
/**
@SYMTestCaseID SYSLIB-LOGENG-LEGACY-T_LOGSERVIPC-0002
@SYMTestCaseDesc Tests Message schema validation for the messages accepting
TLogClientServerData parameters.
@SYMTestPriority High
@SYMTestActions Sends messages to the test server to test the validation of messages
against the message schema. The messages contain either valid or invalid
parameters.
@SYMTestExpectedResults The server should validate the message and handle bad messages appropriately
@SYMDEF INC114113
*/
void TestCliServDataParam3L()
{
RClientMessageTestSession session;
TInt err = session.Connect();
TEST2(err, KErrNone);
CleanupClosePushL(session);
TBuf8<sizeof(TLogClientServerData) + 1> buf;
buf.FillZ();
err = session.TestCliServDataParam(ELogOperationInitiate,buf);
TEST2(err, KErrArgument);
CleanupStack::PopAndDestroy(&session);
}
示例12: TestCliServDataParam2L
/**
@SYMTestCaseID SYSLIB-LOGENG-LEGACY-T_LOGSERVIPC-0001
@SYMTestCaseDesc Tests Message schema validation for the messages accepting
TLogClientServerData parameters.
@SYMTestPriority High
@SYMTestActions Sends messages to the test server to test the validation of messages
against the message schema. The messages contain either valid or invalid
parameters.
@SYMTestExpectedResults The server should validate the message and handle bad messages appropriately
@SYMDEF INC114113
*/
void TestCliServDataParam2L()
{
RClientMessageTestSession session;
TInt err = session.Connect();
TEST2(err, KErrNone);
CleanupClosePushL(session);
TBuf8<sizeof(TLogClientServerData) - 1> buf;
buf.FillZ();
//This should panic with Logserv 63
err = session.TestCliServDataParam(ELogOperationInitiate,buf);
TEST2(err, KErrNone);
CleanupStack::PopAndDestroy(&session);
}
示例13: DecodeL
void TScsiClientInquiryResp::DecodeL(const TDesC8& aPtr)
{
__MSFNSLOG
__SCSIPRINT(_L("--> SCSI INQUIRY"));
if (aPtr.Length() < KResponseLength)
{
// Handle short data.
// The data not transferred is assumed to be zero.
// Create zeroed buffer
TBuf8<KResponseLength> buffer;
buffer.FillZ(KResponseLength);
// Copy data into buffer
buffer = aPtr;
buffer.SetLength(KResponseLength);
DecodeInquiry(buffer);
}
else
{
DecodeInquiry(aPtr);
}
}
示例14: RegWithSDPDatabaseL
//Register it in the SDP database - determine attribs, construct the record and then add attribs to new record
TInt CStatTransportBT::RegWithSDPDatabaseL( void )
{
asserte( iBTTransportStatus == EConnectingRegisterMgr );
//Connect and open to the session and the DB
//User::LeaveIfError( iSdpSession.Connect() );
TInt ret2;
ret2 = iSdpSession.Connect();
if(ret2!=KErrNone)
{
User::Leave(ret2);
}
User::LeaveIfError( iSdpDatabaseSession.Open( iSdpSession ) );
TBuf8<STANDARDBUFVALUE> value1;
TBuf8<STANDARDBUFVALUE> value2;
CSdpAttrValue* attrVal = 0;
CSdpAttrValueDES* attrValDES = 0;
//initialise
value1.FillZ(STANDARDBUFVALUE);
value2.FillZ(STANDARDBUFVALUE);
// Set Attr 1 (service class list) to list with UUID = 0x1101 (serial port)
iSdpDatabaseSession.CreateServiceRecordL(TUUID(0x1101), iRecHandle);
// Set Service name
iSdpDatabaseSession.UpdateAttributeL(iRecHandle, KSdpAttrIdBasePrimaryLanguage +
KSdpAttrIdOffsetServiceName,
_L("STATAPI") );
// Set Service description
iSdpDatabaseSession.UpdateAttributeL(iRecHandle, KSdpAttrIdBasePrimaryLanguage +
KSdpAttrIdOffsetServiceDescription,
_L("Symbian Test Automation Tool using Serial BT") );
attrVal = CSdpAttrValueString::NewStringL( _L8( "Test Solutions Dept Symbian Ltd." ) );
CleanupStack::PushL(attrVal);
iSdpDatabaseSession.UpdateAttributeL(iRecHandle, KSdpAttrIdBasePrimaryLanguage +
KSdpAttrIdOffsetProviderName, *attrVal);
CleanupStack::PopAndDestroy(); //attrVal
attrVal = 0;
// Set Attr 2 (service record state) to 0
attrVal = CSdpAttrValueUint::NewUintL(value1);
CleanupStack::PushL(attrVal);
iSdpDatabaseSession.UpdateAttributeL(iRecHandle, KSdpAttrIdServiceRecordState, *attrVal);
CleanupStack::PopAndDestroy(); //attrVal
attrVal = 0;
// Set attr 4 (protocol list) to RFCOMM
//initialise
TBuf8<1> serverChannel;
serverChannel.FillZ(1);
serverChannel[0] = (unsigned char)iPort;
attrValDES = CSdpAttrValueDES::NewDESL(0);
CleanupStack::PushL(attrValDES);
attrValDES->StartListL()
->BuildDESL()->StartListL()
->BuildUUIDL( TUUID( TUint16( 0x0003 ) ) ) // RFCOMM
->BuildUintL( serverChannel ) //Channel ID = 3 (listening port)
->EndListL()
->EndListL();
//update attr 4
iSdpDatabaseSession.UpdateAttributeL(iRecHandle, KSdpAttrIdProtocolDescriptorList, *attrValDES);
CleanupStack::PopAndDestroy(); //attrValDES
attrValDES = 0;
// Set Attr 5 (browse group list) to list with one UUID
// 0x1101 (serial port class)
// this should be updated with other service classes when other services are added.
attrValDES = CSdpAttrValueDES::NewDESL(0);
CleanupStack::PushL(attrValDES);
attrValDES->StartListL()
->BuildUUIDL( TUUID( 0x1002 ) )
->EndListL();
iSdpDatabaseSession.UpdateAttributeL(iRecHandle, KSdpAttrIdBrowseGroupList, *attrValDES);
CleanupStack::PopAndDestroy();
attrValDES = 0;
// Set Attr 0x006 (language base)
value1.FillZ(4);
value1[2] = 0x65;
value1[3] = 0x6e;
TBuf8<STANDARDBUFVALUE> val2;
TBuf8<STANDARDBUFVALUE> val3;
val2.FillZ(STANDARDBUFVALUE);
val3.FillZ(STANDARDBUFVALUE);
val2[3] = 0x6a;
val3[2] = 0x01;
//.........这里部分代码省略.........
示例15: BuildPrequalDbL
CSdpDatabase* BuildPrequalDbL()
{
CSdpDatabase* theDb = CSdpDatabase::NewL();
TInt i;
TBuf8<2> attrId;
TBuf8<4> val;
TBuf8<2> val1;
CSdpServRecord* theRec = theDb->NewRecordL();
// all attribute IDs are BIG ENDian
// Prequal Dummy Service Record. Designed to respond to SA tests -
// where, it seems, the initial service search is done using UUIDs 1101 and 0011.
// This record will have a value for each attribute so it
// can be used for the attribute queries.
attrId.FillZ(2);
val.FillZ(4);
val1.FillZ(2);
// Set Attr 1 (service class list) to list with UUID = 0x1108
attrId[0] = 0x00;
attrId[1] = 0x01;
MSdpElementBuilder* bdr;
bdr = theRec->BuildUintL(attrId)->BuildDESL()
->StartListL()
->BuildUUIDL(TUUID(0x0011))
->BuildUUIDL(TUUID(KDialUpNetworkingUUID));
//TUint16 x = 0x1201;
//while(x<0x120a)
// bdr->BuildUUIDL(TUUID(x++));
bdr->EndListL();
// Set Attr 2 (service record state) to 0.
val.FillZ(4);
attrId[0] = 0x00;
attrId[1] = 0x02;
val[0] = 0xdd;
val[1] = 0xdd;
val[2] = 0xdd;
val[3] = 0xcd;
theRec->BuildUintL(attrId)->BuildUintL(val);
// Set attr 3 (service id) to 0x0001
attrId[0] = 0x00;
attrId[1] = 0x03;
theRec->BuildUintL(attrId)
->BuildUUIDL(TUUID(0xeeee));
// Set attr 4 (protocol list) to L2CAP, RFCOMM (DLCI=1), no OBEX
attrId[0] = 0x00;
attrId[1] = 0x04;
val1.FillZ(2);
val1[1] = 1;
theRec->BuildUintL(attrId)->BuildDESL()
->StartListL()
->BuildDESL()
->StartListL()
->BuildUUIDL(TUUID(TUint16(0x0001)))
->EndListL()
->BuildDESL()
->StartListL()
->BuildUUIDL(TUUID(TUint16(0x0100))) // L2CAP
->EndListL()
->BuildDESL()
->StartListL()
->BuildUUIDL(TUUID(TUint16(0x0003))) // RFCOMM
->BuildUintL(TSdpIntBuf<TUint8>(1)) // DLCI = 1
->EndListL()
->EndListL();
// Set Attr 0x005 (browse group list) to public root
attrId[0] = 0x00;
attrId[1] = 0x05;
theRec->BuildUintL(attrId)->BuildDESL()
->StartListL()
->BuildUUIDL(TUUID(TUint16(0x1002))) // publicBrowseRoot
->EndListL();
// Set Attr 0x006 (language base)
attrId[0] = 0x00;
attrId[1] = 0x06;
val.FillZ(2);
//val.SetLength(2);
val[0] = 0x65;
val[1] = 0x6e;
TBuf8<2> val2;
TBuf8<2> val3;
val2.FillZ(2);
val3.FillZ(2);
val2[1] = 0x6a;
val3[0] = 0x01;
theRec->BuildUintL(attrId)->BuildDESL()
->StartListL()
->BuildUintL(val) // english
->BuildUintL(val2) // UTF-8
->BuildUintL(val3) // language base
->EndListL();
//.........这里部分代码省略.........