From 76f2f6ae679d178c7e31b5ad2fe1a05b176f0304 Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Thu, 27 Jun 2019 12:49:45 +0200 Subject: [PATCH] Fix -Wsign-compare --- logger/Logger.cxx | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/logger/Logger.cxx b/logger/Logger.cxx index 3e83982..8cc1aa1 100644 --- a/logger/Logger.cxx +++ b/logger/Logger.cxx @@ -1,5 +1,5 @@ /******************************************************************************** - * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * + * Copyright (C) 2014-2019 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH * * * * This software is distributed under the terms of the * * GNU Lesser General Public Licence (LGPL) version 3, * @@ -272,16 +272,16 @@ void Logger::SetCustomSeverity(const string& key, const string& severityStr) auto Logger::CycleConsoleSeverityUp() -> void { - size_t current = static_cast(fConsoleSeverity); - if (current == fSeverityNames.size() - 1) { + int current = static_cast(fConsoleSeverity); + if (current == static_cast(fSeverityNames.size()) - 1) { SetConsoleSeverity(static_cast(0)); } else { SetConsoleSeverity(static_cast(current + 1)); } - size_t newCurrent = static_cast(fConsoleSeverity); + int newCurrent = static_cast(fConsoleSeverity); stringstream ss; - for (int i = 0; i < fSeverityNames.size(); ++i) { + for (int i = 0; i < static_cast(fSeverityNames.size()); ++i) { ss << (i == newCurrent ? ">" : " ") << fSeverityNames.at(i) << (i == newCurrent ? "<" : " "); } @@ -291,16 +291,16 @@ auto Logger::CycleConsoleSeverityUp() -> void auto Logger::CycleConsoleSeverityDown() -> void { - size_t current = static_cast(fConsoleSeverity); + int current = static_cast(fConsoleSeverity); if (current == 0) { SetConsoleSeverity(static_cast(fSeverityNames.size() - 1)); } else { SetConsoleSeverity(static_cast(current - 1)); } - size_t newCurrent = static_cast(fConsoleSeverity); + int newCurrent = static_cast(fConsoleSeverity); stringstream ss; - for (int i = 0; i < fSeverityNames.size(); ++i) { + for (int i = 0; i < static_cast(fSeverityNames.size()); ++i) { ss << (i == newCurrent ? ">" : " ") << fSeverityNames.at(i) << (i == newCurrent ? "<" : " "); } @@ -310,16 +310,16 @@ auto Logger::CycleConsoleSeverityDown() -> void auto Logger::CycleVerbosityUp() -> void { - size_t current = static_cast(fVerbosity); - if (current == fVerbosityNames.size() - 1) { + int current = static_cast(fVerbosity); + if (current == static_cast(fVerbosityNames.size() - 1)) { SetVerbosity(static_cast(0)); } else { SetVerbosity(static_cast(current + 1)); } - size_t newCurrent = static_cast(fVerbosity); + int newCurrent = static_cast(fVerbosity); stringstream ss; - for (int i = 0; i < fVerbosityNames.size(); ++i) { + for (int i = 0; i < static_cast(fVerbosityNames.size()); ++i) { ss << (i == newCurrent ? ">" : " ") << fVerbosityNames.at(i) << (i == newCurrent ? "<" : " "); } @@ -329,16 +329,16 @@ auto Logger::CycleVerbosityUp() -> void auto Logger::CycleVerbosityDown() -> void { - size_t current = static_cast(fVerbosity); + int current = static_cast(fVerbosity); if (current == 0) { SetVerbosity(static_cast(fVerbosityNames.size() - 1)); } else { SetVerbosity(static_cast(current - 1)); } - size_t newCurrent = static_cast(fVerbosity); + int newCurrent = static_cast(fVerbosity); stringstream ss; - for (int i = 0; i < fVerbosityNames.size(); ++i) { + for (int i = 0; i < static_cast(fVerbosityNames.size()); ++i) { ss << (i == newCurrent ? ">" : " ") << fVerbosityNames.at(i) << (i == newCurrent ? "<" : " "); }