diff -r 7333d7932ef7 -r 8b7f4e561641 installationservices/swi/source/sisregistry/server_legacy/sisregistrycache.cpp --- a/installationservices/swi/source/sisregistry/server_legacy/sisregistrycache.cpp Tue Aug 31 15:21:33 2010 +0300 +++ b/installationservices/swi/source/sisregistry/server_legacy/sisregistrycache.cpp Wed Sep 01 12:22:02 2010 +0100 @@ -82,20 +82,23 @@ // General note: trap the error because this is not a leaving function // and generating an error will not help - // store the backup file out - TRAP(res, StoreBackupL()); - if (res != KErrNone) - { - DEBUG_PRINTF2(_L8("Sis Registry Server - Failed to store backup (failure code: %d.)"), res); - } + if (iIntegrityService) + { + // store the backup file out + TRAP(res, StoreBackupL()); + if (res != KErrNone) + { + DEBUG_PRINTF2(_L8("Sis Registry Server - Failed to store backup (failure code: %d.)"), res); + } - // integrity service operation committing point - TRAP(res, iIntegrityService->CommitL()); - if (res != KErrNone) - { - DEBUG_PRINTF2(_L8("Sis Registry Server - Failed to commit integrity services changes (failure code %d.)"), res); - } - + // integrity service operation committing point + TRAP(res, iIntegrityService->CommitL()); + if (res != KErrNone) + { + DEBUG_PRINTF2(_L8("Sis Registry Server - Failed to commit integrity services changes (failure code %d.)"), res); + } + } + delete iBackupFile; delete iIntegrityService; @@ -183,14 +186,22 @@ void CSisRegistryCache::PackageListL(RPointerArray& aPackages) const { + CleanupResetAndDestroyPushL(aPackages); aPackages.ResetAndDestroy(); + for (TInt i = 0; i < iTokens.Count(); i++) { CSisRegistryPackage *package = CSisRegistryPackage::NewLC(*iTokens[i]); aPackages.AppendL(package); CleanupStack::Pop(package); } + CleanupStack::Pop(&aPackages); } + +const RPointerArray& CSisRegistryCache::TokenList() const + { + return iTokens; + } RFs& CSisRegistryCache::RFsHandle() { @@ -438,7 +449,7 @@ User::Leave(KErrCorrupt); } - iTokens.Append(token); + iTokens.AppendL(token); CleanupStack::Pop(token); CleanupStack::PopAndDestroy(&fileStream); @@ -514,6 +525,13 @@ void CSisRegistryCache::InitStartUpL() { + TRAPD(res, UpdateRecentFWVersionL();); + if (res != KErrNone) + { + // log that + DEBUG_PRINTF2(_L8("Updating recent Firmware Version failed with error code = %d."), res); + } + // else reinit lists- initial settings, esp at the first reboot BuildUidListL(); iUseIntegServices = EFalse; // temporarily "turn off" integrity services. It is not needed to process ROM stubs @@ -525,13 +543,6 @@ // only when all is processed one can check the package state UpdatePackagePresentStateL(); - - TRAPD(res, UpdateRecentFWVersionL();); - if (res != KErrNone) - { - // log that - DEBUG_PRINTF2(_L8("Updating recent Firmware Version failed with error code = %d."), res); - } } void CSisRegistryCache::StoreBackupL() @@ -715,19 +726,22 @@ void CSisRegistryCache::SidToPackageL(const TUid aSid, RArray& aListMatchingPackages) const { - for (TInt i = 0; i < iTokens.Count(); i++) + CleanupClosePushL(aListMatchingPackages); + for (TInt i = 0; i < iTokens.Count(); i++) + { + if (iTokens[i]->SidPresent(aSid)) { - if (iTokens[i]->SidPresent(aSid)) - { - aListMatchingPackages.AppendL(*iTokens[i]); - } + aListMatchingPackages.AppendL(*iTokens[i]); } + } DEBUG_PRINTF2(_L("SidToPackageL ListMatchingPackages->Count = %d"), aListMatchingPackages.Count()); if(aListMatchingPackages.Count() == 0 ) { User::Leave(KErrNotFound); } + + CleanupStack::Pop(&aListMatchingPackages); } TBool CSisRegistryCache::ModifiableL(const TDesC& aFileName) @@ -835,6 +849,7 @@ void CSisRegistryCache::PackageAugmentationsL(const TUid aUid, RPointerArray& aPackages) const { + CleanupResetAndDestroyPushL(aPackages); for (TInt i = 0; i < iTokens.Count(); i++) { if ((iTokens[i]->Uid() == aUid) && (iTokens[i]->Index() != CSisRegistryPackage::PrimaryIndex)) @@ -844,6 +859,7 @@ CleanupStack::Pop(tmp); } } + CleanupStack::Pop(&aPackages); } TInt CSisRegistryCache::PackageAugmentationsNumber(const TUid aUid) const @@ -1006,11 +1022,13 @@ RPointerArray& aDependents ) { + CleanupResetAndDestroyPushL(aDependents); aDependents.ResetAndDestroy(); // if it is an augmentation - nothing depends on it if (aObject.InstallType() == Sis::EInstAugmentation || aObject.InstallType() == Sis::EInstPreInstalledPatch) { + CleanupStack::Pop(&aDependents); return; } @@ -1062,11 +1080,13 @@ CleanupStack::PopAndDestroy(2, &stream);// &stream, tmpObject } } + CleanupStack::Pop(&aDependents); } void CSisRegistryCache::EmbeddingPackagesL(const CSisRegistryObject& aObject, RPointerArray& aEmbeddingPackages) { + CleanupResetAndDestroyPushL(aEmbeddingPackages); aEmbeddingPackages.ResetAndDestroy(); TUid matchingUid = aObject.Uid(); @@ -1091,12 +1111,14 @@ } // delete entry & stream CleanupStack::PopAndDestroy(2, &stream);// &stream, tmpObject - } + } + CleanupStack::Pop(&aEmbeddingPackages); } void CSisRegistryCache::GenerateChainListL(const CSisRegistryObject& aObject, RPointerArray& aChainList) { + CleanupResetAndDestroyPushL(aChainList); aChainList.ResetAndDestroy(); // read the controller for every member of the list for (TInt i = 0; i < aObject.ControllerInfo().Count(); i++) @@ -1118,6 +1140,7 @@ // release the data CleanupStack::PopAndDestroy(3, name); // fileProvider, controller } + CleanupStack::Pop(&aChainList); } HBufC8* CSisRegistryCache::LoadControllerLC(const CSisRegistryObject& aObject, TUint aIndex) @@ -1394,9 +1417,10 @@ void CSisRegistryCache::ControllerDriveListL(const CSisRegistryObject& aObject, RArray& aDriveList) { + CleanupClosePushL(aDriveList); aDriveList.Reset(); // a copy of the controller is always kept on drive C - aDriveList.Append(iSystemDrive); + aDriveList.AppendL(iSystemDrive); // only controllers will be written to removable media and // we have now to check for those @@ -1404,21 +1428,22 @@ TUint fixedDrives = FixedDrives(); TUint remainingDrives = installationDrives & ~fixedDrives; - if (remainingDrives) + if (remainingDrives) + { + TInt index = 0; + // reuse the path but change drive letter + while (remainingDrives) { - TInt index = 0; - // reuse the path but change drive letter - while (remainingDrives) + // compare a single drive digit + if (remainingDrives & 0x00000001) { - // compare a single drive digit - if (remainingDrives & 0x00000001) - { - User::LeaveIfError(aDriveList.Append(index)); - } - remainingDrives>>=1; - index++; + User::LeaveIfError(aDriveList.Append(index)); } + remainingDrives>>=1; + index++; } + } + CleanupStack::Pop(&aDriveList); } @@ -2048,6 +2073,8 @@ CSisRegistryObject* obj = 0; TUint id = 0; + CleanupResetAndDestroyPushL(aPackages); + aPackages.ResetAndDestroy(); for (TInt i = 0; i < iTokens.Count(); i++) { @@ -2064,6 +2091,7 @@ CloseReadHandleL(id); } + CleanupStack::Pop(&aPackages); } void CSisRegistryCache::RecoverL()