All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: clemens@ladisch.de, tiwai@suse.de
Cc: alsa-devel@alsa-project.org
Subject: [PATCH 5/5] amixer: use the same characters for separator.
Date: Thu,  9 Apr 2015 01:30:58 +0900	[thread overview]
Message-ID: <1428510659-30393-6-git-send-email-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <1428510659-30393-1-git-send-email-o-takashi@sakamocchi.jp>

The arguments are parsed as the value of each channel for enumerated
element in sset_enum() and get_enum_item_index(), the former is
a caller and the latter is a callee. Both of them evaluate the string
but use different characters for separator. This brings just cofusion
to users.

This commit fix this bug, by changing callee's characters according to
caller's characters.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 amixer/amixer.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/amixer/amixer.c b/amixer/amixer.c
index aec8d01..fa4bde1 100644
--- a/amixer/amixer.c
+++ b/amixer/amixer.c
@@ -1276,8 +1276,8 @@ static int get_enum_item_index(snd_mixer_elem_t *elem, char **ptrp)
 		if (strncmp(name, ptr, len) != 0)
 			continue;
 
-		/* Lack of separators between channels. */
-		if (ptr[len] != '\0' && ptr[len] != ',' && ptr[len] != '\n')
+		/* Lack of string terminator and separator between channels. */
+		if (ptr[len] != '\0' && ptr[len] != ',' && !isspace(ptr[len]))
 			continue;
 
 		/* OK. The string is exactly one of items. */
-- 
2.1.0

  parent reply	other threads:[~2015-04-08 16:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-08 16:30 [PATCH 0/5 alsa-lib] amixer fixes for enumerated elements Takashi Sakamoto
2015-04-08 16:30 ` [PATCH 1/5] amixer: gather local variables in the beginning of functions Takashi Sakamoto
2015-04-09  6:06   ` Takashi Iwai
2015-04-08 16:30 ` [PATCH 2/5] amixer: fix a bug to handle omitted value in parameter for enumerated element Takashi Sakamoto
2015-04-09  6:09   ` Takashi Iwai
2015-04-08 16:30 ` [PATCH 3/5] amixer: expand local storage for item name according to kernel code Takashi Sakamoto
2015-04-09  6:18   ` Takashi Iwai
2015-04-08 16:30 ` [PATCH 4/5] amixer: arrange validation logic Takashi Sakamoto
2015-04-09  6:17   ` Takashi Iwai
2015-04-08 16:30 ` Takashi Sakamoto [this message]
2015-04-08 16:37 ` [PATCH 0/5 alsa-utils] amixer fixes for enumerated elements Takashi Sakamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1428510659-30393-6-git-send-email-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.