From 06ae67502a99a6968dd2dbb93fcc1158ca664479 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Sun, 9 Jun 2019 21:05:46 +0900 Subject: [PATCH 1/3] fix: move argument correctly --- toml/get.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/toml/get.hpp b/toml/get.hpp index 326f2a9..fb2f403 100644 --- a/toml/get.hpp +++ b/toml/get.hpp @@ -545,7 +545,7 @@ std::string get_or(toml::value&& v, T&& opt) } catch(...) { - return opt; + return std::forward(opt); } } template::value, std::nullptr_t>::type = nullptr> std::string find_or(toml::value&& v, const toml::key& ky, T&& opt) { - if(!v.is_table()) {return opt;} + if(!v.is_table()) {return std::forward(opt);} auto tab = toml::get(std::move(v)); - if(tab.count(ky) == 0) {return opt;} + if(tab.count(ky) == 0) {return std::forward(opt);} return get_or(std::move(tab[ky]), std::forward(opt)); } @@ -726,7 +726,7 @@ template::value, std::nullptr_t>::type = nullptr> std::string find_or(toml::table&& tab, const toml::key& ky, T&& opt) { - if(tab.count(ky) == 0) {return opt;} + if(tab.count(ky) == 0) {return std::forward(opt);} return get_or(std::move(tab[ky]), std::forward(opt)); } From 2f4f3efbf0c8e9a1a193dce708b79652e8116feb Mon Sep 17 00:00:00 2001 From: khoitd1997 Date: Sun, 9 Jun 2019 12:00:28 -0700 Subject: [PATCH 2/3] fix sign-compare warning --- toml/combinator.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toml/combinator.hpp b/toml/combinator.hpp index 9f9fa9c..1c6ce25 100644 --- a/toml/combinator.hpp +++ b/toml/combinator.hpp @@ -45,7 +45,7 @@ inline std::string show_char(const char c) buf.fill('\0'); const auto r = std::snprintf( buf.data(), buf.size(), "0x%02x", static_cast(c) & 0xFF); - assert(r == buf.size() - 1); + assert(r == static_cast(buf.size()) - 1); return std::string(buf.data()); } } From b2daf916b3d5e3246dde67b134e295fdeb2f01b5 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Tue, 11 Jun 2019 22:45:46 +0900 Subject: [PATCH 3/3] doc: add contributor to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b890733..b7a6d58 100644 --- a/README.md +++ b/README.md @@ -1170,6 +1170,8 @@ I appreciate the help of the contributors who introduced the great feature to th - Fixed warnings on MSVC - Ivan Shynkarenka (@chronoxor) - Fixed Visual Studio 2019 warnings +- @khoitd1997 + - Fixed warnings while type conversion ## Licensing terms