Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some warnings #3595

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions libmamba/include/mamba/core/output.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ namespace mamba
{
public:

MessageLogger(const char* file, int line, log_level level);
MessageLogger(const char* file, log_level level);
Hind-M marked this conversation as resolved.
Show resolved Hide resolved
~MessageLogger();

std::stringstream& stream();
Expand All @@ -182,7 +182,6 @@ namespace mamba
private:

std::string m_file;
int m_line;
log_level m_level;
std::stringstream m_stream;

Expand All @@ -199,7 +198,7 @@ namespace mamba
#undef LOG_ERROR
#undef LOG_CRITICAL

#define LOG(severity) mamba::MessageLogger(__FILE__, __LINE__, severity).stream()
#define LOG(severity) mamba::MessageLogger(__FILE__, severity).stream()
#define LOG_TRACE LOG(mamba::log_level::trace)
#define LOG_DEBUG LOG(mamba::log_level::debug)
#define LOG_INFO LOG(mamba::log_level::info)
Expand Down
2 changes: 1 addition & 1 deletion libmamba/include/mamba/solver/libsolv/unsolvable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace solv

namespace mamba
{
class Palette;
struct Palette;
Hind-M marked this conversation as resolved.
Show resolved Hide resolved
}

namespace mamba::solver::libsolv
Expand Down
2 changes: 1 addition & 1 deletion libmamba/src/api/list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace mamba
}

std::regex spec_pat(regex);
auto all_records = std::move(prefix_data.all_pkg_mgr_records());
auto all_records = prefix_data.all_pkg_mgr_records();
Hind-M marked this conversation as resolved.
Show resolved Hide resolved

if (ctx.output_params.json)
{
Expand Down
3 changes: 1 addition & 2 deletions libmamba/src/core/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,8 @@ namespace mamba
static std::vector<std::pair<std::string, log_level>> m_buffer;
};

MessageLogger::MessageLogger(const char* file, int line, log_level level)
MessageLogger::MessageLogger(const char* file, log_level level)
: m_file(strip_file_prefix(file))
, m_line(line)
, m_level(level)
, m_stream()
{
Expand Down
5 changes: 1 addition & 4 deletions libmamba/src/core/progress_bar_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1902,8 +1902,7 @@ namespace mamba
{
for (auto& [label, bars] : m_labels)
{
std::size_t current = 0, total = 0, in_progress = 0, speed = 0, active_count = 0,
total_count = 0;
std::size_t current = 0, total = 0, in_progress = 0, speed = 0;
bool any_spinner = false;
bool any_started = false;
std::vector<ProgressBar::time_point_t> start_times = {};
Expand All @@ -1916,7 +1915,6 @@ namespace mamba
{
current += bar->current();
total += bar->total();
++total_count;

if (!bar->unset())
{
Expand All @@ -1926,7 +1924,6 @@ namespace mamba
{
speed += bar->speed();
in_progress += (bar->total() - bar->current());
++active_count;
aggregate_bar_ptr->add_active_task(bar->prefix());
any_started = true;
}
Expand Down
2 changes: 1 addition & 1 deletion libmamba/src/core/shell_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ namespace mamba
{
const ShellInitPathsWindowsCmd paths{ root_prefix };

for (const auto directory : paths.every_generated_directories_paths())
for (const auto& directory : paths.every_generated_directories_paths())
{
// Maybe the prefix isn't writable. No big deal, just keep going.
std::error_code maybe_error [[maybe_unused]];
Expand Down
2 changes: 1 addition & 1 deletion libmamba/src/download/downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ namespace mamba::download
{
new_mirror = find_mirror(
m_mirror_set,
[this, iteration](const auto& mirror) {
[iteration](const auto& mirror) {
return iteration > mirror->failed_transfers()
&& mirror->can_accept_more_connections();
}
Expand Down
18 changes: 12 additions & 6 deletions libmamba/tests/src/download/test_mirror.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ namespace mamba::download
TEST_CASE("PassThroughMirror")
{
std::unique_ptr<Mirror> mir = make_mirror("");
CHECK_EQ(typeid(*mir), typeid(PassThroughMirror));
auto& ref = *mir;
mathbunnyru marked this conversation as resolved.
Show resolved Hide resolved
CHECK_EQ(typeid(ref), typeid(PassThroughMirror));

Mirror::request_generator_list req_gen = mir->get_request_generators("", "");
CHECK_EQ(req_gen.size(), 1);
Expand All @@ -75,7 +76,8 @@ namespace mamba::download
SUBCASE("https")
{
std::unique_ptr<Mirror> mir = make_mirror("https://conda.anaconda.org/conda-forge");
CHECK_EQ(typeid(*mir), typeid(HTTPMirror));
auto& ref = *mir;
CHECK_EQ(typeid(ref), typeid(HTTPMirror));

Mirror::request_generator_list req_gen = mir->get_request_generators("", "");
CHECK_EQ(req_gen.size(), 1);
Expand All @@ -94,7 +96,8 @@ namespace mamba::download
SUBCASE("http")
{
std::unique_ptr<Mirror> mir = make_mirror("http://conda.anaconda.org/conda-forge");
CHECK_EQ(typeid(*mir), typeid(HTTPMirror));
auto& ref = *mir;
CHECK_EQ(typeid(ref), typeid(HTTPMirror));

Mirror::request_generator_list req_gen = mir->get_request_generators("", "");
CHECK_EQ(req_gen.size(), 1);
Expand All @@ -113,7 +116,8 @@ namespace mamba::download
SUBCASE("file")
{
std::unique_ptr<Mirror> mir = make_mirror("file://channel_path");
CHECK_EQ(typeid(*mir), typeid(HTTPMirror));
auto& ref = *mir;
CHECK_EQ(typeid(ref), typeid(HTTPMirror));

Mirror::request_generator_list req_gen = mir->get_request_generators("", "");
CHECK_EQ(req_gen.size(), 1);
Expand All @@ -135,7 +139,8 @@ namespace mamba::download
SUBCASE("Request repodata.json")
{
std::unique_ptr<Mirror> mir = make_mirror("oci://ghcr.io/channel-mirrors/conda-forge");
CHECK_EQ(typeid(*mir), typeid(OCIMirror));
auto& ref = *mir;
CHECK_EQ(typeid(ref), typeid(OCIMirror));

Mirror::request_generator_list req_gen = mir->get_request_generators(
"linux-64/repodata.json",
Expand Down Expand Up @@ -164,7 +169,8 @@ namespace mamba::download
SUBCASE("Request spec with sha")
{
std::unique_ptr<Mirror> mir = make_mirror("oci://ghcr.io/channel-mirrors/conda-forge");
CHECK_EQ(typeid(*mir), typeid(OCIMirror));
auto& ref = *mir;
CHECK_EQ(typeid(ref), typeid(OCIMirror));

Mirror::request_generator_list req_gen = mir->get_request_generators(
"linux-64/pandoc-3.2-ha770c72_0.conda",
Expand Down
Loading