Skip to content

Fix lsl_get_channel_bytes to return 0 for cft_string as documented#261

Closed
myd7349 wants to merge 1 commit into
sccn:devfrom
SharpLSL:fix-channel-bytes
Closed

Fix lsl_get_channel_bytes to return 0 for cft_string as documented#261
myd7349 wants to merge 1 commit into
sccn:devfrom
SharpLSL:fix-channel-bytes

Conversation

@myd7349

@myd7349 myd7349 commented Jan 28, 2026

Copy link
Copy Markdown
Contributor

The documentation for lsl_get_channel_bytes states that it returns 0 for the string type (cft_string), but in practice this is not the case:

/// Number of bytes occupied by a channel (0 for string-typed channels).
extern LIBLSL_C_API int32_t lsl_get_channel_bytes(lsl_streaminfo info);

This patch fixes the issue by returning 0 for the string type.

@myd7349 myd7349 changed the title Fix channel_bytes of string type Fix lsl_get_channel_bytes to return 0 for cft_string as documented Jan 28, 2026
@myd7349 myd7349 marked this pull request as ready for review January 28, 2026 14:13
@myd7349 myd7349 marked this pull request as draft January 28, 2026 14:39
@myd7349

myd7349 commented Jan 28, 2026

Copy link
Copy Markdown
Contributor Author

The endianness unit test appears to have failed. I will try to fix this issue.

@cboulay

cboulay commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Thanks @myd7349 — this is correct and worth finishing. Picked it up in #281, which keeps your fix and resolves the tcpserver endian test failure you ran into. That failure turned out to be expected: with channel_bytes() returning 0 for strings, the server stops volunteering an endian conversion and advertises its own host byte order; the string length-prefixes are byte-swapped on the receiving side instead (the data path uses the separate format_sizes[] table, which is unchanged). Updated the test to assert the host byte order accordingly. Full internal + exported test suites pass locally. Will close this once #281 lands.

@cboulay cboulay closed this in #281 Jun 17, 2026
@myd7349 myd7349 deleted the fix-channel-bytes branch June 17, 2026 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants