mirror of
https://codeberg.org/DawnMagnet/reflect-cpp
synced 2026-12-02 16:16:19 +08:00
fix: handle wstrings being different lengths and constructed correctly
This commit is contained in:
@@ -34,7 +34,7 @@ struct Parser<R, W, std::wstring> {
|
||||
std::mbstate_t state = std::mbstate_t();
|
||||
auto val = inStr.value();
|
||||
|
||||
std::wstring outStr(L'\0', val.size());
|
||||
std::wstring outStr(val.size() * 2, L'\0');
|
||||
|
||||
// Explicitly set the size so we don't empty it when we truncate
|
||||
outStr.resize(val.size());
|
||||
@@ -57,7 +57,7 @@ struct Parser<R, W, std::wstring> {
|
||||
}
|
||||
|
||||
std::mbstate_t state = std::mbstate_t();
|
||||
std::string outStr('\0', _str.size());
|
||||
std::string outStr(_str.size(), '\0');
|
||||
outStr.resize(_str.size());
|
||||
|
||||
auto* ptr = _str.c_str();
|
||||
@@ -71,4 +71,4 @@ struct Parser<R, W, std::wstring> {
|
||||
} // namespace parsing
|
||||
} // namespace rfl
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user