[alsa-devel] Alsa-lib strings?

David Henningsson diwic at ubuntu.com
Fri Sep 30 08:39:35 CEST 2016


Hi,

I'm making some rust bindings for alsa-lib [1] and Rust is quite picky 
about strings; i e, requires them to be UTF-8.

1a) can I count on alsa-lib's strings (everything from card name and 
mixer identifiers to various descriptions) to be UTF-8 or perhaps even 
7-bit? If not, what encoding is to be expected?

1b) In what way can buggy drivers violate the answers to 1a?

2) Can I count on the strings to be zero terminated? E g, I looked at 
snd_ctl_elem_id_set_name 
<http://www.alsa-project.org/alsa-doc/alsa-lib/group___control.html#ga813d02a44a9d01a4a2fe81eda7a8670a> 
that sets all 44 characters without ensuring a zero at the last 
character, but snd_ctl_elem_id_get_name 
<http://www.alsa-project.org/alsa-doc/alsa-lib/group___control.html#gaa6cfea3ac963bfdaeb8189e03e927a76> 
does not say anything about a max length, it just gives out a *const 
char. The question applies to all other strings as well.

// David

[1] https://docs.rs/alsa/



More information about the Alsa-devel mailing list