Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Adjust array bounds depending on type in macros for ...



details:   https://anonhg.NetBSD.org/src/rev/6b0b25bfabdb
branches:  trunk
changeset: 822455:6b0b25bfabdb
user:      nat <nat%NetBSD.org@localhost>
date:      Mon Mar 20 22:42:39 2017 +0000

description:
Adjust array bounds depending on type in macros for mix/saturate/recswvol.

diffstat:

 sys/dev/audio.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (45 lines):

diff -r d25f5d2d6887 -r 6b0b25bfabdb sys/dev/audio.c
--- a/sys/dev/audio.c   Mon Mar 20 22:17:56 2017 +0000
+++ b/sys/dev/audio.c   Mon Mar 20 22:42:39 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.315 2017/03/16 00:21:30 maya Exp $ */
+/*     $NetBSD: audio.c,v 1.316 2017/03/20 22:42:39 nat Exp $  */
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.315 2017/03/16 00:21:30 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.316 2017/03/20 22:42:39 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -5541,7 +5541,7 @@
                        if (cc > cc2)                                   \
                                cc = cc2;                               \
                                                                        \
-                       for (m = 0; m < cc / 2; m++) {                  \
+                       for (m = 0; m < (cc / (name / 8)); m++) {       \
                                orig[m] += (type)((int32_t)(tomix[m] *  \
                                    (vc->sc_swvol + 1)) / (sc->sc_opens * \
                                    256));                              \
@@ -5594,7 +5594,7 @@
                                                                        \
                orig = (type *)(sc->sc_pr.s.inp);                       \
                                                                        \
-               for (m = 0; m < resid;m++) {                            \
+               for (m = 0; m < (resid / (name / 8));m++) {             \
                        i = 0;                                          \
                        if (&orig[m] >= (type *)sc->sc_pr.s.end) {      \
                                orig = (type *)sc->sc_pr.s.start;       \
@@ -5655,7 +5655,7 @@
                        if (cc > cc1)                                   \
                                cc = cc1;                               \
                                                                        \
-                       for (m = 0; m < cc; m++) {                      \
+                       for (m = 0; m < (cc / (name / 8)); m++) {       \
                                orig[m] = (bigger_type)(orig[m] *       \
                                    (bigger_type)(vc->sc_recswvol) / 256);\
                        }                                               \



Home | Main Index | Thread Index | Old Index