Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src getdevinfo():



details:   https://anonhg.NetBSD.org/src/rev/c73bc3f7837c
branches:  trunk
changeset: 571331:c73bc3f7837c
user:      kent <kent%NetBSD.org@localhost>
date:      Thu Nov 18 14:02:42 2004 +0000

description:
getdevinfo():
 If a mixer item does not match with AudioNsomething, check whether
it ends with '.' + AudioNsomething.  PR#15441

diffstat:

 lib/libossaudio/ossaudio.c     |  16 ++++++++++++----
 sys/compat/ossaudio/ossaudio.c |  16 ++++++++++++----
 2 files changed, 24 insertions(+), 8 deletions(-)

diffs (90 lines):

diff -r 86795f970cbb -r c73bc3f7837c lib/libossaudio/ossaudio.c
--- a/lib/libossaudio/ossaudio.c        Thu Nov 18 12:00:18 2004 +0000
+++ b/lib/libossaudio/ossaudio.c        Thu Nov 18 14:02:42 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ossaudio.c,v 1.18 2003/03/09 01:09:50 lukem Exp $      */
+/*     $NetBSD: ossaudio.c,v 1.19 2004/11/18 14:02:42 kent Exp $       */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: ossaudio.c,v 1.18 2003/03/09 01:09:50 lukem Exp $");
+__RCSID("$NetBSD: ossaudio.c,v 1.19 2004/11/18 14:02:42 kent Exp $");
 
 /*
  * This is an OSS (Linux) sound API emulator.
@@ -546,6 +546,7 @@
        static struct audiodevinfo devcache = { 0 };
        struct audiodevinfo *di = &devcache;
        struct stat sb;
+       int mlen, dlen;
 
        /* Figure out what device it is so we can check if the
         * cached data is valid.
@@ -575,9 +576,16 @@
                        break;
                switch(mi.type) {
                case AUDIO_MIXER_VALUE:
-                       for(dp = devs; dp->name; dp++)
-                               if (strcmp(dp->name, mi.label.name) == 0)
+                       for(dp = devs; dp->name; dp++) {
+                               if (strcmp(dp->name, mi.label.name) == 0)
                                        break;
+                               dlen = strlen(dp->name);
+                               mlen = strlen(mi.label.name);
+                               if (dlen < mlen
+                                   && mi.label.name[mlen-dlen-1] == '.'
+                                   && strcmp(dp->name, mi.label.name + mlen - dlen) == 0)
+                                       break;
+                       }
                        if (dp->code >= 0) {
                                di->devmap[dp->code] = i;
                                di->rdevmap[i] = dp->code;
diff -r 86795f970cbb -r c73bc3f7837c sys/compat/ossaudio/ossaudio.c
--- a/sys/compat/ossaudio/ossaudio.c    Thu Nov 18 12:00:18 2004 +0000
+++ b/sys/compat/ossaudio/ossaudio.c    Thu Nov 18 14:02:42 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ossaudio.c,v 1.45 2003/06/29 22:29:41 fvdl Exp $       */
+/*     $NetBSD: ossaudio.c,v 1.46 2004/11/18 14:02:42 kent Exp $       */
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.45 2003/06/29 22:29:41 fvdl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.46 2004/11/18 14:02:42 kent Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -632,6 +632,7 @@
        struct vattr va;
        static struct audiodevinfo devcache = { 0 };
        struct audiodevinfo *di = &devcache;
+       int mlen, dlen;
 
        /* 
         * Figure out what device it is so we can check if the
@@ -665,9 +666,16 @@
                        break;
                switch(mi.type) {
                case AUDIO_MIXER_VALUE:
-                       for(dp = devs; dp->name; dp++)
-                               if (strcmp(dp->name, mi.label.name) == 0)
+                       for(dp = devs; dp->name; dp++) {
+                               if (strcmp(dp->name, mi.label.name) == 0)
                                        break;
+                               dlen = strlen(dp->name);
+                               mlen = strlen(mi.label.name);
+                               if (dlen < mlen
+                                   && mi.label.name[mlen-dlen-1] == '.'
+                                   && strcmp(dp->name, mi.label.name + mlen - dlen) == 0)
+                                       break;
+                       }
                        if (dp->code >= 0) {
                                di->devmap[dp->code] = i;
                                di->rdevmap[i] = dp->code;



Home | Main Index | Thread Index | Old Index