// --------------------------------------------------------------------------- // 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); }
/** 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); }
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; }