From fce153cdb130179904440d27ba66b28ceec0a998 Mon Sep 17 00:00:00 2001 From: "Born.Xiao" Date: Thu, 12 Nov 2020 00:32:33 +0800 Subject: [PATCH] Update CCUserDefault.cpp write with variable size, calculate size use int32_t --- cocos/base/CCUserDefault.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/base/CCUserDefault.cpp b/cocos/base/CCUserDefault.cpp index 4de868fe73..f3c45e6c7a 100644 --- a/cocos/base/CCUserDefault.cpp +++ b/cocos/base/CCUserDefault.cpp @@ -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); }