mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-06 19:40:10 +02:00
Improve event passing clarity
This commit is contained in:
@@ -37,14 +37,14 @@ intptr_t send_event(boost::asio::local::stream_protocol::socket& socket,
|
||||
response.data);
|
||||
}
|
||||
if (response.data.has_value()) {
|
||||
char* char_data = static_cast<char*>(data);
|
||||
char* output = static_cast<char*>(data);
|
||||
|
||||
// For correctness we will copy the entire buffer and add a terminating
|
||||
// null byte ourselves. In practice `response.data` will only ever
|
||||
// contain C-style strings, but this would work with any other data
|
||||
// format that can contain null bytes.
|
||||
std::copy(response.data->begin(), response.data->end(), char_data);
|
||||
char_data[response.data->size()] = 0;
|
||||
std::copy(response.data->begin(), response.data->end(), output);
|
||||
output[response.data->size()] = 0;
|
||||
}
|
||||
|
||||
return response.return_value;
|
||||
|
||||
@@ -183,7 +183,7 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
|
||||
const auto response_data =
|
||||
std::holds_alternative<std::array<char, max_string_length>>(
|
||||
event.payload)
|
||||
? std::make_optional(static_cast<char*>(data))
|
||||
? std::optional(std::string(static_cast<char*>(data)))
|
||||
: std::nullopt;
|
||||
|
||||
if (logging.has_value()) {
|
||||
|
||||
Reference in New Issue
Block a user