Skip to content

Commit

Permalink
Fix wchar deserialize error when swaping the bytes
Browse files Browse the repository at this point in the history
Signed-off-by: weihanwu <weihanwu@lixiang.com>
Co-authored-by: maxin <maxin@lixiang.com>
  • Loading branch information
weihanwu and maxin committed Dec 29, 2023
1 parent 71d2cc2 commit 7bbacba
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/cpp/Cdr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1643,13 +1643,8 @@ Cdr& Cdr::deserialize(
// Allocate memory.
string_t = reinterpret_cast<wchar_t*>(calloc(length + 1, sizeof(wchar_t))); // WStrings never serialize terminating zero

for (size_t idx = 0; idx < length; ++idx)
{
uint16_t temp;
offset_ >> temp;
string_t[idx] = static_cast<wchar_t>(temp);
offset_ += sizeof(uint16_t);
}
deserialize_array(string_t, length);

return *this;
}

Expand Down

0 comments on commit 7bbacba

Please sign in to comment.