void RArrayCopyTestL()
	{
	test.Start(_L("Selftest of RArray CopyL"));

	RArray<TInt> orig;
	TInt i;													// VC++
	for(i=0; i<10; i++)
		{
		orig.AppendL(i);
		}

	RArray<TInt> newArray;
	CopyL(orig, newArray);

	test_Equal(10, newArray.Count());

	for(i=0; i<10; i++)
		{
		test_Equal(orig[i], newArray[i])
		}

	orig.Close();
	newArray.Close();
	test.End();
	}
// ---------------------------------------------------------------------------
// Sets available IAPs of this type as available in CommsDat cache
// ---------------------------------------------------------------------------
//
void TConnMonBearerWLAN::FlagAvailableIaps() const
    {
    LOGENTRFN("TConnMonBearerWLAN::FlagAvailableIaps()")

    RArray<TUint> availableIdArray;
    RArray<TUint> activeIdArray;

    iConnMonIAP->GetActiveConnectionsIds( EBearerIdWLAN, activeIdArray );

    if ( activeIdArray.Count() == 0 )
        {
        iConnMonIAP->AppendAvailableWLANIaps( availableIdArray );
        }
    else
        {
        LOGIT1("Found %d active WLAN IAPs", activeIdArray.Count())

        // Policy based roaming. If current WLAN connection RSS (received
        // signal strength) is not strong enough, don't give any WLAN IAPs in
        // available state.
        if ( iConnMonIAP->WlanRssGoodEnough() )
            {
            // KErrDisconnected will be returned if request for used SSID from WLAN engine fails.
            TInt err = iConnMonIAP->AppendAvailableWLANIapsBySsid( availableIdArray );
            if ( err != KErrNone )
                {
                availableIdArray.Reset();
                if ( err == KErrDisconnected )
                    {
                    activeIdArray.Reset(); // No longer connected.
                    iConnMonIAP->AppendAvailableWLANIaps( availableIdArray );
                    }
                }
            }
        else
            {
            // Current WLAN RSS is too weak, don't report any WLAN IAPs available.
            availableIdArray.Reset();
            activeIdArray.Reset();
            }
        }

    for ( TInt i = 0; i < availableIdArray.Count(); i++ )
        {
        iCommsDatCache->SetAvailableIapWithId( availableIdArray[i] );
        }
    for ( TInt i = 0; i < activeIdArray.Count(); i++ )
        {
        // This will only add EasyWLAN IAP ID as available in those cases when
        // the connection was started with it. This is done so there can't be a
        // situation when a connection is up but ConnMon reports that
        // connections IAP as unavailable. (EasyWLAN IAP has empty SSID field in
        // CommsDat, so AppendAvailableWLANIapsBySsid-method will not find it).
        iCommsDatCache->SetAvailableIapWithId( activeIdArray[i] );
        }

    availableIdArray.Close();
    activeIdArray.Close();
    LOGEXITFN("TConnMonBearerWLAN::FlagAvailableIaps()")
    }
TBool CSwisExpressionEnvironment::DeviceLanguageL(const TDesC& aLanguageIdString)
	{
	TPtrC parseString(aLanguageIdString);
	TBool deviceSupportedFlag;
	TInt langId = ParseLanguageId(parseString);
	if(langId == KErrNotFound)
		{
		return EFalse;
		}	
	
	//Set the iHasDeviceSupportedLanguages flag
	(const_cast <CApplication&> (iApplication)).SetDeviceSupportedLanguages(ETrue);
	
	deviceSupportedFlag = iApplication.IsDeviceMatchingLanguage(langId);
	
	if ( !deviceSupportedFlag )
		{
		RSisHelper iSisHelper = (const_cast <CApplication&> (iApplication)).GetSisHelper();
		RArray<TInt> deviceSupportedLanguages = (const_cast <CApplication&> (iApplication)).GetDeviceSupportedLanguages();
		TInt size = deviceSupportedLanguages.Count();
		RArray<TLanguage> equivalentLangArray;
		CleanupClosePushL(equivalentLangArray);
		
		for ( TInt i=0; i < size; i++)
			{
			iSisHelper.GetEquivalentLanguageListL((TLanguage)deviceSupportedLanguages[i],equivalentLangArray);
			TInt equivalentArraySize = equivalentLangArray.Count();
			for ( TInt j=0; j < equivalentArraySize; j++ )
				{
				if (equivalentLangArray[j] == langId )
					{
					(const_cast <CApplication&> (iApplication)).SetLanguageMatch(ETrue);
					(const_cast <CApplication&> (iApplication)).PopulateMatchingDeviceLanguagesL(langId);
					equivalentLangArray.Close();
					CleanupStack::Pop(&equivalentLangArray);
					return ETrue;
					}
				}
			equivalentLangArray.Close();	
			}
		CleanupStack::Pop(&equivalentLangArray);
		}
	// Set the iHasMatchingLanguages flag if there is an exact match between the 
	// languages which device supports and SUPPORTED_LANGUAGE token in PKG file.	
	if(deviceSupportedFlag)
		{
		(const_cast <CApplication&> (iApplication)).SetLanguageMatch(ETrue);
		(const_cast <CApplication&> (iApplication)).PopulateMatchingDeviceLanguagesL(langId);
		}
	return deviceSupportedFlag;
	}
