mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Fix returning buffers from std::visit
Last time I tried it references somehow didn't work.
This commit is contained in:
@@ -165,11 +165,11 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void* data = std::visit(
|
void* data = std::visit(
|
||||||
overload{[&](std::nullptr_t) -> void* { return nullptr; },
|
overload{[&](const std::nullptr_t&) -> void* { return nullptr; },
|
||||||
[&](std::string s) -> void* {
|
[&](const std::string& s) -> void* {
|
||||||
return const_cast<char*>(s.c_str());
|
return const_cast<char*>(s.c_str());
|
||||||
},
|
},
|
||||||
[&](std::array<char, max_string_length> buffer) -> void* {
|
[&](std::array<char, max_string_length>& buffer) -> void* {
|
||||||
return buffer.data();
|
return buffer.data();
|
||||||
}},
|
}},
|
||||||
event.payload);
|
event.payload);
|
||||||
|
|||||||
@@ -142,13 +142,16 @@ void Logger::log_event(bool is_dispatch,
|
|||||||
<< ", option = " << option << ", data = ";
|
<< ", option = " << option << ", data = ";
|
||||||
|
|
||||||
std::visit(
|
std::visit(
|
||||||
overload{[&](std::nullptr_t) { message << "<nullptr>"; },
|
overload{
|
||||||
[&](std::string s) { message << "\"" << s << "\""; },
|
[&](const std::nullptr_t&) { message << "<nullptr>"; },
|
||||||
[&](std::array<char, max_string_length>) {
|
[&](const std::string& s) { message << "\"" << s << "\""; },
|
||||||
message << "<writeable_buffer>";
|
[&](const std::array<char, max_string_length>&) {
|
||||||
}},
|
message << "<writeable_buffer>";
|
||||||
|
}},
|
||||||
payload);
|
payload);
|
||||||
|
|
||||||
|
message << ")";
|
||||||
|
|
||||||
log(message.str());
|
log(message.str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user