From 9457b3de3a9906db78b2a14e71da4dbdc39cfdbd Mon Sep 17 00:00:00 2001 From: Florin Iucha Date: Wed, 27 Nov 2019 16:30:23 -0500 Subject: [PATCH 1/3] Fix -Wconversion warnings with GCC9 (#214) --- include/cxxopts.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index e89c2e1..93c69d3 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -551,7 +551,7 @@ namespace cxxopts // if we got to here, then `t` is a positive number that fits into // `R`. So to avoid MSVC C4146, we first cast it to `R`. // See https://github.com/jarro2783/cxxopts/issues/62 for more details. - return -static_cast(t-1)-1; + return static_cast(-static_cast(t-1)-1); } template @@ -611,7 +611,7 @@ namespace cxxopts throw_or_mimic(text); } - US next = result * base + digit; + const US next = static_cast(result * base + digit); if (result > next) { throw_or_mimic(text); From 23f56e2614a3364d900d8405726776145cd4b6be Mon Sep 17 00:00:00 2001 From: Jarryd Beck Date: Thu, 28 Nov 2019 08:32:54 +1100 Subject: [PATCH 2/3] Fix conversion warning in test --- test/options.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/options.cpp b/test/options.cpp index d110e01..d3d3c7a 100644 --- a/test/options.cpp +++ b/test/options.cpp @@ -9,7 +9,7 @@ class Argv { Argv(std::initializer_list args) : m_argv(new char*[args.size()]) - , m_argc(args.size()) + , m_argc(static_cast(args.size())) { int i = 0; auto iter = args.begin(); From 943cdcfbbaa205f9a1789d96c7a57accfabcd233 Mon Sep 17 00:00:00 2001 From: Felix Esch Date: Wed, 8 Jan 2020 07:14:46 +0100 Subject: [PATCH 3/3] Fix assertion failure (issue #217) (#218) --- include/cxxopts.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index 93c69d3..1644692 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -1559,6 +1559,7 @@ namespace cxxopts stringAppend(result, "\n"); stringAppend(result, start, ' '); startLine = lastSpace + 1; + lastSpace = startLine; } size = 0; }