TInt CTestHistoryLog::AddMoreThanFiveJobsL( CStifItemParser& /*aItem*/ )
	{
	for (TInt i = 0; i < KMaxMsgSize; i++)
		{
		RArray<TInt> tasks;
		tasks.Append(KTaskId1);
		tasks.Append(KTaskId2);
	
		CSyncMLHistoryJob * entry = CSyncMLHistoryJob::NewL(i, tasks );
		CleanupStack::PushL(entry);
	
		tasks.Reset();
		tasks.Close();

		iHistoryArray->AppendEntryL(entry);

	if (iOwnerShip)
		{
		CleanupStack::Pop(entry);
		}
	else
		{
		CleanupStack::PopAndDestroy(entry);
		}
		}
	TL(iHistoryArray->Count() == KMaxMsgSize);
	
	return KErrNone;
	}
TInt CTestHistoryLog::AddNewJobEntryL( CStifItemParser& /*aItem*/ )
	{
	TInt arrayCount = iHistoryArray->Count() + 1;
	TInt profileId(1);	
	RArray<TInt> tasks;
	tasks.Append(KTaskId1);
	tasks.Append(KTaskId2);
	
	CSyncMLHistoryJob * entry = CSyncMLHistoryJob::NewL(profileId, tasks );
	CleanupStack::PushL(entry);
	
	tasks.Reset();
	tasks.Close();

	iHistoryArray->AppendEntryL(entry);
	
	TL(iHistoryArray->Count() == arrayCount);
	
	if (iOwnerShip)
		{
		CleanupStack::Pop(entry);
		}
	else
		{
		CleanupStack::PopAndDestroy(entry);		
		}	
	return KErrNone;
	}
//*************************************************************************************
EXPORT_C void ASTstAlarmTest::TestClearStoreL()
//
//	Clear any settings that may have been stored
//  Method could leave when trying to get list of all alarm categories in use within the alarm server.
//
	{
	iTest(iAlarmServer.Handle() != KNullHandle);

	// Delete all alarms
	RArray<TAlarmCategory> categories;
	iAlarmServer.GetAvailableCategoryListL(categories); 
	TInt count = categories.Count();
	for(TInt i=0; i<count; i++)
		{
		const TAlarmCategory category = categories[i];
		iTest(iAlarmServer.AlarmDeleteAllByCategory(category, EFalse) == KErrNone);
		}
	categories.Close();

	// Restore alarm sound
	iAlarmServer.SetAlarmSoundState(EAlarmGlobalSoundStateOn);

	// Check there aren't any queued alarms (not a particularly good
	// test, but better than nothing).
	count = iAlarmServer.NumberOfAlarmsActiveInQueue();
	iTest(!count);
	}
void CUninstallMachine::PostJournalFinalizationL(TInt)
    {    
    if (!iPlan)
        {
        return;
        }
    
    DEBUG_PRINTF(_L8("Uninstall Machine - PostJournalFinalization"));
    RSisLauncherSession launcher;
        
    if (launcher.Connect() != KErrNone)
        {
        DEBUG_PRINTF(_L8("Uninstall Machine - Failed to connect to SisLauncher"));
        return;
        }
    CleanupClosePushL(launcher);
        
    //Notify apparc for the the change in the Applications
    RArray<TAppUpdateInfo> affectedApps;
    CleanupClosePushL(affectedApps);
    iPlan->GetAffectedApps(affectedApps);
    if (affectedApps.Count() > 0)
        {
        launcher.NotifyNewAppsL(affectedApps);
        }
    affectedApps.Close();
    CleanupStack::PopAndDestroy(2, &launcher);  //affectedApps
    }
