Clean up after reverting buffer handling change

This is what you get from not taking any breaks.
This commit is contained in:
Robbert van der Helm
2020-04-30 22:45:22 +02:00
parent eb94f63e2c
commit 6c496da455
2 changed files with 30 additions and 36 deletions
+9 -15
View File
@@ -193,12 +193,10 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
// arbitrary C-style string. // arbitrary C-style string.
std::array<char, max_string_length> string_buffer; std::array<char, max_string_length> string_buffer;
string_buffer[0] = 0; string_buffer[0] = 0;
// This buffer is only used for retrieving chunk data and will be allocated
// as needed
std::vector<uint8_t> binary_buffer;
void* data = std::visit( void* data = std::visit(
overload{[&](const std::nullptr_t&) -> void* { return nullptr; }, overload{
[&](const std::nullptr_t&) -> void* { return nullptr; },
[&](const std::string& s) -> void* { [&](const std::string& s) -> void* {
return const_cast<char*>(s.c_str()); return const_cast<char*>(s.c_str());
}, },
@@ -206,13 +204,12 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
return const_cast<uint8_t*>(buffer.data()); return const_cast<uint8_t*>(buffer.data());
}, },
[&](native_size_t& window_handle) -> void* { [&](native_size_t& window_handle) -> void* {
// This is the X11 window handle that the editor should // This is the X11 window handle that the editor should reparent
// reparent itself to. We have a special wrapper around the // itself to. We have a special wrapper around the dispatch
// dispatch function that intercepts `effEditOpen` events // function that intercepts `effEditOpen` events and creates a
// and creates a Win32 window and then finally embeds the // Win32 window and then finally embeds the X11 window Wine
// X11 window Wine created into this wnidow handle. // created into this wnidow handle. Make sure to convert the
// Make sure to convert the window ID first to `size_t` in // window ID first to `size_t` in case this is the 32-bit host.
// case this is the 32-bit host.
return reinterpret_cast<void*>( return reinterpret_cast<void*>(
static_cast<size_t>(window_handle)); static_cast<size_t>(window_handle));
}, },
@@ -220,10 +217,7 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
[&](DynamicVstEvents& events) -> void* { [&](DynamicVstEvents& events) -> void* {
return &events.as_c_events(); return &events.as_c_events();
}, },
[&](WantsChunkBuffer&) -> void* { [&](WantsChunkBuffer&) -> void* { return string_buffer.data(); },
binary_buffer.resize(binary_buffer_size);
return binary_buffer.data();
},
[&](VstIOProperties& props) -> void* { return &props; }, [&](VstIOProperties& props) -> void* { return &props; },
[&](VstMidiKeyName& key_name) -> void* { return &key_name; }, [&](VstMidiKeyName& key_name) -> void* { return &key_name; },
[&](VstParameterProperties& props) -> void* { return &props; }, [&](VstParameterProperties& props) -> void* { return &props; },
+1 -1
View File
@@ -279,7 +279,7 @@ class DispatchDataConverter : DefaultDataConverter {
std::get<std::vector<uint8_t>>(response.payload); std::get<std::vector<uint8_t>>(response.payload);
chunk.assign(buffer.begin(), buffer.end()); chunk.assign(buffer.begin(), buffer.end());
*static_cast<void**>(data) = chunk.data(); *static_cast<uint8_t**>(data) = chunk.data();
} break; } break;
case effGetInputProperties: case effGetInputProperties:
case effGetOutputProperties: { case effGetOutputProperties: {