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
2 people authored and MiguelCompany committed Feb 20, 2024
1 parent 1559a6b commit d6ee7d2
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 d6ee7d2

Please sign in to comment.