Skip to content

Commit 3998e64

Browse files
committed
Move to non-const param
1 parent 2a54c09 commit 3998e64

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

src/AppInstallerRepositoryCore/PackageTrackingCatalog.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ namespace AppInstaller::Repository
214214
}
215215

216216
PackageTrackingCatalog::Version PackageTrackingCatalog::RecordInstall(
217-
const Manifest::Manifest& manifest,
217+
Manifest::Manifest& manifest,
218218
const Manifest::ManifestInstaller& installer,
219219
bool isUpgrade)
220220
{
@@ -224,16 +224,10 @@ namespace AppInstaller::Repository
224224
auto& index = m_implementation->Source->GetIndex();
225225

226226
// Strip ARP version information from the manifest if it is present
227-
const Manifest::Manifest* effectiveManifest = &manifest;
228-
Manifest::Manifest arpRangeRemovedManifest;
229-
230227
auto arpVersionRange = manifest.GetArpVersionRange();
231228
if (!arpVersionRange.IsEmpty())
232229
{
233-
arpRangeRemovedManifest = manifest;
234-
effectiveManifest = &arpRangeRemovedManifest;
235-
236-
for (auto& arpRangeRemovedInstaller : arpRangeRemovedManifest.Installers)
230+
for (auto& arpRangeRemovedInstaller : manifest.Installers)
237231
{
238232
for (auto& arpRangeRemovedEntry : arpRangeRemovedInstaller.AppsAndFeaturesEntries)
239233
{
@@ -243,15 +237,15 @@ namespace AppInstaller::Repository
243237
}
244238

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

248242
if (manifestIdOpt)
249243
{
250-
index.UpdateManifest(*effectiveManifest);
244+
index.UpdateManifest(manifest);
251245
}
252246
else
253247
{
254-
manifestIdOpt = index.AddManifest(*effectiveManifest);
248+
manifestIdOpt = index.AddManifest(manifest);
255249
}
256250

257251
SQLiteIndex::IdType manifestId = manifestIdOpt.value();

src/AppInstallerRepositoryCore/Public/winget/PackageTrackingCatalog.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace AppInstaller::Repository
5959
};
6060

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

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

0 commit comments

Comments
 (0)