From 37b994d15b7577519995608705521f193699c9d2 Mon Sep 17 00:00:00 2001 From: jeroendoggen Date: Fri, 14 Apr 2023 10:13:51 +0200 Subject: [PATCH] Fix compiler warnings (gcc: -Wsign-compare) semver.hpp:145:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector::size_type' {aka 'long long unsigned int'} [-Wsign-compare] semver.hpp:162:31: warning: comparison of integer expressions of different signedness: 'int' and 'long long unsigned int' [-Wsign-compare] --- include/semver/semver.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/semver/semver.hpp b/include/semver/semver.hpp index 5200476..346fd56 100644 --- a/include/semver/semver.hpp +++ b/include/semver/semver.hpp @@ -142,7 +142,7 @@ namespace semver prerelease_descriptor increment() const { std::vector new_parts = (m_parts); int last_numeric_index = -1; - for (int i = 0; i < new_parts.size(); ++i) { + for (size_t i = 0; i < new_parts.size(); ++i) { if (new_parts[i].numeric()) last_numeric_index = i; } if (last_numeric_index != -1) { @@ -159,7 +159,7 @@ namespace semver auto other_size = other.m_parts.size(); auto count = std::min(this_size, other_size); - for (int i = 0; i < count; ++i) { + for (size_t i = 0; i < count; ++i) { int cmp = m_parts[i].compare(other.m_parts[i]); if (cmp != 0) return cmp; } @@ -370,4 +370,4 @@ namespace semver } } -#endif // Z4KN4FEIN_SEMVER_H \ No newline at end of file +#endif // Z4KN4FEIN_SEMVER_H