[Bug 245156] audio/pulseaudio: parse /dev/sndstat correctly to get device name

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Apr 3 18:33:22 UTC 2020


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=245156

--- Comment #15 from lightside <lightside at gmx.com> ---
Created attachment 213025
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=213025&action=edit
Testcase 2

Hello, Greg V.

(In reply to Greg V from comment #14)
> I've included a solution for this that hopefully doesn't break Linux OSS or
> other BSDs (?), and does not use VLAs (variable-length arrays, which are not
> standard C) like `char desc[len + 1]` in attachment 213006
Probably you are right, if VLAs is optional in C11, and PulseAudio  changed
used C standard from C99 to C11:
https://github.com/pulseaudio/pulseaudio/blob/9562e898ddbfe61b29a9914cb7378bb0f01cc527/NEWS#L265
Changed the C standard from C99 to C11.
https://github.com/pulseaudio/pulseaudio/blob/v13.0/configure.ac#L172
AX_CHECK_COMPILE_FLAG([-std=gnu11],

But it compiled ok with using base Clang compiler on FreeBSD, in my case.

(In reply to Greg V from comment #14)
> I'm working on an upstream merge request:
> https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/277
As about your proposed code for upstreaming, the strcspn function doesn't
search in reverse for '>' character. Maybe this is not so important, but
attached testcase may show this for "Testcase 1" and how I tried to fix it with
using strrchr function in "Testcase 2":
-8<--
char line[] = "pcm4: <Realtek (0x1168) (Rear Analog 5.1/2.0)> (play/rec)
default";
Testcase 1:
4 - Realtek (0x1168) (Rear Analog 5.1/2.0)
Testcase 2:
4 - Realtek (0x1168) (Rear Analog 5.1/2.0)

char line[] = "pcm4: <Realtek (0x1168) <#> (Rear Analog 5.1/2.0)> (play/rec)
default";
Testcase 1:
4 - Realtek (0x1168) <#
Testcase 2:
4 - Realtek (0x1168) <#> (Rear Analog 5.1/2.0)
-->8-

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the freebsd-gnome mailing list