alsa/0010-control-ctlparse-fix-enum-values-in-or.patch
Takashi Iwai 4f7fd72c0e Accepting request 836375 from home:tiwai:branches:multimedia:libs
- Backport upstream fixes:
  0001-ucm-substitution-remove-duplicate-allow_empty-assign.patch
  0002-ucm-fix-parse_get_safe_name-safe-name-must-be-checke.patch
  0003-ucm-substitute-the-merged-tree-completely.patch
  0004-ctl-improve-documentation-for-identifier-of-control-.patch
  0005-pcm-dmix-make-lockless-operation-optional.patch
  0006-pcm-dmix-Fix-semaphore-usage-with-lockless-operation.patch
  0007-pcm-iec958-implement-HDMI-HBR-audio-formatting.patch
  0008-pcm-iec958-set-channel-status-bits-according-to-rate.patch
  0009-conf-pcm-USB-Added-S-PDIF-fix-for-Asus-Xonar-SE.patch
  0010-control-ctlparse-fix-enum-values-in-or.patch
  0011-conf-USB-Audio-Disable-IEC958-on-Lenovo-ThinkStation.patch
  0012-pcm-dmix-fix-access-to-sum-buffer-in-non-interleaved.patch
  0014-control-Add-documentation-for-snd_ctl_elem_list_.patch
  0015-conf-quote-also-strings-with-and-characters-in-strin.patch
  0016-topology-decode-Fix-channel-map-memory-allocation.patch
  0017-topology-decode-Fix-infinite-loop-in-decoding-enum-c.patch
  0018-topology-decode-Remove-decoding-values-for-enum-cont.patch
  0019-topology-decode-Add-enum-control-texts-as-separate-e.patch
  0020-topology-decode-Fix-printing-texts-section.patch
  0021-topology-decode-Change-declaration-of-enum-decoding-.patch
  0022-topology-decode-Fix-decoding-PCM-formats-and-rates.patch
  0023-topology-decode-Print-sig_bits-field-in-PCM-capabili.patch
  0024-topology-decode-Add-DAI-name-printing.patch
  0025-topology-Make-buffer-for-saving-dynamic-size.patch
  0026-topology-return-correct-value-in-tplg_save_printf.patch
  0027-topology-fix-some-gcc10-warnings-labs-signess.patch
  0028-topology-fix-sort_config.patch
  0029-topology-fix-the-unaligned-access.patch
  0030-topology-improve-the-printf-buffer-management.patch

OBS-URL: https://build.opensuse.org/request/show/836375
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=281
2020-09-23 16:47:30 +00:00

61 lines
1.6 KiB
Diff

From a3ca4803cb8db73d01231c69620e2d18573ffba9 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 27 Jul 2020 13:18:20 +0200
Subject: [PATCH 10/32] control: ctlparse - fix enum values in '' or ""
This comit fixes the enum value string parser
(fixes aaf3a081bff1cc85635f7a3c3d4287c4addbbd84).
BugLink: https://github.com/alsa-project/alsa-ucm-conf/pull/40
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/control/ctlparse.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/src/control/ctlparse.c b/src/control/ctlparse.c
index ee1e0602cbf7..74f76cca9ca4 100644
--- a/src/control/ctlparse.c
+++ b/src/control/ctlparse.c
@@ -282,23 +282,27 @@ static int get_ctl_enum_item_index(snd_ctl_t *handle,
if (items <= 0)
return -1;
+ end = *ptr;
+ if (end == '\'' || end == '"')
+ ptr++;
+ else
+ end = '\0';
+
for (i = 0; i < items; i++) {
snd_ctl_elem_info_set_item(info, i);
if (snd_ctl_elem_info(handle, info) < 0)
return -1;
name = snd_ctl_elem_info_get_item_name(info);
- end = *ptr;
- if (end == '\'' || end == '"')
- ptr++;
- else
- end = '\0';
len = strlen(name);
- if (strncmp(name, ptr, len) == 0) {
- if (ptr[len] == end || ptr[len] == ',' || ptr[len] == '\n') {
- ptr += len;
- *ptrp = ptr;
- return i;
- }
+ if (strncmp(name, ptr, len))
+ continue;
+ if (end == '\0' && (ptr[len] == '\0' || ptr[len] == ',' || ptr[len] == '\n')) {
+ *ptrp = ptr + len;
+ return i;
+ }
+ if (end != '\0' && ptr[len] == end) {
+ *ptrp = ptr + len + 1;
+ return i;
}
}
return -1;
--
2.16.4