mirror of
https://github.com/asdlokj1qpi233/subconverter.git
synced 2026-11-03 18:24:58 +00:00
Fix warning: possibly dangling reference to a temporary
This commit is contained in:
1 file changed
+11
-11
+11
-11
@@ -573,14 +573,14 @@ void operate_toml_kv_table(const std::vector<toml::table> &arr, const toml::key
|
||||
{
|
||||
for(const toml::table &table : arr)
|
||||
{
|
||||
const auto &key = table.at(key_name), value = table.at(value_name);
|
||||
const auto &key = table.at(key_name), &value = table.at(value_name);
|
||||
binary_op(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
void readTOMLConf(toml::value &root)
|
||||
{
|
||||
const auto §ion_common = toml::find(root, "common");
|
||||
auto section_common = toml::find(root, "common");
|
||||
string_array default_url, insert_url;
|
||||
|
||||
find_if_exist(section_common, "default_url", default_url, "insert_url", insert_url);
|
||||
@@ -619,7 +619,7 @@ void readTOMLConf(toml::value &root)
|
||||
safe_set_streams(toml::find_or<RegexMatchConfigs>(root, "userinfo", "stream_rule", RegexMatchConfigs{}));
|
||||
safe_set_times(toml::find_or<RegexMatchConfigs>(root, "userinfo", "time_rule", RegexMatchConfigs{}));
|
||||
|
||||
const auto §ion_node_pref = toml::find(root, "node_pref");
|
||||
auto section_node_pref = toml::find(root, "node_pref");
|
||||
|
||||
find_if_exist(section_node_pref,
|
||||
"udp_flag", global.UDPFlag,
|
||||
@@ -638,7 +638,7 @@ void readTOMLConf(toml::value &root)
|
||||
importItems(renameconfs, "rename_node", false);
|
||||
safe_set_renames(toml::get<RegexMatchConfigs>(toml::value(renameconfs)));
|
||||
|
||||
const auto §ion_managed = toml::find(root, "managed_config");
|
||||
auto section_managed = toml::find(root, "managed_config");
|
||||
|
||||
find_if_exist(section_managed,
|
||||
"write_managed_config", global.writeManagedConfig,
|
||||
@@ -648,13 +648,13 @@ void readTOMLConf(toml::value &root)
|
||||
"quanx_device_id", global.quanXDevID
|
||||
);
|
||||
|
||||
const auto §ion_surge_external = toml::find(root, "surge_external_proxy");
|
||||
auto section_surge_external = toml::find(root, "surge_external_proxy");
|
||||
find_if_exist(section_surge_external,
|
||||
"surge_ssr_path", global.surgeSSRPath,
|
||||
"resolve_hostname", global.surgeResolveHostname
|
||||
);
|
||||
|
||||
const auto §ion_emojis = toml::find(root, "emojis");
|
||||
auto section_emojis = toml::find(root, "emojis");
|
||||
|
||||
find_if_exist(section_emojis,
|
||||
"add_emoji", global.addEmoji,
|
||||
@@ -669,7 +669,7 @@ void readTOMLConf(toml::value &root)
|
||||
importItems(groups, "custom_groups", false);
|
||||
global.customProxyGroups = toml::get<ProxyGroupConfigs>(toml::value(groups));
|
||||
|
||||
const auto §ion_ruleset = toml::find(root, "ruleset");
|
||||
auto section_ruleset = toml::find(root, "ruleset");
|
||||
|
||||
find_if_exist(section_ruleset,
|
||||
"enabled", global.enableRuleGen,
|
||||
@@ -681,7 +681,7 @@ void readTOMLConf(toml::value &root)
|
||||
importItems(rulesets, "rulesets", false);
|
||||
global.customRulesets = toml::get<RulesetConfigs>(toml::value(rulesets));
|
||||
|
||||
const auto §ion_template = toml::find(root, "template");
|
||||
auto section_template = toml::find(root, "template");
|
||||
|
||||
global.templatePath = toml::find_or(section_template, "template_path", "template");
|
||||
|
||||
@@ -702,7 +702,7 @@ void readTOMLConf(toml::value &root)
|
||||
global.cronTasks = toml::get<CronTaskConfigs>(toml::value(tasks));
|
||||
refresh_schedule();
|
||||
|
||||
const auto §ion_server = toml::find(root, "server");
|
||||
auto section_server = toml::find(root, "server");
|
||||
|
||||
find_if_exist(section_server,
|
||||
"listen", global.listenAddress,
|
||||
@@ -711,7 +711,7 @@ void readTOMLConf(toml::value &root)
|
||||
);
|
||||
webServer.serve_file = !webServer.serve_file_root.empty();
|
||||
|
||||
const auto §ion_advanced = toml::find(root, "advanced");
|
||||
auto section_advanced = toml::find(root, "advanced");
|
||||
|
||||
std::string log_level;
|
||||
bool enable_cache = true;
|
||||
@@ -1135,7 +1135,7 @@ int loadExternalYAML(YAML::Node &node, ExternalConfig &ext)
|
||||
|
||||
int loadExternalTOML(toml::value &root, ExternalConfig &ext)
|
||||
{
|
||||
const auto §ion = toml::find(root, "custom");
|
||||
auto section = toml::find(root, "custom");
|
||||
|
||||
find_if_exist(section,
|
||||
"enable_rule_generator", ext.enable_rule_generator,
|
||||
|
||||
Reference in new issue
Block a user