[pulseaudio-commits] [Git][pulseaudio/pulseaudio][master] alsa-ucm: remove extra space from the device.intended_roles property

PulseAudio Marge Bot (@pulseaudio-merge-bot) gitlab at gitlab.freedesktop.org
Tue Jul 5 09:48:41 UTC 2022



PulseAudio Marge Bot pushed to branch master at PulseAudio / pulseaudio


Commits:
eb870fcb by Jaroslav Kysela at 2022-06-29T17:03:46+02:00
alsa-ucm: remove extra space from the device.intended_roles property

Before:
  device.intended_roles = " voice"

After:
  device.intended_roles = "voice"

Signed-off-by: Jaroslav Kysela <perex at perex.cz>
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/731>

- - - - -


1 changed file:

- src/modules/alsa/alsa-ucm.c


Changes:

=====================================
src/modules/alsa/alsa-ucm.c
=====================================
@@ -730,7 +730,7 @@ static void add_media_role(pa_alsa_ucm_device *dev, const char *role_name, const
 }
 
 static char *modifier_name_to_role(const char *mod_name, bool *is_sink) {
-    char *sub = NULL, *tmp;
+    char *sub = NULL, *tmp, *pos;
 
     *is_sink = false;
 
@@ -740,19 +740,24 @@ static char *modifier_name_to_role(const char *mod_name, bool *is_sink) {
     } else if (pa_startswith(mod_name, "Capture"))
         sub = pa_xstrdup(mod_name + 7);
 
-    if (!sub || !*sub) {
+    pos = sub;
+    while (pos && *pos == ' ') pos++;
+
+    if (!pos || !*pos) {
         pa_xfree(sub);
         pa_log_warn("Can't match media roles for modifier %s", mod_name);
         return NULL;
     }
 
-    tmp = sub;
+    tmp = pos;
 
     do {
         *tmp = tolower(*tmp);
     } while (*(++tmp));
 
-    return sub;
+    tmp = pa_xstrdup(pos);
+    pa_xfree(sub);
+    return tmp;
 }
 
 static void ucm_set_media_roles(pa_alsa_ucm_modifier *modifier, const char *mod_name) {



View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/eb870fcba9f1d3d9e4d0823012ff04ac2bea00ca

-- 
View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/commit/eb870fcba9f1d3d9e4d0823012ff04ac2bea00ca
You're receiving this email because of your account on gitlab.freedesktop.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/pulseaudio-commits/attachments/20220705/7f9f89bd/attachment-0001.htm>


More information about the pulseaudio-commits mailing list