]> git.alsa-project.org Git - alsa-utils.git/commitdiff
aplay: fix two off by one errors
authorJurgen Kramer <gtmkramer@xs4all.nl>
Mon, 9 Sep 2013 10:02:29 +0000 (12:02 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 9 Sep 2013 10:02:29 +0000 (12:02 +0200)
Attached patch for aplay fixes two off-by-one errors preventing usage
of the last available sample format.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
aplay/aplay.c

index 89c6b06b6dec0da3d68e7a1cd42f0c46aa29fa3b..e0631c4aa7522d099152b7d6ca5c0f41ae5b82ae 100644 (file)
@@ -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_formats(snd_pcm_hw_params_t* params)
        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));
        }