Module Name:    src
Committed By:   nia
Date:           Sat May  8 12:53:15 UTC 2021

Modified Files:
        src/usr.bin/aiomixer: parse.c

Log Message:
aiomixer: Fix sorting of ac97 controls


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/aiomixer/parse.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/aiomixer/parse.c
diff -u src/usr.bin/aiomixer/parse.c:1.1 src/usr.bin/aiomixer/parse.c:1.2
--- src/usr.bin/aiomixer/parse.c:1.1	Fri May  7 16:29:24 2021
+++ src/usr.bin/aiomixer/parse.c	Sat May  8 12:53:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.1 2021/05/07 16:29:24 nia Exp $ */
+/* $NetBSD: parse.c,v 1.2 2021/05/08 12:53:15 nia Exp $ */
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -56,14 +56,16 @@ compare_control(const void *pa, const vo
 	const struct aiomixer_control *a = (const struct aiomixer_control *)pa;
 	const struct aiomixer_control *b = (const struct aiomixer_control *)pb;
 
-	if (a->info.prev != AUDIO_MIXER_LAST &&
+	if (a->info.prev != AUDIO_MIXER_LAST ||
 	    b->info.prev != AUDIO_MIXER_LAST) {
 		if (b->info.prev == a->info.index)
 			return -1;
 		if (a->info.prev == b->info.index)
 			return 1;
+	} else {
+		return strcmp(a->info.label.name, b->info.label.name);
 	}
-	return strcmp(a->info.label.name, b->info.label.name);
+	return 0;
 }
 
 int

Reply via email to