Port rpmostree-package-variants to C++

Prep for using https://cxx.rs/
This commit is contained in:
Colin Walters 2020-12-21 16:08:51 +00:00 committed by OpenShift Merge Robot
parent a3aa9c29d2
commit 1d610604a2
2 changed files with 8 additions and 8 deletions

View File

@ -45,7 +45,7 @@ librpmostreed_sources = \
src/daemon/rpmostreed-transaction-types.cxx \ src/daemon/rpmostreed-transaction-types.cxx \
src/daemon/rpmostreed-transaction-livefs.cxx \ src/daemon/rpmostreed-transaction-livefs.cxx \
src/daemon/rpmostree-package-variants.h \ src/daemon/rpmostree-package-variants.h \
src/daemon/rpmostree-package-variants.c \ src/daemon/rpmostree-package-variants.cxx \
src/daemon/rpmostreed-os.h \ src/daemon/rpmostreed-os.h \
src/daemon/rpmostreed-os.cxx \ src/daemon/rpmostreed-os.cxx \
src/daemon/rpmostreed-os-experimental.h \ src/daemon/rpmostreed-os-experimental.h \

View File

@ -134,7 +134,7 @@ rpm_ostree_db_diff_variant (OstreeRepo *repo,
GCancellable *cancellable, GCancellable *cancellable,
GError **error) GError **error)
{ {
RpmOstreeDbDiffExtFlags flags = 0; int flags = 0;
if (allow_noent) if (allow_noent)
flags |= RPM_OSTREE_DB_DIFF_EXT_ALLOW_NOENT; flags |= RPM_OSTREE_DB_DIFF_EXT_ALLOW_NOENT;
@ -142,7 +142,7 @@ rpm_ostree_db_diff_variant (OstreeRepo *repo,
g_autoptr(GPtrArray) added = NULL; g_autoptr(GPtrArray) added = NULL;
g_autoptr(GPtrArray) modified_old = NULL; g_autoptr(GPtrArray) modified_old = NULL;
g_autoptr(GPtrArray) modified_new = NULL; g_autoptr(GPtrArray) modified_new = NULL;
if (!rpm_ostree_db_diff_ext (repo, from_rev, to_rev, flags, if (!rpm_ostree_db_diff_ext (repo, from_rev, to_rev, (RpmOstreeDbDiffExtFlags)flags,
&removed, &added, &modified_old, &modified_new, &removed, &added, &modified_old, &modified_new,
cancellable, error)) cancellable, error))
return FALSE; return FALSE;
@ -161,8 +161,8 @@ rpm_ostree_db_diff_variant (OstreeRepo *repo,
for (guint i = 0; i < modified_old->len; i++) for (guint i = 0; i < modified_old->len; i++)
{ {
guint type = RPM_OSTREE_PACKAGE_UPGRADED; guint type = RPM_OSTREE_PACKAGE_UPGRADED;
RpmOstreePackage *oldpkg = modified_old->pdata[i]; auto oldpkg = static_cast<RpmOstreePackage *>(modified_old->pdata[i]);
RpmOstreePackage *newpkg = modified_new->pdata[i]; auto newpkg = static_cast<RpmOstreePackage *>(modified_new->pdata[i]);
if (rpm_ostree_package_cmp (oldpkg, newpkg) > 0) if (rpm_ostree_package_cmp (oldpkg, newpkg) > 0)
type = RPM_OSTREE_PACKAGE_DOWNGRADED; type = RPM_OSTREE_PACKAGE_DOWNGRADED;
@ -174,7 +174,7 @@ rpm_ostree_db_diff_variant (OstreeRepo *repo,
for (guint i = 0; i < removed->len; i++) for (guint i = 0; i < removed->len; i++)
{ {
guint type = RPM_OSTREE_PACKAGE_REMOVED; guint type = RPM_OSTREE_PACKAGE_REMOVED;
RpmOstreePackage *pkg = removed->pdata[i]; auto pkg = static_cast<RpmOstreePackage *>(removed->pdata[i]);
const char *name = rpm_ostree_package_get_name (pkg); const char *name = rpm_ostree_package_get_name (pkg);
g_ptr_array_add (found, build_diff_variant (name, type, pkg, NULL)); g_ptr_array_add (found, build_diff_variant (name, type, pkg, NULL));
} }
@ -182,7 +182,7 @@ rpm_ostree_db_diff_variant (OstreeRepo *repo,
for (guint i = 0; i < added->len; i++) for (guint i = 0; i < added->len; i++)
{ {
guint type = RPM_OSTREE_PACKAGE_ADDED; guint type = RPM_OSTREE_PACKAGE_ADDED;
RpmOstreePackage *pkg = added->pdata[i]; auto pkg = static_cast<RpmOstreePackage *>(added->pdata[i]);
const char *name = rpm_ostree_package_get_name (pkg); const char *name = rpm_ostree_package_get_name (pkg);
g_ptr_array_add (found, build_diff_variant (name, type, NULL, pkg)); g_ptr_array_add (found, build_diff_variant (name, type, NULL, pkg));
} }
@ -192,7 +192,7 @@ rpm_ostree_db_diff_variant (OstreeRepo *repo,
GVariantBuilder builder; GVariantBuilder builder;
g_variant_builder_init (&builder, RPMOSTREE_DB_DIFF_VARIANT_FORMAT); g_variant_builder_init (&builder, RPMOSTREE_DB_DIFF_VARIANT_FORMAT);
for (guint i = 0; i < found->len; i++) for (guint i = 0; i < found->len; i++)
g_variant_builder_add_value (&builder, found->pdata[i]); g_variant_builder_add_value (&builder, (GVariant*)found->pdata[i]);
*out_variant = g_variant_builder_end (&builder); *out_variant = g_variant_builder_end (&builder);
g_variant_ref_sink (*out_variant); g_variant_ref_sink (*out_variant);