From patchwork Wed Apr 8 16:30:58 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 6181401 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 24067BF4A6 for ; Wed, 8 Apr 2015 16:32:23 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4DB5F2037C for ; Wed, 8 Apr 2015 16:32:22 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 6157C20376 for ; Wed, 8 Apr 2015 16:32:21 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 01F44265777; Wed, 8 Apr 2015 18:32:20 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 98317265388; Wed, 8 Apr 2015 18:31:24 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4075A2654E6; Wed, 8 Apr 2015 18:31:22 +0200 (CEST) Received: from smtp311.phy.lolipop.jp (smtp311.phy.lolipop.jp [210.157.22.79]) by alsa0.perex.cz (Postfix) with ESMTP id 57A5F2654BF for ; Wed, 8 Apr 2015 18:31:13 +0200 (CEST) Received: from smtp311.phy.lolipop.lan (HELO smtp311.phy.lolipop.jp) (172.17.1.11) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp311.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Thu, 09 Apr 2015 01:31:08 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp311.phy.lolipop.jp (LOLIPOP-Fsecure); Thu, 09 Apr 2015 01:30:59 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Thu, 9 Apr 2015 01:30:58 +0900 Message-Id: <1428510659-30393-6-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1428510659-30393-1-git-send-email-o-takashi@sakamocchi.jp> References: <1428510659-30393-1-git-send-email-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 5/5] amixer: use the same characters for separator. X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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. */