void CRefTestAgentContent::ConstructL(RFile& aFile) { RFile file; User::LeaveIfError(file.Duplicate(aFile)); CleanupClosePushL(file); // open server session User::LeaveIfError(iContentSession.Open(file)); // can now close our file handle, server owns it now CleanupStack::PopAndDestroy(&file); }
//--------------------------------------------------------------- // SmilXmlReader::ParseL // @see header //--------------------------------------------------------------- void SmilXmlReader::ParseL( RFile& filehandle ) { //Create GMXML parser's instance xmlparser = CMDXMLParser::NewL( this, CSMILDtd::NewL() ); // XML parser closes the given handle. So make a duplicate handle. RFile parsehandle; User::LeaveIfError( parsehandle.Duplicate( filehandle ) ); User::LeaveIfError( xmlparser->ParseFile( parsehandle ) ); iWaitScheduler.Start(); return; }
/** @internalTechnology */ EXPORT_C CStreamDictionary* CApaProcess::ReadRootStreamLC(CFileStore*& aStore, const RFile& aFile) { // static __SHOW_TRACE(_L("Starting CApaProcess::ReadRootStreamLC (file-handle overload)")); CStreamDictionary* const streamDictionary = CStreamDictionary::NewLC(); RFile duplicateFile; CleanupClosePushL(duplicateFile); User::LeaveIfError(duplicateFile.Duplicate(aFile)); // this is because CFileStore::FromLC closes the file its passed (and stores its own duplicate) CFileStore* const store = CFileStore::FromL(duplicateFile); CleanupStack::PopAndDestroy(&duplicateFile); CleanupStack::PushL(store); DoReadRootStreamL(*streamDictionary, *store); aStore = store; // delay assignment until nothing can go wrong to avoid destroying the store twice if a leave occurs CleanupStack::Pop(store); return streamDictionary; }
virtual void RetrieveIconFileHandleL( RFile& aFile, const TIconFileType aType ) { aFile.Duplicate(iFile); }