void CBCTestPtiEngine::TestLanguageL()
    {
    CArrayFixFlat<TInt>* langs = new (ELeave) CArrayFixFlat<TInt>(100);
    CleanupStack::PushL(langs);
    iEngine->GetAvailableLanguagesL(langs);

    AssertTrueL(langs->Count()>0, _L("available languages got"));
    CleanupStack::PopAndDestroy( 1 ); // cores, langs

    RArray<TInt> langRefs;
    iEngine->GetAvailableLanguagesL(langRefs);
    AssertTrueL(langRefs.Count()>0, _L("available languages got into RArray"));

    //
    //activate
    //
    if(langRefs.Count())
        {
        MPtiLanguage *lan = iEngine->GetLanguage(langRefs[0]);
        if (lan->HasInputMode(EPtiEngineMultitapping))
            {
            iEngine->ActivateLanguageL(lan->LanguageCode(), EPtiEngineMultitapping);
            AssertTrueL( ETrue, _L("activate multitapping"));
            }
        else
            {
            iEngine->ActivateLanguageL(lan->LanguageCode(), EPtiEnginePredictive);
            AssertTrueL( ETrue, _L("activate predictive"));
            }
        }

    langRefs.Close();
    }
// ---------------------------------------------------------
// Store input language to Repository
// ---------------------------------------------------------
//
void CGSPenInputModel::SetInputLanguageL()
    {
    RArray<TInt> languageCodeArray;
    iPtiEngine->GetAvailableLanguagesL(languageCodeArray);
 
    const TInt count = languageCodeArray.Count();
 
    if (iLanguageIndex <= count)
        {
        iInputLanguage = languageCodeArray[iLanguageIndex];
        iAknfepRepository->Set(KAknFepInputTxtLang, iInputLanguage);    
        }

    languageCodeArray.Reset();
    languageCodeArray.Close();    

    // Remember which chinese language variant was used 
    // for the chinese find method setting
    TUint key = ChineseFindMethodCRKey();
    if(key != iLastChineseFindMethodItem)
        {
        iAknRepository->Set(KAknAdaptiveSearchLastChinese, (int)key);
        iLastChineseFindMethodItem = key;
        }
    }
// ----------------------------------------------------
// CFindItemVoIPExtension::VoIPProfilesExistL
//
// ----------------------------------------------------
TBool CFindItemVoIPExtension::VoIPProfilesExistL() const
    {
#ifndef RD_VOIP_REL_2_2
  TBool isProfiles = EFalse;

    if ( iVoIPSupported )
        {
        RArray<TUint32> profileArray;

        CRCSEProfileRegistry* rcseProfileRegistry = CRCSEProfileRegistry::NewLC();
        rcseProfileRegistry->GetAllIdsL( profileArray );

        if ( profileArray.Count() > 0 )
            {
            isProfiles = ETrue;
            }

        profileArray.Close();

        CleanupStack::PopAndDestroy(); // rcseProfile
        }

    return isProfiles;
#else // RD_VOIP_REL_2_2
    TBool ret( EFalse );

    if ( FeatureManager::FeatureSupported( KFeatureIdCommonVoip ) )
        {
        ret = iSPSettings->IsFeatureSupported( ESupportVoIPFeature );
        }

    return ret;
#endif // !RD_VOIP_REL_2_2
    }
QList<int> S60CameraSettings::supportedIsoSensitivities()
{
    QList<int> isoSentitivities;
#ifdef POST_31_PLATFORM

    if (m_advancedSettings) {
        RArray<TInt> supportedIsoRates;

        TRAPD(err, m_advancedSettings->GetSupportedIsoRatesL(supportedIsoRates));
        if (err != KErrNone)
            if (err != KErrNotSupported)
                emit error(QCamera::CameraError, QString("Failure while querying supported iso sensitivities."));
            else {
                for (int i = 0; i < supportedIsoRates.Count(); i++) {
                    int q = supportedIsoRates[i];
                    isoSentitivities.append(q);
                }
            }
        supportedIsoRates.Close();
    }
    else
        emit error(QCamera::CameraError, QString("Unexpected camera error."));

    return isoSentitivities;
#else // S60 3.1 Platform
    return isoSentitivities;
#endif // POST_31_PLATFORM
}
// ---------------------------------------------------------------------------
// CJavaRegistry::SuiteEntryExistsL
// ---------------------------------------------------------------------------
//
TBool CJavaRegistry::SuiteEntryExistsL(TUid aSuiteUid) const
{
    JELOG2(EJavaStorage);

    if (aSuiteUid == TUid::Null())
    {
        User::Leave(KErrArgument);
    }

    RArray<TUid> suiteUids;

    // New registry filters non-present applictions.
    iRegistry->GetRegistryEntryUidsL(Java::EMidp2MidletSuite, suiteUids);
    int result = suiteUids.Find(aSuiteUid);

    suiteUids.Close();

    TBool exists = EFalse;

    if (KErrNotFound != result)
    {
        exists = ETrue;
    }
    return exists;
}
void CIkeV2PkiService::CIkeV2PkiServiceApplUidArrayCleanup(TAny* any)
    {
    RArray<TUid>* applUidList = reinterpret_cast<RArray<TUid>*>(any);
    applUidList->Reset();
    applUidList->Close();
    delete applUidList;    
    }
