void dump_tbufc_content_desandcontent_address_len_size(TBufC<16> &aBufC) { // Look at: // 1. Descriptor content // 2. Address of descriptor // 3. Address of descriptor data area // 4. Length of descriptor // 5. Size of descriptor // // Address of descriptor data area is // different from the address of cstr but // is offset 4 from the start of the // descriptor itself. // // Descriptor length is 12. // // The template parameter value defines // the length of the descriptor data area // and, therefore, governs its size // (depending on the build variant). // Size of data is 24 console->Printf(KContentFormat, &aBufC); console->Printf(KDesAndContentAddressFormat, &aBufC, aBufC.Ptr()); _LIT(KFormat4, "Length()=%d; Size()=%d\n"); console->Printf(KFormat4, aBufC.Length(), aBufC.Size()); }
// ----------------------------------------------------------------------------- // CTestSDKEditors::TestSEBufferL // ----------------------------------------------------------------------------- // TInt CTestSDKEditors::TestSEBufferL( CStifItemParser& /*aItem*/ ) { CEikSecretEditor* secretEditor = new (ELeave) CEikSecretEditor; CleanupStack::PushL( secretEditor ); STIF_ASSERT_NOT_NULL( secretEditor ); TResourceReader reader; CCoeEnv::Static()->CreateResourceReaderLC( reader, R_TESTSDK_SECRETTEXT ); secretEditor->ConstructFromResourceL( reader ); CleanupStack::PopAndDestroy(); TBufC<KLength> buffer = secretEditor->Buffer(); STIF_ASSERT_EQUALS( 0, buffer.Length() ); CleanupStack::PopAndDestroy( secretEditor ); return KErrNone; }
// ---------------------------------------------------------------------------- // CChatBt::SendMessageL() // Send a message to a service on a remote machine. // ---------------------------------------------------------------------------- // void CChatBt::SendMessageL( TDes& aText ) { if ( State() != EConnected ) { User::Leave( KErrDisconnected ); } // stop reading socket if ( iActiveSocket ) { iActiveSocket->CancelRead(); } if ( IsActive() ) { Cancel(); } TBufC<KChatTextBufLength> message ( aText ); SetState( ESendingMessage ); HBufC* tempString = HBufC::NewL( message.Length() ); CleanupStack::PushL( tempString ); tempString->Des().Copy( message ); iMessage = HBufC8::NewL(tempString->Length()); CleanupStack::Pop( tempString ); iMessage->Des().Copy( *tempString ); if ( iActiveSocket ) { iActiveSocket->Write( *iMessage, iStatus ); } delete tempString; SetActive(); }
void dump_tbufc_contentaddress_len_size(TBufC<16> &aBufC) { console->Printf(KTxtTBufC); console->Printf(KContentAddressLenSizeFormat, &aBufC, aBufC.Ptr(), aBufC.Length(), aBufC.Size()); }
void dump_tbufc_content_len_size(TBufC<16> &aBufC) { _LIT(KFormat5,"\"%S\"; Length()=%d; Size()=%d\n"); console->Printf(KFormat5, &aBufC, aBufC.Length(), aBufC.Size()); }