Update CCUserDefault.cpp

write with variable  size,  calculate size use int32_t
This commit is contained in:
Born.Xiao 2020-11-12 00:32:33 +08:00 committed by GitHub
parent e4985af560
commit fce153cdb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -85,7 +85,7 @@ static void ud_setkey(std::string& lhs, const cxx17::string_view& rhs) {
static void ud_write_v_s(yasio::obstream& obs, const cxx17::string_view value)
{
size_t valpos = obs.length();
obs.write_v(value);
obs.write_v32(value);
if(!value.empty())
UserDefault::getInstance()->encrypt(obs.wptr(valpos + sizeof(int32_t)), obs.length() - valpos - sizeof(int32_t), AES_ENCRYPT);
}