QList<qreal> S60CameraSettings::supportedShutterSpeeds()
{
    QList<qreal> speeds;

#ifdef POST_31_PLATFORM
    if (m_advancedSettings) {
        RArray<TInt> supportedSpeeds;
        TValueInfo info = ENotActive;

        TRAPD(err, m_advancedSettings->GetShutterSpeedsL(supportedSpeeds, info));
        if (err != KErrNone)
            if (err != KErrNotSupported)
                emit error(QCamera::CameraError, QString("Failure while querying supported shutter speeds."));
            else {
                for (int i = 0; i < supportedSpeeds.Count(); i++) {
                    qreal q = supportedSpeeds[i];
                    speeds.append(q);
                }
            }
        supportedSpeeds.Close();
    }
    else
        emit error(QCamera::CameraError, QString("Unexpected camera error."));
    return speeds;
#else // S60 3.1 Platform
    return speeds;
#endif // POST_31_PLATFORM
}
// ---------------------------------------------------------------------------
// CLbtAppChangeHandler::HandleAppListEvent
// ---------------------------------------------------------------------------
//
void CLbtAppChangeHandler::HandleAppListEvent(TInt /*aEvent*/)
	{
	FUNC_ENTER("CLbtAppChangeHandler::HandleAppListEvent");
	if( iOperation == EOpNone && !IsActive() )
		{
		iOperation = EOpRegiseteredForListPoplulation;
		iAppArcSession.RegisterListPopulationCompleteObserver(iStatus);
		SetActive();
		return;
		}
	iOperation = EOpNone;
	RArray<TLbtAppInfo> newAppList;
	
	// First get the set of installed applications in the system
	iAppArcSession.GetAllApps();
	
	TApaAppInfo appInfo;
	TInt error = iAppArcSession.GetNextApp(appInfo);
	
	while(KErrNone == error)
		{
		TLbtAppInfo lbtAppInfo;
        lbtAppInfo.iUid = appInfo.iUid;
        lbtAppInfo.iFullName.Zero();
        lbtAppInfo.iFullName.Copy( appInfo.iFullName );

		TRAPD(err, newAppList.AppendL(lbtAppInfo));
		if(err != KErrNone)
			{
			break;
			}
		error = iAppArcSession.GetNextApp(appInfo);
		}
	
	LOG1("newAppList.Count():%d",newAppList.Count());
	LOG1("iCurrentInstalledApps.Count():%d",iCurrentInstalledApps.Count());
	
	if(newAppList.Count() > iCurrentInstalledApps.Count())
		{
		HandleAppListAdditionEvent(newAppList);
		}
	else
		{
		LOG("newAppList.Count() < iCurrentInstalledApps.Count()");
		HandleAppListRemovalEvent(newAppList);
		}
		
	iCurrentInstalledApps.Reset();
	
	for( TInt i=0;i<newAppList.Count();i++ )
	    {
	    TInt error = iCurrentInstalledApps.Append( newAppList[i] );
	    if( error != KErrNone )
	        {
            LOG1("Failed to append new applist to the array:%d",error);
            break;
	        }
	    }
	newAppList.Close();
	}
void CBCTestKeymap::TestCreateL()
    {
    //raw data format:
    //
    // #map //=2*KPtiNumKeys*sizeof(TPtiKeyMapping) = 2*12*(2*sizeof(int))
    // {index, chars}, {index, chars}, ... , {index, chars} //lower case
    // {INDEX, CHARS}, {INDEX, CHARS}, ... , {INDEX, CHARS} //upper case
    //
    // #chars
    // char1, char2, ... , charN
    //

    TInt16 charBuffer[1+(KPtiNumKeys*2)*2+1+sizeof(Keys)/sizeof(TUint16)];

    RArray<TPtiKeyMapping> maps;
    for (TInt i = 0; i < KPtiNumKeys * 2; i++)
        {
        TPtiKeyMapping map = {0, 0};
        maps.AppendL( map );
        }

    TInt16* ptr = charBuffer+1+maps.Count()*2+1;
    TInt curKey=0;
    TInt index=0;
    for (TInt i = 0; i < sizeof(Keys)/sizeof(TUint16)-1; ++i)
        {
        if (Keys[i] == '\t')
            {
            maps[++curKey].iIndex = index;
            continue;
            }

        *(ptr+index)= Keys[i];
        index++;
        maps[curKey].iNumChars++;
        }

    charBuffer[0]=maps.Count();
    ptr=charBuffer+1;
    for(TInt i=0; i<maps.Count(); ++i)
        {
        *ptr=maps[i].iIndex;
        ptr++;
        *ptr=maps[i].iNumChars;
        ptr++;
        }
    *ptr=index;
    maps.Close();

    Teardown();
    TRAPD(err, iMap = CPtiKeyMappings::NewL(charBuffer));
    if(err == KErrCorrupt)
        {
        AssertTrueL(ETrue, _L("data format err"));
        }
    else
        {
        AssertNotNullL(iMap, _L("created by NewL from raw data"));
        }   
    }
