diff --git a/src/stream_info_impl.cpp b/src/stream_info_impl.cpp index 887911ef..9c680db5 100644 --- a/src/stream_info_impl.cpp +++ b/src/stream_info_impl.cpp @@ -243,7 +243,7 @@ bool query_cache::matches_query(const xml_document &doc, const std::string &quer } int stream_info_impl::channel_bytes() const { - const int channel_format_sizes[] = {0, sizeof(float), sizeof(double), sizeof(std::string), + const int channel_format_sizes[] = {0, sizeof(float), sizeof(double), 0, sizeof(int32_t), sizeof(int16_t), sizeof(int8_t), 8}; return channel_format_sizes[channel_format_]; } diff --git a/testing/int/tcpserver.cpp b/testing/int/tcpserver.cpp index 6444139f..f984c5b2 100644 --- a/testing/int/tcpserver.cpp +++ b/testing/int/tcpserver.cpp @@ -3,6 +3,7 @@ #include "send_buffer.h" #include "stream_info_impl.h" #include "tcp_server.h" +#include "util/endian.hpp" #include #include #include @@ -138,10 +139,15 @@ TEST_CASE("tcpserver", "[network]") { cmp_binstr(expected, received_pattern); })); + // String channels report a per-channel value size of 0 (channel_bytes() == 0), so the server + // performs no endian conversion and advertises its own (host) byte order regardless of the + // client's request. Any needed swapping of the string length-prefixes happens on the receiving + // side instead (see tcpserver_float for the actual binary endian-conversion test). send_request(ctx, ep, asio::buffer("LSL:streamfeed/199 \nNative-byte-order:4321\r\n\r\n"), with_read_callback("endian", [](const std::string &res) { REQUIRE(res.substr(0, 14) == "LSL/110 200 OK"); - REQUIRE(res.find("Byte-Order: 4321") != std::string::npos); + REQUIRE(res.find("Byte-Order: " + std::to_string(static_cast(lsl::LSL_BYTE_ORDER))) != + std::string::npos); })); send_request(ctx, ep, asio::buffer("LSL:streamfeed\n0 0\r\n"),