Make Dictionary templatable so it can be used where we want a higher capacity.

This commit is contained in:
Adam Ierymenko 2016-06-21 07:32:58 -07:00
parent 3ee15e65aa
commit b2d048aa0e
12 changed files with 67 additions and 49 deletions

View file

@ -23,9 +23,9 @@
namespace ZeroTier {
bool NetworkConfig::toDictionary(Dictionary &d,bool includeLegacy) const
bool NetworkConfig::toDictionary(Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY> &d,bool includeLegacy) const
{
Buffer<ZT_DICTIONARY_MAX_SIZE> tmp;
Buffer<ZT_NETWORKCONFIG_DICT_CAPACITY> tmp;
d.clear();
@ -259,11 +259,11 @@ bool NetworkConfig::toDictionary(Dictionary &d,bool includeLegacy) const
return true;
}
bool NetworkConfig::fromDictionary(const Dictionary &d)
bool NetworkConfig::fromDictionary(const Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY> &d)
{
try {
Buffer<ZT_DICTIONARY_MAX_SIZE> tmp;
char tmp2[ZT_DICTIONARY_MAX_SIZE];
Buffer<ZT_NETWORKCONFIG_DICT_CAPACITY> tmp;
char tmp2[ZT_NETWORKCONFIG_DICT_CAPACITY];
memset(this,0,sizeof(NetworkConfig));