void CHuiTexture::SetImageFileNameL(const TDesC& aFileName) { delete iImageFileName; iImageFileName = 0; iImageFileName = aFileName.AllocL(); }
// --------------------------------------------------------- // TDdParser::ParseL() // --------------------------------------------------------- // void TDdParser::ParseL( const TDesC& aBuf, CCodData& aData, const TBool aIsDd2, TBool& aIsLicenseTag ) { CLOG(( EParse, 2, _L("-> TDdParser::ParseL") )); CDUMP(( EParse, 2, _S("Buf:"), _S(" "), \ (const TUint8*)aBuf.Ptr(), aBuf.Size() )); iError = KErrNone; iData = &aData; // XML Parser expects the buffer contain a BOM and be in // network byte order (this is hard-coded into cXmlParser). // We already have the buffer converted to UCS-2, native byte order, BOM // removed, and this cannot be changed without changing API. // So we have to re-add BOM and convert the buffer back to network byte // order. This is an annoying a waste, luckily a DD file is small // enough not to be significant. HBufC* buf = HBufC::NewLC( aBuf.Length() + 1 ); buf->Des().Append( 0xFFFE ); // Add BOM, little endian as aBuf. buf->Des().Append( aBuf ); // Append buffer. // Now turn the whole buffer big-endian. TUint8* ptr = (TUint8*)buf->Ptr(); for ( TInt i = 0; i < buf->Size(); i += 2 ) { TUint8 tmp = ptr[i]; ptr[i] = ptr[i + 1]; ptr[i + 1] = tmp; } NW_WBXML_Dictionary_t* dictArray[ 1 ] = { (NW_WBXML_Dictionary_t*)&NW_DdDummy_WBXMLDictionary }; RNwWbxmlDictionary wbxmlDict; User::LeaveIfError( wbxmlDict.Initialize( 1, dictArray ) ); CleanupClosePushL<RNwWbxmlDictionary>( wbxmlDict ); NW_TinyDom_Handle_t domHandle; NW_Status_t stat; CNwDomDocumentNode* docNode = new (ELeave) CNwDomDocumentNode(); CleanupStack::PushL( docNode ); docNode->iDocNode = CXML_DOM_DocumentNode_BuildTree ( &domHandle, (NW_Byte*)buf->Ptr(), (NW_Int32)buf->Size(), /*encoded=*/NW_FALSE, /*publicID=*/NW_DdDummy_PublicId, /*extTNotStringTable=*/NW_FALSE, &stat ); LeaveIfNwErrorL( stat ); User::LeaveIfNull( docNode->iDocNode ); // Safety code. if (!aIsDd2) { DocNodeL( docNode->iDocNode ); } else { iIsLicenseTag = EFalse; ParseDd2DocNodeL( docNode->iDocNode ); } CleanupStack::PopAndDestroy( 3, buf ); // docNode, close wbxmlDict, buf #ifdef __TEST_COD_LOG TPtrC ptr16; TPtrC8 ptr8; CLOG(( EParse, 3, _L("TCodParser::ParseL data:") )); ptr16.Set( aData.Name() ); CLOG(( EParse, 3, _L(" Name<%S>"), &ptr16 )); ptr16.Set( aData.Vendor() ); CLOG(( EParse, 3, _L(" Vendor<%S>"), &ptr16 )); ptr16.Set( aData.Description() ); CLOG(( EParse, 3, _L(" Desc<%S>"), &ptr16 )); CLOG(( EParse, 3, _L(" Size(%d)"), aData.Size() )); ptr8.Set( aData.InstallNotify() ); CLOG(( EParse, 3, _L8(" InstNotif<%S>"), &ptr8 )); ptr8.Set( aData.NextUrl() ); CLOG(( EParse, 3, _L8(" NextUrl<%S>"), &ptr8 )); ptr8.Set( aData.NextUrlAtError() ); CLOG(( EParse, 3, _L8(" NextUrlAtErr<%S>"), &ptr8 )); ptr8.Set( aData.InfoUrl() ); CLOG(( EParse, 3, _L8(" InfoUrl<%S>"), &ptr8 )); ptr16.Set( aData.Price() ); CLOG(( EParse, 3, _L(" Price<%S>"), &ptr16 )); ptr8.Set( aData.Icon() ); CLOG(( EParse, 3, _L8(" Icon<%S>"), &ptr8 )); //TODO add logs for OMA 2 #endif /* def __TEST_COD_LOG */ //If there are no media objects present to download, if( !iData->Count() ) { User::Leave( KErrCodInvalidDescriptor ); } // NULL data for clarity. These are never used later, but don't keep // pointers to objects which are out of reach. iData = NULL; User::LeaveIfError( iError ); aIsLicenseTag = iIsLicenseTag; CLOG(( EParse, 2, _L("<- TDdParser::ParseL") )); }
// --------------------------------------------------------- // CContextbookContainer::ConstructL(const TRect& aRect) // EPOC two phased constructor // --------------------------------------------------------- // void CContextbookContainer::ConstructL(const TRect& aRect, phonebook_i* i_book, bool i_searchable, const TDesC& title, Cfile_output_base * aLog, CAknIconArray * aIconlist, TInt current_item_index, TInt top_item_index, TBuf<20> current_filter) { CALLSTACKITEM(_L("CContextbookContainer::ConstructL")); iCurrentContactId=KErrNotFound; iconlist = new (ELeave) CAknIconArray(30); //copy for (TInt i = 0; i< aIconlist->Count();i++) { CGulIcon * ic, *icon_from; icon_from= (*aIconlist)[i]; ic=CGulIcon::NewL( icon_from->Bitmap(), icon_from->Mask()); ic->SetBitmapsOwnedExternally(ETrue); iconlist->AppendL( ic ); } iLog = aLog; CreateWindowL(); CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane(); CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle)); HBufC* t=HBufC::NewL(title.Length()); *t=title; tp->SetText(t); if (iLog) { iLog->write_time(); iLog->write_to_output(_L("Showing ")); iLog->write_to_output(title); iLog->write_nl(); } sendui=CSendAppUi::NewL(0); searchable=i_searchable; resource_files=new (ELeave) CArrayFixFlat<TInt>(5); // for phonebook dialogs TFileName resfile=_L("z:\\System\\data\\PBKVIEW.rSC"); BaflUtils::NearestLanguageFile(iEikonEnv->FsSession(), resfile); //for localization resource_files->AppendL(iEikonEnv->AddResourceFileL(resfile)); book=i_book; book->set_observer(this); listbox=new (ELeave) doublelinebox(book,iLog); listbox->SetContainerWindowL(*this); listbox->ConstructL(this, EAknListBoxSelectionList); listbox->SetItemHeightL(40); listbox->View()->SetMatcherCursor(EFalse); listbox->ItemDrawer()->FormattedCellData()->SetIconArray(iconlist); listbox->SetListBoxObserver(this); listbox->Model()->SetItemTextArray(book->get_array()); listbox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); listbox->CreateScrollBarFrameL(ETrue); listbox->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto); listbox->SetCurrentItemIndex(current_item_index); listbox->SetTopItemIndex(top_item_index); if (is_searchable()) { edit=new (ELeave) CEikEdwin; edit->SetBorder(TGulBorder::ESingleBlack); edit->SetContainerWindowL(*this); edit->ConstructL(); edit->AddEdwinObserverL(this); edit->SetFocus(ETrue); edit->SetTextL(¤t_filter); filter(); } phone=new (ELeave) phonehelper; phone->ConstructL(); globalNote=CAknGlobalNote::NewL(); pbkengine=CPbkContactEngine::Static(); if (pbkengine) { owns_engine=false; } else { pbkengine=CPbkContactEngine::NewL(); owns_engine=true; } SetRect(aRect); ActivateL(); }
EXPORT_C void CImSSmtpSettings::SetEmailAddressL( const TDesC& aEmailAddress ) { HBufC* newEmailAddress = aEmailAddress.AllocL(); delete iEmailAddress; iEmailAddress = newEmailAddress; }
// --------------------------------------------------------- // TDdParser::SetMetaAttrL() // --------------------------------------------------------- // void TDdParser::SetMetaAttrL( TDdAttr aAttr, const TDesC& aValue, CMediaObjectData *& aMediaObject ) { TInt ok( ETrue ); switch( aAttr ) { case EDdName: { if ( !aMediaObject->Name().Length() ) { ok = aMediaObject->SetNameL( aValue ); } break; } case EDdDescription: { if ( !aMediaObject->Description().Length() ) { ok = aMediaObject->SetDescriptionL( aValue ); } break; } case EDdInstallNotify: { if ( !aMediaObject->InstallNotify().Length() ) { ok = aMediaObject->SetInstallNotifyL( aValue ); } break; } case EDdInfoUrl: { if ( !aMediaObject->InfoUrl().Length() ) { ok = aMediaObject->SetInfoUrlL( aValue ); } break; } case EDdIcon: { if ( !aMediaObject->Icon().Length() ) { ok = aMediaObject->SetIconL( aValue ); } break; } case EDdOrder: { TBool isPostOrder( EFalse ); if ( !aValue.CompareF( KDdPost ) ) { isPostOrder = ETrue; } else if ( aValue.CompareF( KDdAny ) ) { // Expected 'post' or 'any' Error( KErrCodInvalidDescriptor ); break; } aMediaObject->SetOrderIsPost( isPostOrder ); break; } case EDdText: { //TODO for OMA2 /* if ( !iData->Text().Length() ) { ok = iData->SetTextL( aValue ); } */ break; } default: { // Unexpected value. CodPanic( ECodInternal ); } } if ( !ok ) { Error( KErrCodInvalidDescriptor ); } }
void CWebServerEnv::SetErrorPathL(const TDesC& aErrorPath) { delete iErrorPath; iErrorPath = aErrorPath.AllocL(); }
TBool CCommonUtils::HexToDec(const TDesC& aHexDes,TInt& aDec) { TInt i,mid; TInt len = aHexDes.Length();//lstrlen( aHexDes ); //if( len > 9 )//#00ff00ff? // return EFalse; mid = 0; aDec = 0; for( i = 0;i < len; i++ ) { if( (aHexDes.Ptr())[i]>='0' && (aHexDes.Ptr())[i]<='9' ) { mid = (aHexDes.Ptr())[i]-'0'; } else if( (aHexDes.Ptr())[i]>='a'&& (aHexDes.Ptr())[i]<='f' ) { mid = (aHexDes.Ptr())[i] -'a' +10; } else if( (aHexDes.Ptr())[i]>='A'&& (aHexDes.Ptr())[i]<='F' ) { mid = (aHexDes.Ptr())[i] -'A' +10; } else if ((aHexDes.Ptr())[i] == '#') { continue; } else { return EFalse; } mid <<= ((len-i-1)<<2); aDec |= mid; } return ETrue; }
/** Retrieves the database system settings from the settings table. @param aDbName Logical database name: "main" for the main database or attached database name, @param aCollationDllName Output parameter, will contain the stored collation dll name, @param aDbConfigFileVersion Output parameter, will contain the stored database config file version, @param aSettingsVersion Output parameter, will contain the version of the settings table. @param aCompactionMode Output parameter. Database compaction mode (one of TSqlCompactionMode enum item values except ESqlCompactionNotSet). @see TSqlCompactionMode @leave KErrGeneral, either unable to retrieve the data from the settings table or the stored table version or config file version is invalid or the stored compaction mode is invalid. KErrOverflow, aCollationDllName is not large enough to store the name of the collation dll that is stored in the settings table. KErrNoMemory, an out of memory condition has occurred. Note that the function may also leave with other system-wide error codes or SQL errors of ESqlDbError type @panic SqlDb 2 In _DEBUG mode if iDbHandle is NULL (uninitialized TSqlDbSysSettings object). */ void TSqlDbSysSettings::GetSettingsL(const TDesC& aDbName, TDes& aCollationDllName, TInt& aDbConfigFileVersion, TInt& aSettingsVersion, TSqlCompactionMode& aCompactionMode) { __ASSERT_DEBUG(iDbHandle != NULL, __SQLPANIC(ESqlPanicInvalidObj)); HBufC* buf = HBufC::NewLC(sizeof(KGetSettingsSql) + aDbName.Length()); TPtr sql = buf->Des(); //Prepare statement handle sql.Format(KGetSettingsSql(), &aDbName); sqlite3_stmt* stmtHandle = ::StmtPrepare16L(iDbHandle, sql); CleanupStack::PushL(TCleanupItem(&FinalizeStatementHandle, stmtHandle)); //Move to the first record TInt err = ::StmtNext(stmtHandle); __SQLLEAVE_IF_ERROR(err); //Check that it is a valid row. The error is checked on the previous line. //The "if" bellow will check whether there is a valid record or not. if(err != KSqlAtRow) { __SQLLEAVE(KErrGeneral); } //Get the system settings version aSettingsVersion = sqlite3_column_int(stmtHandle, KSysVersionColIdx); if(aSettingsVersion < ESqlSystemVersion1) { __SQLLEAVE(KErrGeneral); } if(aSettingsVersion > ESqlSystemVersion2) { //The "ConfigFileVersion" column exists and is used to store the most recent //version of the database's config file (if there is one) that has //been successfully processed aDbConfigFileVersion = sqlite3_column_int(stmtHandle, KConfigFileVersionColIdx); if(aDbConfigFileVersion < KSqlNullDbConfigFileVersion) { __SQLLEAVE(KErrGeneral); } //The "CollationDllName" column exists and its value can be read. //The column type might be different than SQLITE_TEXT - malformed database. if(sqlite3_column_type(stmtHandle, KCollationDllNameColIdx) != SQLITE_TEXT) { __SQLLEAVE(KErrGeneral); } const void* ptr = sqlite3_column_text16(stmtHandle, KCollationDllNameColIdx); //Null column value - this might be an indication of an "out of memory" problem, if the column text //is in UTF8 format. (sqlite3_column_text16() may allocate memory for UTF8->UTF16 conversion) __SQLLEAVE_IF_NULL(const_cast<void*>(ptr)); TPtrC16 src(reinterpret_cast <const TUint16*> (ptr)); if(src.Length() > aCollationDllName.MaxLength()) { __SQLLEAVE(KErrOverflow); } aCollationDllName.Copy(src); } if(aSettingsVersion > ESqlSystemVersion3) { aCompactionMode = static_cast <TSqlCompactionMode> (sqlite3_column_int(stmtHandle, KCompactionModeColIdx)); if(aCompactionMode != ESqlCompactionManual && aCompactionMode != ESqlCompactionBackground && aCompactionMode != ESqlCompactionAuto) { __SQLLEAVE(KErrGeneral); } } CleanupStack::PopAndDestroy();//TCleanupItem(&FinalizeStatementHandle, stmtHandle) CleanupStack::PopAndDestroy(buf); }
// --------------------------------------------------------- // CNSmlDsProvisioningAdapter::StoreAttributesL // --------------------------------------------------------- void CNSmlDsProvisioningAdapter::StoreAttributesL( const TDesC& aType ) { _DBG_FILE("CNSmlDsProvisioningAdapter::StoreAttributesL(): begin"); TInt iDataProvElementCount = iProfiles[iProfiles.Count()-1]->iDataProvElement.Count()-1; // Leave if aType cannot be assigned if( ( aType.Length() > 0 ) && ( iProfiles[iProfiles.Count()-1]->iDataProvElement[iDataProvElementCount]->iRemoteDBUri ) ) { TBool dataProvIdFoundInZ = FALSE; TSmlDataProviderId firstDataProvIdFound = 0; TSmlDataProviderId uidFound = 0; TBool doSearch = ETrue; if ( aType.FindF( KXVcardMimeType ) != KErrNotFound ) { if ( IsOperatorProfile( *iProfiles[iProfiles.Count()-1] ) ) { const CNSmlDsProfileElement& profile = *iProfiles[iProfiles.Count()-1]; StoreOperatorUrlL( *profile.iHostAddress ); // Do not make a search through adapter implementations doSearch = EFalse; uidFound = OperatorAdapterUid(); if ( !uidFound ) { // If OperatorAdapterUid returns 0, do a search doSearch = ETrue; } } } // look through every implementation adapter until one found // which supports MIME type in question // The first one located in ROM is chosen. If none found in ROM then // the first adapter found is chosen. HBufC8 *type = HBufC8::NewLC(aType.Size()); TPtr8 typePtr = type->Des(); CnvUtfConverter::ConvertFromUnicodeToUtf8( typePtr, aType); // get list of dataproviderIds RImplInfoPtrArray implArray; CleanupStack::PushL( PtrArrCleanupItemRArr( CImplementationInformation, &implArray ) ); TUid ifUid = { KNSmlDSInterfaceUid }; REComSession::ListImplementationsL( ifUid, implArray ); if ( doSearch ) { TInt countProviders = implArray.Count(); for( TInt i = 0; i < countProviders; i++ ) { CImplementationInformation* implInfo = implArray[i]; RSyncMLDataProvider dataProvider; dataProvider.OpenL( iSession, implInfo->ImplementationUid().iUid ); CleanupClosePushL( dataProvider ); TInt mimeTypeCount = dataProvider.MimeTypeCount(); for( TInt j = 0; j < mimeTypeCount; j++ ) { HBufC* mimeType = dataProvider.MimeType( j ).AllocLC(); TPtrC8 convMimeType = ConvertTo8LC( *mimeType ); if( typePtr.Find( convMimeType ) == 0) { // MIME type in question was found uidFound = implInfo->ImplementationUid().iUid; if( firstDataProvIdFound == 0 ) { // save the first in case of none found from ROM firstDataProvIdFound = uidFound; } // check whether the provider is located in ROM (drive Z) if( implInfo->Drive() == EDriveZ ) { dataProvIdFoundInZ = TRUE; } } CleanupStack::PopAndDestroy(2); // mimetype, ConvertTo8LC if( uidFound ) { break; } } CleanupStack::PopAndDestroy(); // dataProvider if ( dataProvIdFoundInZ ) { break; } else { uidFound = firstDataProvIdFound; } } } REComSession::FinalClose(); CleanupStack::PopAndDestroy( 2 ); // type, implArray if( uidFound ) { iProfiles[iProfiles.Count()-1]->iDataProvElement[iDataProvElementCount]->iUid = uidFound; } } _DBG_FILE("CNSmlDsProvisioningAdapter::StoreAttributesL(): end"); }
// --------------------------------------------------------------------------- // CIRAdvertisement::SetAdvInUse() // Function to set the advertisement in use // --------------------------------------------------------------------------- // EXPORT_C void CIRAdvertisement::SetAdvInUse( const TDesC& aAdvInUse ) { IRLOG_DEBUG( "CIRAdvertisement::SetAdvInUse - Entering" ); iAdvInUse = aAdvInUse.Alloc(); IRLOG_DEBUG( "CIRAdvertisement::SetAdvInUse - Exiting." ); }
void CMtfTestAction::SetActionIdL(const TDesC& aActionId) { iActionId = aActionId.AllocL(); }
void ConstructL(const TDesC& aText) { iText = aText.AllocL(); }
/** Description:Function is intended to set the integrity password @param aIntegrityPassword, contains the integrity password @internalTechnology @test */ void CPkcs12Parser::SetIntegrityPasswordL(const TDesC& aIntegrityPassword) { iIntegrityPassword = aIntegrityPassword.AllocL(); }
void CTextModeTestMultiTrans::ConstructL(const TDesC& aHostName) { iHostName = HBufC8::NewL(aHostName.Length()); iHostName->Des().Copy(aHostName); }
void CWebServerEnv::SetServerPathL(const TDesC& aServerPath) { delete iServerPath; iServerPath = aServerPath.AllocL(); }
void CCustomAppInfoData::ConstructL(const TDesC& aShortCaption) { iShortCaption=aShortCaption.AllocL(); }
void CWebServerEnv::SetCgiPathL(const TDesC& aCgiPath) { delete iCgiPath; iCgiPath = aCgiPath.AllocL(); }
// ----------------------------------------------------------------------------- // Write unicode text to file // ----------------------------------------------------------------------------- // void CBCTestLogger::WriteToFileL( RFile& aFile, const TDesC& aText ) { TPtrC8 buf( (TUint8*)aText.Ptr(), aText.Size() ); aFile.Write( buf ); }
void CWebServerEnv::SetBackupPathL(const TDesC& aBackupPath) { delete iBackupPath; iBackupPath = aBackupPath.AllocL(); }
EXPORT_C void StartApplicationL(const TUid& aUid, const TDesC& aDocumentName, TInt aRetryInterval, TApaCommand aCommand) { TUid appToBeStarted = aUid; TInt pushed=0; #ifdef DEBUG RFs fs; User::LeaveIfError(fs.Connect()); CleanupClosePushL(fs); pushed++; RFile f; User::LeaveIfError(f.Replace(fs, _L("c:\\processmanagement.txt"), EFileWrite)); CleanupClosePushL(f); pushed++; f.Write(_L8("starting\n")); #endif TInt retries=0; LOG(_L8("new'ing ls session...")); RApaLsSession *lsp; lsp=new (ELeave) RApaLsSession; LOG(_L8("\n")); CleanupStack::PushL(lsp); ++pushed; RApaLsSession& ls(*lsp); while(retries<80) { TInt i_pushed=0; LOG(_L8("connecting ls session...")); TInt err=ls.Connect(); LOG(_L8(": ")); TBuf8<12> msg; msg.Num(err); msg.Append(_L("\n")); LOG(msg); if (err==KErrNone) { CleanupClosePushL(ls); ++i_pushed; pushed+=i_pushed; break; } else { CleanupStack::PopAndDestroy(i_pushed); } LOG(_L8("waiting...")); retries++; User::After(TTimeIntervalMicroSeconds32(aRetryInterval*1000)); LOG(_L8("done.\n")); } LOG(_L8("ls session created\n")); LOG(_L8("creating info...")); TApaAppInfo* infop=0; infop=new (ELeave) TApaAppInfo; LOG(_L8("1 ")); CleanupStack::PushL(infop); ++pushed; LOG(_L8("2 ")); TApaAppInfo& info(*infop); LOG(_L8("done\n")); RWsSession ws; User::LeaveIfError(ws.Connect()); CleanupClosePushL(ws); ++pushed; TApaTaskList tl(ws); TApaTask app_task=tl.FindApp(aUid); TBool exists=app_task.Exists(); while( !exists && retries<80) { TInt pushed=0; LOG(_L8("getting info...")); TInt err=ls.GetAppInfo(info, appToBeStarted); LOG(_L8("done: ")); TBuf8<12> msg; msg.Num(err); msg.Append(_L("\n")); LOG(msg); if (err==KErrNone) { #ifndef __S60V3__ CApaCommandLine* cmd=CApaCommandLine::NewLC(info.iFullName); pushed++; #else CApaCommandLine* cmd=CApaCommandLine::NewLC(); pushed++; cmd->SetExecutableNameL(info.iFullName); #endif cmd->SetCommandL( aCommand ); if ( aDocumentName.Length() > 0 ) { cmd->SetDocumentNameL(aDocumentName); } #ifndef __S60V3__ TRAP(err, EikDll::StartAppL(*cmd)); #else err=ls.StartApp(*cmd); #endif CleanupStack::PopAndDestroy(pushed); LOG(_L8("StartAppL: ")); msg.Num(err); msg.Append(_L("\n")); LOG(msg); if (err==KErrNone) break; } else { LOG(_L8("popping...")); CleanupStack::PopAndDestroy(pushed); LOG(_L8("done\n")); } LOG(_L8("waiting...")); retries++; User::After(TTimeIntervalMicroSeconds32(aRetryInterval*1000)); LOG(_L8("done.\n")); } LOG(_L8("done\n")); CleanupStack::PopAndDestroy(pushed); }
EXPORT_C void CImSSmtpSettings::SetPhoneNumberL( const TDesC& aPhoneNumber ) { HBufC* newPhoneNumber = aPhoneNumber.AllocL(); delete iPhoneNumber; iPhoneNumber = newPhoneNumber; }
// Delete any existing static string; allocates a new HBufC // and sets thread local storage to point to the HBufC. EXPORT_C void CSetter::SetStaticTextL(const TDesC& aString) { delete (HBufC*)Dll::Tls(); HBufC* pD = aString.AllocL(); Dll::SetTls(pD); }
// --------------------------------------------------------- // TDdParser::SetMediaObjAttrL() // --------------------------------------------------------- // void TDdParser::SetMediaObjAttrL( TDdAttr aAttr, const TDesC& aValue, CMediaObjectData *& aMediaObject ) { TInt ok( ETrue ); switch( aAttr ) { case EDdSize: { if ( !aMediaObject->Size() ) { // Parse as TUint - negative not allowed. TUint size; TLex lex( aValue ); if ( !lex.Val( size ) ) { aMediaObject->SetSize( size ); } else { ok = EFalse; } } break; } case EDdType: { ok = aMediaObject->AddTypeL( aValue ); break; } case EDdProgressiveDl: { TBool pd( EFalse ); if ( !aValue.CompareF( KDdTrue ) ) { pd = ETrue; } else if ( aValue.CompareF( KDdFalse ) ) { // Expected 'true' or 'false' Error( KErrCodInvalidDescriptor ); break; } aMediaObject->SetProgressiveDownload( pd ); break; } case EDdSuppressUserConfirmation: { TInt confirm = CCodData::ENever; if ( !aValue.CompareF(KDdNever) ) { confirm = CCodData::ENever; } else if ( aValue.CompareF(KDdUserConfirmStepOnly) ) { confirm = CCodData::EUserConfirmStepOnly; } else if ( aValue.CompareF(KDdAlways) ) { confirm = CCodData::EAlways; } else { Error( KErrCodInvalidDescriptor ); } iData->SetSuppressConfirm( confirm ); break; } case EDdUpdatedDDURI: { if(!iData->UpdatedDDUriL().Length()) { iData->SetUpdatedDDURI( aValue ); } break; } default: { // Unexpected value. CodPanic( ECodInternal ); } } if ( !ok ) { Error( KErrCodInvalidDescriptor ); } }
// ----------------------------------------------------------------------------- // CDrmUtilityGlobalNoteWrapper::DoShowNoteL // ----------------------------------------------------------------------------- // TInt DRM::CDrmUtilityGlobalNoteWrapper::DoShowNoteL( TInt aResourceId, const TDesC& aString, TInt aValue ) { TPtr bufPtr( NULL, 0 ); TInt animation( iButtonsId == R_AVKON_SOFTKEYS_YES_NO__YES ? 0 : R_QGN_NOTE_INFO_ANIM ); CAknGlobalConfirmationQuery* globalNote( CAknGlobalConfirmationQuery::NewLC() ); bufPtr.Set( const_cast <TUint16*>( iTextBuffer.Ptr() ), iTextBuffer.Length(), iTextBuffer.Length() ); AknTextUtils::LanguageSpecificNumberConversion( bufPtr ); if ( FeatureManager::FeatureSupported( KFeatureIdCoverDisplay ) && DRM::CDrmUtilityInfoNoteWrapper::EvaluateCoverResourceId( aResourceId ) ) { RProcess myProcess; TUid myProcessUid( KNullUid ); RThread().Process( myProcess ); myProcessUid = myProcess.Identity(); TUtilitySDData utilityData; // First field is DrmUtility's Uid utilityData.iUtilityUid = KUidCoverUiCategoryDrmUtility; // ProcessId which uses DrmUtility utilityData.iHandlerProcessId = myProcessUid; if ( aString.Compare( KNullDesC ) ) { // If there is filename given, it's always in the PrimaryString utilityData.iStringParam.Append( aString ); } if ( aValue >= 0 ) { // If there is no other than numeric data, put it as SecondaryString utilityData.iNumParam.AppendNum( aValue ); } TUtilitySDDataPckg pckg( utilityData ); CAknSDData* sd( CAknSDData::NewL( KUidCoverUiCategoryDrmUtility, aResourceId, pckg ) ); // ownership to notifier client globalNote->SetSecondaryDisplayData( sd ); } iStatus = KRequestPending; globalNote->ShowConfirmationQueryL( iStatus, iTextBuffer, iButtonsId, animation ); SetActive(); iWait.Start(); CleanupStack::PopAndDestroy( globalNote ); if ( iStatus.Int() != EAknSoftkeyNo ) { return iStatus.Int(); } else { return 0; } }
// --------------------------------------------------------- // TDdParser::Attribute() // for OMA v1 // --------------------------------------------------------- // TDdParser::TDdAttr TDdParser::Attribute( const TDesC& aAttrName ) const { TDdAttr attr = EDdUnknownAttr; if ( !aAttrName.Compare( KDdName ) ) { attr = EDdName; } else if ( !aAttrName.Compare( KDdVendor ) ) { attr = EDdVendor; } else if ( !aAttrName.Compare( KDdDescription ) ) { attr = EDdDescription; } else if ( !aAttrName.Compare( KDdUrl ) ) { attr = EDdUrl; } else if ( !aAttrName.Compare( KDdSize ) ) { attr = EDdSize; } else if ( !aAttrName.Compare( KDdType ) ) { attr = EDdType; } else if ( !aAttrName.Compare( KDdInstallNotify ) ) { attr = EDdInstallNotify; } else if ( !aAttrName.Compare( KDdNextUrl ) ) { attr = EDdNextUrl; } else if ( !aAttrName.Compare( KDdInfoUrl ) ) { attr = EDdInfoUrl; } else if ( !aAttrName.Compare( KDdIcon ) ) { attr = EDdIcon; } else if ( !aAttrName.Compare( KDdVersion ) ) { attr = EDdVersion; } return attr; }
TLineBuffer::TLineBuffer(const TDesC &aBuffer) : iRemainder(aBuffer.Length()), iTail(aBuffer) { }
void CMdsClauseBuffer::AppendL( const TDesC& aDes, const TInt aAdditional ) { ReserveSpaceL( iBuffer->Size() + aDes.Length() + 1 + aAdditional ); iBuffer->Des().Append( aDes ); }
void CWebServerEnv::SetDefaultResourceL(const TDesC& aDefaultResource) { delete iDefaultResource; iDefaultResource = aDefaultResource.AllocL(); }
TInt XAPlaySessionImpl::load(const TDesC& aURI) { TInt retVal; XAresult xaRes; XAEngineItf engineItf; XADynamicSourceItf dynamicSourceItf; XAboolean required[MAX_NUMBER_INTERFACES]; XAInterfaceID iidArray[MAX_NUMBER_INTERFACES]; XAuint32 noOfInterfaces = 0; TInt i; XAmillisecond dur(0); TPtr8 uriPtr(0,0,0); TPtr8 mimeTypePtr(0,0,0); #ifdef USE_VIDEOPLAYERUTILITY TRAP(m_VPError, mVideoPlayUtil->OpenFileL(_L("C:\\data\\test.3gp"))); if (m_VPError) return 0; if(!mActiveSchedulerWait->IsStarted()) mActiveSchedulerWait->Start(); if (m_VPError) return 0; mVideoPlayUtil->Prepare(); if(!mActiveSchedulerWait->IsStarted()) mActiveSchedulerWait->Start(); return 0; #endif delete mURIName; mURIName = NULL; TRAP(retVal, mURIName = HBufC8::NewL(aURI.Length()+1)); RET_ERR_IF_ERR(retVal); uriPtr.Set(mURIName->Des()); // This has to be done here since we can not destroy the Player // in the Resource Lost callback. if (mbMediaPlayerUnrealized) { if (mMOPlayer) { (*mMOPlayer)->Destroy(mMOPlayer); mMOPlayer = NULL; } } //py uri name into local variable //TODO fix copy issue from 16 bit to 8 bit uriPtr.Copy(aURI); //If media player object already exists, just switch source //using dynamic source interface if (mMOPlayer && mPlayItf) { dynamicSourceItf = NULL; xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_DYNAMICSOURCE, &dynamicSourceItf); retVal = mapError(xaRes, ETrue); RET_ERR_IF_ERR(retVal); //Setup the data source //TODO Hard coded locator type mUri.locatorType = XA_DATALOCATOR_URI; //append zero terminator to end of URI mUri.URI = (XAchar*) uriPtr.PtrZ(); //TODO Hard coded locator type mMime.containerType = XA_CONTAINERTYPE_WAV; //TODO Hard coded locator type mMime.formatType = XA_DATAFORMAT_MIME; mimeTypePtr.Set(mWAVMime->Des()); mMime.mimeType = (XAchar*)mimeTypePtr.Ptr(); mDataSource.pFormat = (void*)&mMime; mDataSource.pLocator = (void*)&mUri; xaRes = (*dynamicSourceItf)->SetSource(dynamicSourceItf, &mDataSource); retVal = mapError(xaRes, ETrue); RET_ERR_IF_ERR(retVal); } else { // Create media player object // Setup the data source // TODO Hard coded locator type mUri.locatorType = XA_DATALOCATOR_URI; //append zero terminator to end of URI mUri.URI = (XAchar*) uriPtr.PtrZ(); //TODO Hard coded locator type mMime.containerType = XA_CONTAINERTYPE_WAV; //TODO Hard coded locator type mMime.formatType = XA_DATAFORMAT_MIME; mimeTypePtr.Set(mWAVMime->Des()); mMime.mimeType = (XAchar*)mimeTypePtr.Ptr(); mDataSource.pFormat = (void*)&mMime; mDataSource.pLocator = (void*)&mUri; //Setup the audio data sink mLocatorOutputDevice.locatorType = XA_DATALOCATOR_IODEVICE; mLocatorOutputDevice.deviceType = 6; mAudioSink.pLocator = (void*) &mLocatorOutputDevice; mAudioSink.pFormat = NULL; //Init arrays required[] and iidArray[] for (i = 0; i < MAX_NUMBER_INTERFACES; i++) { required[i] = XA_BOOLEAN_FALSE; iidArray[i] = XA_IID_NULL; } noOfInterfaces = 0; required[noOfInterfaces] = XA_BOOLEAN_FALSE; iidArray[noOfInterfaces] = XA_IID_SEEK; noOfInterfaces++; required[noOfInterfaces] = XA_BOOLEAN_FALSE; iidArray[noOfInterfaces] = XA_IID_DYNAMICSOURCE; noOfInterfaces++; required[noOfInterfaces] = XA_BOOLEAN_FALSE; iidArray[noOfInterfaces] = XA_IID_METADATAEXTRACTION; noOfInterfaces++; required[noOfInterfaces] = XA_BOOLEAN_FALSE; iidArray[noOfInterfaces] = XA_IID_NOKIALINEARVOLUME; noOfInterfaces++; required[noOfInterfaces] = XA_BOOLEAN_FALSE; iidArray[noOfInterfaces] = XA_IID_NOKIAVOLUMEEXT; noOfInterfaces++; required[noOfInterfaces] = XA_BOOLEAN_FALSE; iidArray[noOfInterfaces] = XA_IID_PREFETCHSTATUS; noOfInterfaces++; required[noOfInterfaces] = XA_BOOLEAN_FALSE; iidArray[noOfInterfaces] = XA_IID_STREAMINFORMATION; noOfInterfaces++; required[noOfInterfaces] = XA_BOOLEAN_FALSE; iidArray[noOfInterfaces] = XA_IID_PLAYBACKRATE; noOfInterfaces++; required[noOfInterfaces] = XA_BOOLEAN_FALSE; iidArray[noOfInterfaces] = XA_IID_VIDEOPOSTPROCESSING; noOfInterfaces++; xaRes = (*mEOEngine)->GetInterface(mEOEngine, XA_IID_ENGINE, (void**) &engineItf); retVal = mapError(xaRes, ETrue); RET_ERR_IF_ERR(retVal); xaRes = (*engineItf)->CreateMediaPlayer(engineItf, &mMOPlayer, &mDataSource, NULL, &mAudioSink, &mVideoSink, NULL, NULL, noOfInterfaces, iidArray, required); retVal = mapError(xaRes, ETrue); RET_ERR_IF_ERR(retVal); xaRes = (*mMOPlayer)->Realize(mMOPlayer, XA_BOOLEAN_FALSE); retVal = mapError(xaRes, ETrue); RET_ERR_IF_ERR(retVal); mbMediaPlayerUnrealized = FALSE; xaRes = (*mMOPlayer)->RegisterCallback(mMOPlayer, MediaPlayerCallback, (void*)this); retVal = mapError(xaRes, ETrue); RET_ERR_IF_ERR(retVal); xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_PLAY, &mPlayItf); retVal = mapError(xaRes, ETrue); RET_ERR_IF_ERR(retVal); xaRes = (*mPlayItf)->RegisterCallback(mPlayItf, PlayItfCallback, (void*)this); retVal = mapError(xaRes, ETrue); RET_ERR_IF_ERR(retVal); xaRes = (*mPlayItf)->SetPositionUpdatePeriod(mPlayItf, (XAmillisecond)KPlayPosUpdatePeriod); retVal = mapError(xaRes, ETrue); RET_ERR_IF_ERR(retVal); xaRes = (*mPlayItf)->SetCallbackEventsMask( mPlayItf, ( XA_PLAYEVENT_HEADATEND | XA_PLAYEVENT_HEADATNEWPOS | XA_PLAYEVENT_HEADMOVING ) ); retVal = mapError(xaRes, ETrue); RET_ERR_IF_ERR(retVal); xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_SEEK, &mSeekItf); retVal = mapError(xaRes, ETrue); //Metadata xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_METADATAEXTRACTION, &mMetadataExtItf); if(mapError(xaRes, ETrue)==KErrNone) { mbMetadataAvailable = ETrue; setupALKeyMap(); //done only once at creation of meadia player } //volume xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_NOKIALINEARVOLUME, &mNokiaLinearVolumeItf); if(mapError(xaRes, ETrue)==KErrNone) mbVolEnabled = ETrue; xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_NOKIAVOLUMEEXT, &mNokiaVolumeExtItf); if(mapError(xaRes, ETrue)==KErrNone) mbMuteEnabled = ETrue; //buffer status xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_PREFETCHSTATUS, &mPrefetchStatusItf); if(mapError(xaRes, ETrue)==KErrNone) { mbPrefetchStatusChange = ETrue; (*mPrefetchStatusItf)->RegisterCallback(mPrefetchStatusItf, PrefetchItfCallback, (void*)this); (*mPrefetchStatusItf)->SetCallbackEventsMask(mPrefetchStatusItf, XA_PREFETCHEVENT_FILLLEVELCHANGE); } //stream information xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_STREAMINFORMATION, &mStreamInformationItf); if(mapError(xaRes, ETrue)==KErrNone) { mbStreamInfoAvailable = ETrue; mParent.cbStreamInformation(ETrue); //indicate first time (*mStreamInformationItf)->RegisterStreamChangeCallback(mStreamInformationItf, StreamInformationItfCallback, (void*)this); } //playback rate xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_PLAYBACKRATE, &mPlaybackRateItf); if(mapError(xaRes, ETrue)==KErrNone) mbPlaybackRateItfAvailable = ETrue; //videopostprocessing xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_VIDEOPOSTPROCESSING, &mVideoPostProcessingItf); if(mapError(xaRes, ETrue)==KErrNone) mbScalable = ETrue; } if(mbMetadataAvailable) { keyMap.clear(); extendedKeyMap.clear(); setupMetaData(); //done every time source is changed } else { //send signal for seekable mParent.cbSeekableChanged(ETrue); } mCurPosition = 0; mParent.cbPositionChanged(mCurPosition); xaRes = (*mPlayItf)->GetDuration(mPlayItf, &dur); retVal = mapError(xaRes, ETrue); RET_ERR_IF_ERR(retVal); mDuration = dur; mParent.cbDurationChanged(mDuration); return retVal; }
// ----------------------------------------------------------------------------- // CUpnpFileTransferEvent::SetFilePath // ----------------------------------------------------------------------------- // EXPORT_C void CUpnpFileTransferEvent::SetFilePathL(const TDesC& aFilePath) { delete iFilePath; iFilePath = NULL; iFilePath = aFilePath.AllocL(); }