From 49cd99c351cb3b1780706428a1349871f5d208cb Mon Sep 17 00:00:00 2001 From: Pavla Kratochvilova Date: Thu, 29 Jun 2023 13:22:12 +0200 Subject: [PATCH] changelogs: Fix `count` variable type The variable `count` in `print_changelogs` used to be `int32_t`, but was changed to `int64_t`. Because of that, the build on i686 arch fails with: ``` error: conversion from 'int64_t' {aka 'long long int'} to '__gnu_cxx::__normal_iterator >::difference_type' {aka 'int'} may change value [-Werror=conversion] ``` --- dnf5-plugins/changelog_plugin/changelog.cpp | 4 ++-- include/libdnf5-cli/output/changelogs.hpp | 2 +- libdnf5-cli/output/changelogs.cpp | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dnf5-plugins/changelog_plugin/changelog.cpp b/dnf5-plugins/changelog_plugin/changelog.cpp index 7df64b4b7..734dcdd2d 100644 --- a/dnf5-plugins/changelog_plugin/changelog.cpp +++ b/dnf5-plugins/changelog_plugin/changelog.cpp @@ -117,8 +117,8 @@ void ChangelogCommand::configure() { void ChangelogCommand::run() { auto & ctx = get_context(); - std::pair> filter = { - libdnf5::cli::output::ChangelogFilterType::NONE, 0}; + std::pair> + filter = {libdnf5::cli::output::ChangelogFilterType::NONE, 0}; libdnf5::rpm::PackageQuery full_package_query(ctx.base, libdnf5::sack::ExcludeFlags::APPLY_EXCLUDES, false); auto since = since_option->get_value(); diff --git a/include/libdnf5-cli/output/changelogs.hpp b/include/libdnf5-cli/output/changelogs.hpp index c3b7333c7..179d1e898 100644 --- a/include/libdnf5-cli/output/changelogs.hpp +++ b/include/libdnf5-cli/output/changelogs.hpp @@ -33,7 +33,7 @@ enum class ChangelogFilterType { NONE, UPGRADES, COUNT, SINCE }; void print_changelogs( libdnf5::rpm::PackageQuery & query, - std::pair> filter); + std::pair> filter); } // namespace libdnf5::cli::output diff --git a/libdnf5-cli/output/changelogs.cpp b/libdnf5-cli/output/changelogs.cpp index 553ad88f2..bd481c4b1 100644 --- a/libdnf5-cli/output/changelogs.cpp +++ b/libdnf5-cli/output/changelogs.cpp @@ -34,7 +34,7 @@ namespace libdnf5::cli::output { void print_changelogs( libdnf5::rpm::PackageQuery & query, - std::pair> filter) { + std::pair> filter) { // by_srpm std::map> by_srpm; for (auto pkg : query) { @@ -88,7 +88,7 @@ void print_changelogs( } changelogs.erase(changelogs.begin() + static_cast(idx), changelogs.end()); } else if (filter.first == ChangelogFilterType::COUNT) { - int64_t count = std::get(filter.second); + int32_t count = std::get(filter.second); if (count > 0) { if (static_cast(count) < changelogs.size()) { changelogs.erase(changelogs.begin() + count, changelogs.end());