Skip to content

Commit

Permalink
Move to non-const param
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnMcPMS committed Nov 12, 2024
1 parent 2a54c09 commit 3998e64
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
16 changes: 5 additions & 11 deletions src/AppInstallerRepositoryCore/PackageTrackingCatalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ namespace AppInstaller::Repository
}

PackageTrackingCatalog::Version PackageTrackingCatalog::RecordInstall(
const Manifest::Manifest& manifest,
Manifest::Manifest& manifest,
const Manifest::ManifestInstaller& installer,
bool isUpgrade)
{
Expand All @@ -224,16 +224,10 @@ namespace AppInstaller::Repository
auto& index = m_implementation->Source->GetIndex();

// Strip ARP version information from the manifest if it is present
const Manifest::Manifest* effectiveManifest = &manifest;
Manifest::Manifest arpRangeRemovedManifest;

auto arpVersionRange = manifest.GetArpVersionRange();
if (!arpVersionRange.IsEmpty())
{
arpRangeRemovedManifest = manifest;
effectiveManifest = &arpRangeRemovedManifest;

for (auto& arpRangeRemovedInstaller : arpRangeRemovedManifest.Installers)
for (auto& arpRangeRemovedInstaller : manifest.Installers)
{
for (auto& arpRangeRemovedEntry : arpRangeRemovedInstaller.AppsAndFeaturesEntries)
{
Expand All @@ -243,15 +237,15 @@ namespace AppInstaller::Repository
}

// Check for an existing manifest that matches this one (could be reinstalling)
auto manifestIdOpt = index.GetManifestIdByManifest(*effectiveManifest);
auto manifestIdOpt = index.GetManifestIdByManifest(manifest);

if (manifestIdOpt)
{
index.UpdateManifest(*effectiveManifest);
index.UpdateManifest(manifest);
}
else
{
manifestIdOpt = index.AddManifest(*effectiveManifest);
manifestIdOpt = index.AddManifest(manifest);
}

SQLiteIndex::IdType manifestId = manifestIdOpt.value();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace AppInstaller::Repository
};

// Records an installation of the given package.
Version RecordInstall(const Manifest::Manifest& manifest, const Manifest::ManifestInstaller& installer, bool isUpgrade);
Version RecordInstall(Manifest::Manifest& manifest, const Manifest::ManifestInstaller& installer, bool isUpgrade);

// Records an uninstall of the given package.
void RecordUninstall(const Utility::LocIndString& packageIdentifier);
Expand Down

0 comments on commit 3998e64

Please sign in to comment.