// Tokenize the property list taken from ini file and check for non-existence of these properties in the exported file.
void CTestCompareCntFiles::TokenizeAndCheckNoFieldL()
	{
	TBool result = EFalse;
	RArray<TPtrC>	fieldList;
	CleanupClosePushL(fieldList);
	iExportObj->TokenizeStringL(iNoField, fieldList);
	TInt count = fieldList.Count();
	
	for(TInt i = 0;i < count;i++)
		{	
		result = CheckForNoFieldL(iExportFilePath, fieldList[i]);
		
		if(result)
			{
			INFO_PRINTF1(_L("Success: Property not present in vCard"));
			}
		else
			{
			INFO_PRINTF1(_L("Error: Property present in vCard"));
			SetTestStepResult(EFail);
			break;
			}
		}
	CleanupStack::PopAndDestroy();
	fieldList.Close();	
	}
TBool CHuiFxEngine::FxmlUsesInput1(CHuiFxEffect& aEffect)
    {
    RArray<THuiFxVisualSrcType> array;
    aEffect.FxmlVisualInputs(array);
 
    TInt c = array.Count();
    for(TInt i = 0; i<c; i++)
        {
        THuiFxVisualSrcType val = array[i];
        if (val == EVisualSrcInput1)
            {
            array.Close();
            return ETrue;
            }
        }
    array.Close();
    return EFalse;    
    }
// ---------------------------------------------------------
// Get Popup Query languages from ptiengine    
// ---------------------------------------------------------
//
void CGSPenInputModel::GetPopupQuerylanguagesFromPtiL(CDesCArray* aLanguageNames)    
    {
    RArray<TInt> languageCodeArray;

    iPtiEngine->GetAvailableLanguagesL(languageCodeArray);

    // Item format should be "<icon_index>\t<item_text>"
    _LIT( KIconIndexSelected, "0\t" );
    _LIT( KIconIndexNotSelected, "\t" );// No icon
    
    MPtiLanguage* lang = NULL;
    TBuf<KISOCodeLength>  isoCodeName;
    
    for (TInt index = 0; index < languageCodeArray.Count(); index ++)
        {
        lang = iPtiEngine->GetLanguage(languageCodeArray[index]);
        if (!lang)
            {
            User::Leave(KErrCorrupt);
            }
            
        // Buffer should contain both tabulator string and localized name:
        HBufC* langStrBuf = HBufC::NewL(lang->LocalizedName().Length() + 7);
        CleanupStack::PushL(langStrBuf);
        
        TPtr langStrPtr = langStrBuf->Des();
        // If language is current language - use selected icon in lbx:
        if(lang->LanguageCode() == InputLanguage())
            {
            langStrPtr.Append(KIconIndexSelected);
            iLanguageIndex = index;
            }
        else
            {
            langStrPtr.Append(KIconIndexNotSelected);    
            }
            
        langStrPtr.Append(lang->LocalizedName());
        
        //AdjustLanguageName(lang->LanguageCode(), langStrPtr); 
        
        /*if (AknPenInputUtils::GetISOLanguageCode(TLanguage(lang->LanguageCode()), 
                                                 isoCodeName))
            {
            langStrPtr.Append(KLeftBracket);
            langStrPtr.Append(isoCodeName);
            langStrPtr.Append(KRightBracket);
            }*/
        aLanguageNames->AppendL(langStrPtr);
        
        CleanupStack::PopAndDestroy(langStrBuf);
        }

    languageCodeArray.Reset();
    languageCodeArray.Close();     
    }
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
//
EXPORT_C void PosLmLandmarkHandler::ReadLandmarkL(
    RDbRowSet& aView,
    CPosLmLocalDbAccess& aDbAccess,
    CPosLandmark& aLandmark)
    {
    RArray<TUint> dummy; // Not used here. All fields should be read.
    ReadLandmarkL( 
        aView, aDbAccess, aLandmark, CPosLandmark::EAllAttributes, EFalse, dummy);
    dummy.Close();
    }
