1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-02 21:16:04 +00:00

fix shadowed declaration warnings [-Wshadow] (#6759)

This commit is contained in:
Cœur 2024-03-31 01:56:48 +08:00 committed by GitHub
parent 465b878e8a
commit bc7d447949
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -36,14 +36,16 @@ protected:
using Save = tr_variant (*)(T const& src); using Save = tr_variant (*)(T const& src);
template<typename T> template<typename T>
void add_type_handler(Load<T> load, Save<T> save) void add_type_handler(Load<T> load_handler, Save<T> save_handler)
{ {
auto const key = std::type_index(typeid(T*)); auto const key = std::type_index(typeid(T*));
// wrap load + save with void* wrappers so that // wrap load_handler + save_handler with void* wrappers so that
// they can be stored in the save_ and load_ maps // they can be stored in the save_ and load_ maps
load_.insert_or_assign(key, [load](tr_variant const& src, void* tgt) { return load(src, static_cast<T*>(tgt)); }); load_.insert_or_assign(
save_.insert_or_assign(key, [save](void const* src) { return save(*static_cast<T const*>(src)); }); key,
[load_handler](tr_variant const& src, void* tgt) { return load_handler(src, static_cast<T*>(tgt)); });
save_.insert_or_assign(key, [save_handler](void const* src) { return save_handler(*static_cast<T const*>(src)); });
} }
struct Field struct Field