Improve UserDefault code style

This commit is contained in:
halx99 2023-02-23 21:59:27 +08:00
parent a00d594ba0
commit ba61e83191
1 changed files with 9 additions and 3 deletions

View File

@ -413,14 +413,20 @@ void UserDefault::lazyInit()
int count = ibs.read<int>();
for (auto i = 0; i < count; ++i)
{
std::string key(ibs.read_v());
std::string value(ibs.read_v());
if (_encryptEnabled)
{
std::string key(ibs.read_v());
std::string value(ibs.read_v());
this->encrypt(key, AES_DECRYPT);
this->encrypt(value, AES_DECRYPT);
updateValueForKey(key, value);
}
else
{
std::string_view key(ibs.read_v());
std::string_view value(ibs.read_v());
updateValueForKey(key, value);
}
updateValueForKey(key, value);
}
_realSize = static_cast<int>(ibs.seek(0, SEEK_CUR) - sizeof(udflen_t));
}