void Ut_CSpsBufferedPublisher::Ut_CSpsBufferedPublisher_DataValidyL()
{

    for( TInt i(0); i < 100000; i++ )
    {
        CSpsBufferedPublisher::SetL( KUidSystemCategory, KSPNotifyChangeKey, i );

        RArray<TUint32> array;
        iPublisher->GetL( array );
        EUNIT_ASSERT_EQUALS( 1, array.Count() );
        EUNIT_ASSERT_EQUALS( i, array[0] );
        array.Close();
    }

    RArray<TUint32> array;
    iPublisher->GetL( array );
    EUNIT_ASSERT_EQUALS( 0, array.Count() );
    array.Close();
}
// ---------------------------------------------------------------------------
// Order of function calls fix the layout of grid in portrait and landscape modes.
// ---------------------------------------------------------------------------
// 
void CAlfExAnalogDialerControl::SetWeightsOfGridL(  CAlfGridLayout& aGridLayout,
                                                    TLayoutMode     aLayout,
                                                    TInt            aSquareSide,
                                                    TInt            aLongerSide,
                                                    TInt&           aPlateTop)
    {
    // Set up a variable for default value.
    RArray<TInt> weightsDefault;
    User::LeaveIfError(weightsDefault.Append(1));   

    // sets weights of grid. Use pizels of application window size to get exact adjustment of pane sizes
    RArray<TInt> weights;
    if (aLayout == ELayoutAnalogDialerPortrait)
        {
        // top: display; take rest what dialer plate leaves for number display
        User::LeaveIfError(weights.Append(aLongerSide-aSquareSide));

        // bottom: dialer, which must be square
        User::LeaveIfError(weights.Append(aSquareSide));
        aGridLayout.SetRowsL(weights);
        
        // default weight for dimension, which is 1. Needed, because weights are reset
        aGridLayout.SetColumnsL(weightsDefault);
        
        // Offset to the plate in Y-dimension is height of number display
        aPlateTop = aLongerSide-aSquareSide;
        }
    else
        {
        // left: dialer, which must be square
        User::LeaveIfError(weights.Append(aSquareSide));
        // right: display; take rest what dialer plate leaves for number display
        User::LeaveIfError(weights.Append(aLongerSide-aSquareSide));

        // default weight for dimension, which is 1. Needed, because weights are reset
        aGridLayout.SetRowsL(weightsDefault);
        aGridLayout.SetColumnsL(weights);
        
        aPlateTop = 0;
        }         
    weights.Close(); 
    weightsDefault.Close(); 
    }
void Ut_CSpsBufferedPublisher::Ut_CSpsBufferedPublisher_DataSizeL()
{
    const TUint32 data( 0xFFFFFFFF );
    CSpsBufferedPublisher::SetL( KUidSystemCategory, KSPNotifyChangeKey, data );
    RArray<TUint32> array;
    iPublisher->GetL( array );
    EUNIT_ASSERT_EQUALS( 1, array.Count() );
    EUNIT_ASSERT_EQUALS( data, array[0] );
    array.Close();
}
// handle enhanced notification
void CNotifyWatcher::HandleNotificationEnhanced(TBool aLastTime)
	{
	TInt num = iCounter;
	iMeanCounter++;
	
	TFsNotification::TFsNotificationType type;
	const TFsNotification* notification;
	
	while((notification = iNotify->NextNotification())!= NULL)
		{	
		iCounter++;
		type = notification->NotificationType();
		if (iOption & EBigBuffer)
			{
			SAFETEST1((type & OpNotifyMapping(iOption, iCurrentOp)), (iOption & KNotifyTreadIdMask));
			}
		else
			{
			SAFETEST1((type & (OpNotifyMapping(iOption, iCurrentOp) | TFsNotification::EOverflow)), (iOption & KNotifyTreadIdMask));
			}
		
      if(iOption & EReportChg)
            {
            if (type & TFsNotification::EOverflow)
                {
                iOverflowCounter++;
                RArray<TEntry> newEntries;
                FullDirectoryScanL(newEntries);
                MakeChangeRecordL(newEntries);
                newEntries.Close();
                }
            else
                {
                TPtrC ptr;
                notification->Path(ptr);
                TFileName name;
                name.Copy(ptr);
                TInt r = iRecords.Append(name);
                SAFETEST2(r, KErrNone, (iOption & KNotifyTreadIdMask));
                }
            }
		}
	
	if (aLastTime)
		{
		if (num == iCounter) // no new notification so this iteration doesn't count
		    {
		    iMeanCounter--;
		    }
		return;
		}
	
	iNotify->RequestNotifications(iStatus);
	SetActive();
	}
