* [PATCH] aplay - fix two off by one errors
@ 2013-09-08 11:50 Jurgen Kramer
2013-09-09 10:03 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Jurgen Kramer @ 2013-09-08 11:50 UTC (permalink / raw)
To: alsa-devel
[-- Attachment #1: Type: text/plain, Size: 1059 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: aplay-fix-off-by-one-errors.patch --]
[-- Type: text/x-patch; name="aplay-fix-off-by-one-errors.patch", Size: 934 bytes --]
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));
}
[-- Attachment #3: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] aplay - fix two off by one errors
2013-09-08 11:50 [PATCH] aplay - fix two off by one errors Jurgen Kramer
@ 2013-09-09 10:03 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2013-09-09 10:03 UTC (permalink / raw)
To: Jurgen Kramer; +Cc: alsa-devel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-09-09 10:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-08 11:50 [PATCH] aplay - fix two off by one errors Jurgen Kramer
2013-09-09 10:03 ` Takashi Iwai
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.