mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-08 20:40:11 +02:00
Work around incorrect wchar_t text serialization
`std::char_traits<wchar_t>::length()` would return the wrong length for a wide string under Wine, and thus also for `String128`. This would cause parts of the strings to get cut off. As a workaround we'll just serialize the entire container including all null bytes at the end.
This commit is contained in:
@@ -188,7 +188,7 @@ namespace Steinberg {
|
||||
namespace Vst {
|
||||
template <typename S>
|
||||
void serialize(S& s, IContextMenuItem& item) {
|
||||
s.text2b(item.name);
|
||||
s.container2b(item.name);
|
||||
s.value4b(item.tag);
|
||||
s.value4b(item.flags);
|
||||
}
|
||||
|
||||
@@ -213,12 +213,19 @@ void serialize(S& s, PClassInfoW& class_info) {
|
||||
s.container1b(class_info.cid);
|
||||
s.value4b(class_info.cardinality);
|
||||
s.text1b(class_info.category);
|
||||
s.text2b(class_info.name);
|
||||
// FIXME: Bitsery uses `std::char_traits<wchar_t>::length()` under the hood
|
||||
// for `text2b()` on the Wine side, and under winegcc this function
|
||||
// this length is incorrect. As a workaround we're just serializing
|
||||
// the entire container. This applies to every place where we use
|
||||
// `container2b()` to serialize a `String128`, so if we end up fixing
|
||||
// this we should replace all of the instances of `container2b()`
|
||||
// that serialize a `String128`.
|
||||
s.container2b(class_info.name);
|
||||
s.value4b(class_info.classFlags);
|
||||
s.text1b(class_info.subCategories);
|
||||
s.text2b(class_info.vendor);
|
||||
s.text2b(class_info.version);
|
||||
s.text2b(class_info.sdkVersion);
|
||||
s.container2b(class_info.vendor);
|
||||
s.container2b(class_info.version);
|
||||
s.container2b(class_info.sdkVersion);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
|
||||
@@ -141,8 +141,8 @@ namespace Vst {
|
||||
template <typename S>
|
||||
void serialize(S& s, Steinberg::Vst::KeyswitchInfo& info) {
|
||||
s.value4b(info.typeId);
|
||||
s.text2b(info.title);
|
||||
s.text2b(info.shortTitle);
|
||||
s.container2b(info.title);
|
||||
s.container2b(info.shortTitle);
|
||||
s.value4b(info.keyswitchMin);
|
||||
s.value4b(info.keyswitchMax);
|
||||
s.value4b(info.keyRemapped);
|
||||
|
||||
@@ -242,9 +242,9 @@ namespace Vst {
|
||||
template <typename S>
|
||||
void serialize(S& s, NoteExpressionTypeInfo& info) {
|
||||
s.value4b(info.typeId);
|
||||
s.text2b(info.title);
|
||||
s.text2b(info.shortTitle);
|
||||
s.text2b(info.units);
|
||||
s.container2b(info.title);
|
||||
s.container2b(info.shortTitle);
|
||||
s.container2b(info.units);
|
||||
s.value4b(info.unitId);
|
||||
s.object(info.valueDesc);
|
||||
s.value4b(info.associatedParameterId);
|
||||
|
||||
@@ -449,14 +449,14 @@ template <typename S>
|
||||
void serialize(S& s, UnitInfo& info) {
|
||||
s.value4b(info.id);
|
||||
s.value4b(info.parentUnitId);
|
||||
s.text2b(info.name);
|
||||
s.container2b(info.name);
|
||||
s.value4b(info.programListId);
|
||||
}
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s, ProgramListInfo& info) {
|
||||
s.value4b(info.id);
|
||||
s.text2b(info.name);
|
||||
s.container2b(info.name);
|
||||
s.value4b(info.programCount);
|
||||
}
|
||||
} // namespace Vst
|
||||
|
||||
Reference in New Issue
Block a user