diff options
author | Riccardo Spagni <ric@spagni.net> | 2017-08-09 14:58:11 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2017-08-09 14:58:11 +0200 |
commit | f43d59d8b368f79231f536a26a668a55e1bf7ead (patch) | |
tree | cd7615acb005a5a299ef2a8d628695f15bdb49ce /contrib/epee/include/serialization/keyvalue_serialization.h | |
parent | Merge pull request #2267 (diff) | |
parent | protocol: add checks for top block hard fork version (diff) | |
download | monero-f43d59d8b368f79231f536a26a668a55e1bf7ead.tar.xz |
Merge pull request #2269
635929ea protocol: add checks for top block hard fork version (moneromooo-monero)
7482253a epee: fixup KV_SERIALIZE_OPT to work in more cases (moneromooo-monero)
Diffstat (limited to 'contrib/epee/include/serialization/keyvalue_serialization.h')
-rw-r--r-- | contrib/epee/include/serialization/keyvalue_serialization.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/contrib/epee/include/serialization/keyvalue_serialization.h b/contrib/epee/include/serialization/keyvalue_serialization.h index f4442e46c..d4413a71b 100644 --- a/contrib/epee/include/serialization/keyvalue_serialization.h +++ b/contrib/epee/include/serialization/keyvalue_serialization.h @@ -70,10 +70,13 @@ public: \ #define KV_SERIALIZE_N(varialble, val_name) \ epee::serialization::selector<is_store>::serialize(this_ref.varialble, stg, hparent_section, val_name); + template<typename T> inline void serialize_default(const T &t, T v) { } + template<typename T> inline void serialize_default(T &t, T v) { t = v; } + #define KV_SERIALIZE_OPT_N(variable, val_name, default_value) \ do { \ if (!epee::serialization::selector<is_store>::serialize(this_ref.variable, stg, hparent_section, val_name)) \ - this_ref.variable = default_value; \ + epee::serialize_default(this_ref.variable, default_value); \ } while (0); #define KV_SERIALIZE_VAL_POD_AS_BLOB_FORCE_N(varialble, val_name) \ |