From 2d6b003b4258c92e8de8003155e60e15124a93de Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sun, 4 Oct 2020 20:15:25 +0300 Subject: Fix useless-cast warnings in Configuration --- Kconfig | 7 ------- lib/configuration/test/main.cpp | 16 ++++++++-------- scripts/gen-default-cfg.py | 4 ++-- 3 files changed, 10 insertions(+), 17 deletions(-) diff --git a/Kconfig b/Kconfig index ed8dbdf..8a2f934 100644 --- a/Kconfig +++ b/Kconfig @@ -185,10 +185,3 @@ config session.path string "Session location" default "~/.config/smolbote/session.d" -menu "Workarounds" - config QTBUG_65223 - bool "Manually emit loadFinished" - default y - help - See QTBUG-65223: loadStarted is emitted twice when loading link with anchor -endmenu diff --git a/lib/configuration/test/main.cpp b/lib/configuration/test/main.cpp index 06f7cb0..d83f7af 100644 --- a/lib/configuration/test/main.cpp +++ b/lib/configuration/test/main.cpp @@ -17,16 +17,16 @@ SCENARIO("Configuration") { "other", std::string("not in cfg") }, // commented out entry in the conf file { "comment", std::string("123.456") }, - { "number", int(0) }, - { "toggle", bool(false) }, + { "number", 0 }, + { "toggle", false }, { "main/name", std::string() }, - { "main/number", int(0) }, - { "main/toggle", bool(true) }, + { "main/number", 0 }, + { "main/toggle", true }, { "extra/name", std::string() }, - { "extra/number", int(0) }, - { "extra/toggle", bool(false) }, + { "extra/number", 0 }, + { "extra/toggle", false }, }; WHEN("reading default values") @@ -132,8 +132,8 @@ SCENARIO("Configuration") { std::unique_ptr global_conf = std::make_unique>>({ { "name", std::string("global") }, - { "number", int(123) }, - { "toggle", bool(true) }, + { "number", 123 }, + { "toggle", true }, }); diff --git a/scripts/gen-default-cfg.py b/scripts/gen-default-cfg.py index dc88ceb..c27b482 100755 --- a/scripts/gen-default-cfg.py +++ b/scripts/gen-default-cfg.py @@ -8,10 +8,10 @@ def node_to_str(node): if(node.item.type == kconfiglib.STRING): return "std::string(\"" + node.item.str_value + "\")" elif(node.item.type == kconfiglib.INT): - return "int(" + node.item.str_value + ")" + return node.item.str_value elif(node.item.type == kconfiglib.BOOL): tri_val_str = ("false", "unknown", "true")[node.item.tri_value] - return "bool(" + tri_val_str + ")" + return tri_val_str return None -- cgit v1.2.1