TBool CHuiFxEffectCacheEffectNode::FxmlUsesInput1()
    {
    CHuiFxEffect *effect = iEffect;

    RArray<THuiFxVisualSrcType> array;
    effect->FxmlVisualInputs(array);
 
    TInt c = array.Count();
    for(TInt i = 0; i<c; i++)
        {
        THuiFxVisualSrcType val = array[i];
        if (val == EVisualSrcInput1)
            {
            array.Close();
            return ETrue;
            }
        }
    array.Close();
    return EFalse;
    }
void MsgStoreHandler::RunL()
{
    TSsmState ssmState = iStateAwareSession.State();
    if (ssmState.MainState() != ESsmNormal) 
    {        
        iStateAwareSession.RequestStateNotification(iStatus);
        SetActive();
    }
    else 
    {
        //Create  the query/operation object
        CMsvSearchSortOperation *operation = CMsvSearchSortOperation::NewL(*iMsvSession);
        CleanupStack::PushL(operation);
        CMsvSearchSortQuery *query = CMsvSearchSortQuery::NewL();
        CleanupStack::PushL(query);

        //set the query options
        query->SetParentId(KMsvGlobalInBoxIndexEntryId);
        query->SetResultType(EMsvResultAsTMsvId);
        query->AddSearchOptionL(EMsvMtmTypeUID, KSenduiMtmSmsUidValue, EMsvEqual);
        query->AddSearchOptionL(EMsvUnreadMessages, ETrue);
        CleanupStack::Pop(query);

        CMsvOperationActiveSchedulerWait* wait = CMsvOperationActiveSchedulerWait::NewLC();
        //ownership of Query transferred to Operation  
        operation->RequestL(query, EFalse, wait->iStatus);
        wait->Start();

        //Get No of entries
        RArray<TMsvId> messageArray;
        operation->GetResultsL(messageArray);

        CMsvEntry* entry = NULL;
        for (TInt i = 0; i < messageArray.Count(); ++i) 
        {
            entry = iMsvSession->GetEntryL(messageArray[i]);
            TMsvSmsEntry smsEntry = entry->Entry();
            TSmsDataCodingScheme::TSmsClass classType(TSmsDataCodingScheme::ESmsClass0);
            if (smsEntry.Class(classType)) 
            {
                HandleClass0SmsL(entry, smsEntry.Id());
            }
            else
            {
                delete entry;
                entry = NULL;
            }
        }
        messageArray.Close();
        CleanupStack::PopAndDestroy(2, operation);
    }

}
/**
Run check buffers on the supplied TAddressParms array
*/
TBool DoTferParmTestL(const TAddressParms* aParms, TInt aCount, TBool aAllowRepeat, TBool aPositive)
	{
	_LIT(KPositive, "positive");
	_LIT(KNegative, "negative");
	test.Printf(_L("CheckBuffers %S test: %d args, repeats allowed %d\n"),
			(aPositive ? &KPositive : &KNegative), aCount, aAllowRepeat);
	RArray<const TAddressParms> array;
	ArrayAppendL(array, aParms, aParms + aCount);
	TPreTransferIncrBytes preTran;
	TBool r = preTran.CheckBuffers(array, aAllowRepeat);
	array.Close();
	return r;
	}
