// --------------------------------------------------------------------------- // CFepUiLayout::SendEditorTextAndCursorPosL // handle layout command // --------------------------------------------------------------------------- // void CFepUiLayout::SendEditorTextAndCursorPosL(TUint8* aData) { RDesReadStream readStream; TPtr8 countPtr( aData, 2*sizeof(TInt), 2*sizeof(TInt) ); readStream.Open(countPtr); CleanupClosePushL(readStream); const TInt dataCount = readStream.ReadInt32L(); const TInt textCount = readStream.ReadInt32L(); CleanupStack::PopAndDestroy(&readStream); TPtr8 ptr( aData+2*sizeof(TInt), dataCount+textCount, dataCount+textCount ); readStream.Open(ptr); CleanupClosePushL(readStream); HBufC8* dataBuf = HBufC8::NewLC(dataCount); TPtr8 dataBufPtr = dataBuf->Des(); readStream.ReadL(dataBufPtr, dataCount); TFepInputContextFieldData* pIcfData = reinterpret_cast<TFepInputContextFieldData*>(const_cast<TUint8*>(dataBufPtr.Ptr())); HBufC8* textBuf = HBufC8::NewLC(textCount); TPtr8 textBufPtr = textBuf->Des(); readStream.ReadL(textBufPtr, textCount); pIcfData->iText.Set( reinterpret_cast<const TUint16*>(textBufPtr.Ptr()), textCount/2); OnAppEditorTextComing(*pIcfData); CleanupStack::PopAndDestroy(textBuf); CleanupStack::PopAndDestroy(dataBuf); CleanupStack::PopAndDestroy(&readStream); }
// --------------------------------------------------------- // RNSmlPrivateAPI::GetDMAuthInfoL( CNSmlDMAuthInfo& aAuthInfo ) // Retrieves DM auhentication info from settings // --------------------------------------------------------- // EXPORT_C void RNSmlPrivateAPI::GetDMAuthInfoL( CNSmlDMAuthInfo& aAuthInfo ) { TPckgBuf<TInt> buf; TIpcArgs args(aAuthInfo.iProfileId, &buf); User::LeaveIfError( SendReceive( ECmdInitDMAuthInfo, args) ); CBufFlat* buffer = CBufFlat::NewL( KDefaultNSmlBufferGranularity ); CleanupStack::PushL( buffer ); buffer->ResizeL( buf() ); TPtr8 pBuffer(0, NULL, 0); pBuffer.Set( buffer->Ptr(0) ); TIpcArgs argsGet( &pBuffer ); User::LeaveIfError( SendReceive( ECmdGetDMAuthInfo, argsGet) ); RDesReadStream stream; stream.Open( pBuffer ); CleanupClosePushL( stream ); aAuthInfo.InternalizeL( stream ); CleanupStack::PopAndDestroy(2); // stream, buffer }
/** Internalize the class from a buffer. This function has to be updated every time a member has been added to the class to maintain binary compatibility. @internalTechnology @released @param aBufPtr A buffer containing the externalized class data */ EXPORT_C void CStartupProperties::InternalizeL(const TPtrC8& aBufPtr) { RDesReadStream readStream; readStream.Open(aBufPtr); CleanupClosePushL(readStream); iVersion = readStream.ReadInt32L(); delete iFileName; iFileName=NULL; iFileName = HBufC::NewL(readStream,KMaxFileName); delete iArgs; iArgs=NULL; iArgs = HBufC::NewL(readStream,KMaxFileName); iStartupType = static_cast<TStartupType>(readStream.ReadInt8L()); iStartMethod = static_cast<TStartMethod>(readStream.ReadInt8L()); iNoOfRetries = readStream.ReadInt32L(); iTimeout = readStream.ReadInt32L(); iRecoveryMethod.iRecoveryMethod = static_cast<TRecoveryMethod>(readStream.ReadInt8L()); iRestartMode = readStream.ReadInt32L(); iMonitored = static_cast<TBool>(readStream.ReadInt8L()); iViewless = static_cast<TBool>(readStream.ReadInt8L()); iStartInBackground = static_cast<TBool>(readStream.ReadInt8L()); // Add any new data member internalization code here // e.g. iSomethingElse = readStream.ReadInt32L(); CleanupStack::PopAndDestroy(&readStream); }
// --------------------------------------------------------------------------- // RPeninputServerImpl::ReadIntArrayFromBufL // Read buffer // --------------------------------------------------------------------------- // void RPeninputServerImpl::ReadIntArrayFromBufL(const TDesC8& aBuf, RArray<TInt>& aResult) { RDesReadStream readStream; readStream.Open(aBuf); CleanupClosePushL(readStream); const TInt entryCount = readStream.ReadInt32L(); for(TInt i = 0; i < entryCount; ++i) { aResult.AppendL(readStream.ReadInt32L()); } CleanupStack::PopAndDestroy(&readStream); }
// --------------------------------------------------------------------------- // RContentManager::OperationCompletedL // --------------------------------------------------------------------------- // TInt RContentManager::OperationCompletedL( TInt aErr ) { LOG(_L("[Cm Server]\t RContentManager::OperationCompletedL")); TRACE(Print(_L("[Cm Server]\t RContentManager::OperationCompletedL \ aErr = %d, iCanceled = %d\n"), aErr, iCanceled)); if ( !aErr && !iCanceled ) { // Items are changed so we don't want to keep old ones // Containers cannot be deleted because application // looses their address for ( TInt i = 0; i < (*iTargetContainer)->PropertyContainerCount(); i++ ) { CCmSqlPropertyContainer* container = (*iTargetContainer)->PropertyContainer( i ); for ( TInt j = 0; j < container->PropertyItemCount(); j++ ) { container->DeletePropertyItem(j--); } } TInt size( 0 ); TPckg<TInt> sizePckg( size ); SendReceive( ECmGetDataFieldSize, TIpcArgs( &sizePckg )); if ( size > 0 ) { HBufC8* buffer = HBufC8::NewLC( size ); TPtr8 bufferPointer = buffer->Des(); SendReceive( ECmGetDataBuffer, TIpcArgs( &bufferPointer ) ); RDesReadStream stream; stream.Open( bufferPointer ); CleanupClosePushL( stream ); // copy items to application side containers CopyItemsL( stream ); CleanupStack::PopAndDestroy( 2, buffer ); } } User::RequestComplete( iClientRequest, aErr ); return KErrNone; }
EXPORT_C CFbsBitmap * CBBFetchMediaRequest::MediaThumbnail() const { if (iMediaThumbnail->iBuf->Des().Length()==0) return 0; RDesReadStream rStream; rStream.Open(*(iMediaThumbnail->iBuf)); auto_ptr<CFbsBitmap> aBitmap (new (ELeave) CFbsBitmap); aBitmap->InternalizeL(rStream); rStream.Close(); return aBitmap.release(); //TPckgBuf<CFbsBitmap> xBitmap; //xBitmap.Append(iMediaThumbnail->iBuf->Des()); //return &(xBitmap()); }
TInt CryptoSpiUtil::RetrieveCharacteristicsL(TInt32 aInterface, RDesReadStream& aStream, RBuf8& aBuf, TInt& aCount) { // first we are only trying to retrieve the length of the buffer TBuf8<sizeof(TInt32)> buf; TInt testResult = RProperty::Get(KCryptoSpiPropertyCat, aInterface, buf); if (testResult==KErrNotFound) { //run the exe to Publish the properties RunCryptoSpiPropertySetupExe(); // testresult would be checked outside the loop testResult = RProperty::Get(KCryptoSpiPropertyCat, aInterface, buf); } // overflow will occur as we are only retrieving the length first. // any other error we should leave if(testResult != KErrOverflow) { User::LeaveIfError(testResult); } //read the length RDesReadStream rStream(buf); TInt32 len=rStream.ReadInt32L(); //If the property is empty if (len<=4) { return len; } //Allocate memory aBuf.CreateMaxL(len); User::LeaveIfError(RProperty::Get(KCryptoSpiPropertyCat, aInterface, aBuf)); //Read the length aStream.Open(aBuf); len=aStream.ReadInt32L(); //Read the count of the characteristics aCount=aStream.ReadInt16L(); return len; }
// --------------------------------------------------------------------------- // XIMPEventCodec::UnPackL() // --------------------------------------------------------------------------- // EXPORT_C CXIMPApiEventBase* XIMPEventCodec::UnPackL( const TDesC8& aEventData, TInt32& aTypeOfEvent ) { RDesReadStream rs; rs.Open( aEventData ); // CSI: 65 # CleanupClosePushL( rs ); TInt32 eventIfId = rs.ReadInt32L(); CXIMPApiEventBase* eventObject = NewEventObjectFromStreamLC( eventIfId, rs ); if ( eventObject ) { CleanupStack::Pop(); //eventObject } CleanupStack::PopAndDestroy(); // rs aTypeOfEvent = eventIfId; return eventObject; }
EXPORT_C CSearchDocument* RSearchServerSubSession::GetDocumentObjectL() { OstTraceFunctionEntry0( RSEARCHSERVERSUBSESSION_GETDOCUMENTOBJECTL_ENTRY ); PERFORMANCE_LOG_START("CCPixSearcher::GetDocumentObjectL"); CSearchDocument* document = NULL; if (iDocumentSize>0) { HBufC8* buf = HBufC8::NewLC(iDocumentSize); TPtr8 ptr = buf->Des(); User::LeaveIfError(SendReceive(ESearchServerGetDocumentObject, TIpcArgs(&ptr))); RDesReadStream stream; stream.Open(ptr); stream.PushL(); document = CSearchDocument::NewLC(stream); CleanupStack::Pop(document); CleanupStack::PopAndDestroy(&stream); CleanupStack::PopAndDestroy(buf); } OstTraceFunctionExit0( RSEARCHSERVERSUBSESSION_GETDOCUMENTOBJECTL_EXIT ); return document; }