From: Takashi Iwai Subject: Re: [PATCH] aplay - fix two off by one errors Date: Mon, 09 Sep 2013 12:03:26 +0200 Message-ID: References: <127132b074e97d56b5deab572b9c2176.squirrel@webmail.xs4all.nl> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 2F4B1261A74 for ; Mon, 9 Sep 2013 12:01:17 +0200 (CEST) In-Reply-To: <127132b074e97d56b5deab572b9c2176.squirrel@webmail.xs4all.nl> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Jurgen Kramer Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Sun, 8 Sep 2013 13:50:51 +0200, Jurgen Kramer wrote: > > Attached patch for aplay fixes two off-by-one errors preventing usage of > the last available sample format. > > diff -uNrp alsa-utils-1.0.27.2/aplay/aplay.c > alsa-utils-1.0.27.2-jk/aplay/aplay.c > --- alsa-utils-1.0.27.2/aplay/aplay.c 2013-07-09 17:28:37.000000000 +0200 > +++ alsa-utils-1.0.27.2-jk/aplay/aplay.c 2013-09-08 13:46:23.746825429 +0200 > @@ -242,7 +242,7 @@ _("Usage: %s [OPTION]... [FILE]...\n" > ) > , command); > printf(_("Recognized sample formats are:")); > - for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { > + for (k = 0; k <= SND_PCM_FORMAT_LAST; ++k) { > const char *s = snd_pcm_format_name(k); > if (s) > printf(" %s", s); > @@ -1114,7 +1114,7 @@ static void show_available_sample_format > snd_pcm_format_t format; > > fprintf(stderr, "Available formats:\n"); > - for (format = 0; format < SND_PCM_FORMAT_LAST; format++) { > + for (format = 0; format <= SND_PCM_FORMAT_LAST; format++) { > if (snd_pcm_hw_params_test_format(handle, params, format) == 0) > fprintf(stderr, "- %s\n", snd_pcm_format_name(format)); > } > > > Jurgen Thanks, applied now. Takashi