Exemple #28
0
HX_RESULT HXAudioConfiguratorAAC::ConfigureEAACPDecoder(CMMFCodec* pDecoder)
{
    HX_RESULT result = HXR_OK;

    HXLOGL2(HXLOG_MDFA, "HXAudioConfiguratorAAC::ConfigureEAACPDecoder()");
    HXLOGL2(HXLOG_MDFA, "Samples Per Second     : %lu", m_ulSamplesPerSecond);
    HXLOGL2(HXLOG_MDFA, "Number of Channels     : %u", m_uNumChannels);
    HXLOGL2(HXLOG_MDFA, "Profile Type           : %d", m_nProfileType);
    HXLOGL2(HXLOG_MDFA, "Profile Type: Unknown(-1), MP(0), LC(1), SSR(2), LTP(3)");
    HXLOGL2(HXLOG_MDFA, "Samples Per Frame      : %u", m_uSamplesPerFrame);
    HXLOGL2(HXLOG_MDFA, "Frame Length           : %u", m_uInputFrameLength);
    HXLOGL2(HXLOG_MDFA, "Samples Per Second     : %lu", m_ulSamplesPerSecond);
    HXLOGL2(HXLOG_MDFA, "Down Sample Mode       : %u", m_uDownSampleMode);
    HXLOGL2(HXLOG_MDFA, "Bits Per Sample        : %u", m_uBitsPerSample);
    HXLOGL2(HXLOG_MDFA, "Output SamplesPerSecond: %lu", m_ulOutSamplesPerSecond);
    HXLOGL2(HXLOG_MDFA, "Extension Object Type  : %u", m_uExtObjectType);
    HXLOGL2(HXLOG_MDFA, "Object Type            : Main(1), LC(2), SSR(3), LTP(4), SBR(5), SCALABLE(6), TWINVQ(7)");

    RArray<TInt> configParams;
    configParams.Append(m_ulSamplesPerSecond);	//  0: Input Sample Frequency
    configParams.Append(m_uNumChannels);	  //  1: Num Channels [1|2]
    configParams.Append(m_nProfileType);	  //  2: Input Profile Object type [1 - LC, 3 - LTP]
    configParams.Append(m_uSamplesPerFrame);	//  3: Output Frame Size
    configParams.Append(m_uInputFrameLength);	//  4: Input Frame Len [1024, 960]
    configParams.Append(m_ulSamplesPerSecond);	//  5: Input Sample Rate
    configParams.Append(0);			//  6: 0
    configParams.Append(m_uDownSampleMode);	//  7: Down Sample Mode [0|1]
    configParams.Append(m_uBitsPerSample);	//  8: Sample resolution, 8Khz (8-bit PCM) or 16Khz (16-bit)
    configParams.Append(m_ulOutSamplesPerSecond); //  9: Output Sample Frequency
    configParams.Append(m_uExtObjectType);	// 10: Extension Object Type

    TUid codecId = TUid::Uid(KUidMmfCodecAudioSettings);

    TRAPD(err, pDecoder->ConfigureL(codecId, (TDesC8&) configParams));
    if(KErrNone != err)
    {
	result = HXR_FAIL;
    }

    configParams.Close();

    // don't change the sample rate if we operate the SBR tool in
    // downsampled mode
    if(m_uDownSampleMode == 0)
    {
	// now that we're done configuring, update the true sample rate
	m_ulSamplesPerSecond = m_ulOutSamplesPerSecond;
    }

    return result;
}
// -----------------------------------------------------------------------------
// CSisxUIStartupFile::RemovePrivateFile
// Deletes the old startup file from private directory and returns all startup 
// items in that file.
// (other items were commented in a header).
// -----------------------------------------------------------------------------
//
TInt CSisxUIStartupFile::RemovePrivateFile( RArray<TStartupTaskParam>& aStartupItems )
    {
    TInt result( KErrNone );
    TRAP( result, ReadPrivateStartupItemsL( aStartupItems ) );
    if ( result == KErrNone )
        {
        iFileSession.Delete( *iPrivateFile );
        } 
    else
        {
        // Do some cleanup
        aStartupItems.Close();        
        }    
   
    return result;
    }
/**
@SYMTestCaseID          PDS-SQL-UT-4162
@SYMTestCaseDesc        CSqlServer::GetBackUpListL() file I/O error simulation test
@SYMTestPriority        High
@SYMTestActions         Calls CSqlServer::GetBackUpListL() in a file I/O error simulation loop.
@SYMTestExpectedResults Test must not fail
@SYMDEF                 DEF144096
*/  
void GetBackupListFileIoErrorTest()
    {
    CSqlServer* server = NULL;
    TRAPD(err, server = CreateSqlServerL());
    TEST2(err, KErrNone);

    for(TInt fsError=KErrNotFound;fsError>=KErrBadName;--fsError)
        {
        TheTest.Printf(_L("===Simulated error: %d\r\nIteration: "), fsError);
        err = KErrNotFound;
        TInt fileCnt = 0;
        TInt cnt=0;
        while(err<KErrNone)
            {
            TheTest.Printf(_L("%d "), cnt);
            (void)server->Fs().SetErrorCondition(fsError, cnt);
            const TUid KDbUd = {0x98765432};
            RArray<HBufC*> files;
            TRAP(err, server->GetBackUpListL(KDbUd, EDriveC, files));
            fileCnt = files.Count(); 
            if(err == KErrNone)
            	{
    			//No directories should be returned in the list of files for backup
    			for(TInt i=0;i<fileCnt;++i)
    				{
    				TPtrC fname = files[i]->Des();
    				TInt rc = KPrivateSubDir().CompareF(fname);
    				TEST(rc != 0);
    				}
            	}
            for(TInt j=0;j<files.Count();++j)
            	{
				delete files[j];
            	}
            files.Close();
            (void)server->Fs().SetErrorCondition(KErrNone);
            if(err != KErrNone)
                {
                ++cnt;
                }
            }
        TEST2(err, KErrNone);
        TheTest.Printf(_L("\r\n===File I/O error simulation test succeeded on iteration %d===\r\nFile count: %d\r\n"), cnt, fileCnt);
        }
        
    delete server;
    }