Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys/dev Pull up following revision(s) (requested by jmcne...
details: https://anonhg.NetBSD.org/src/rev/70e87d11a45a
branches: netbsd-7
changeset: 798613:70e87d11a45a
user: martin <martin%NetBSD.org@localhost>
date: Sun Nov 23 13:23:50 2014 +0000
description:
Pull up following revision(s) (requested by jmcneill in ticket #256):
sys/dev/auvolconv.c: revision 1.2
When this code was split from dev/pad, the "volume" member size was changed
from u_int to uint8_t. This had the unfortunate side-effect of introducing
an integer overflow when adjusting samples as the largest type used was now
int16_t. This change copies the volume level to a temporary u_int and uses
that in the calculation. Fixes recent failures with the
dev/audio/t_pad/pad_output test.
diffstat:
sys/dev/auvolconv.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
diffs (62 lines):
diff -r be4c466c5584 -r 70e87d11a45a sys/dev/auvolconv.c
--- a/sys/dev/auvolconv.c Sun Nov 23 13:13:26 2014 +0000
+++ b/sys/dev/auvolconv.c Sun Nov 23 13:23:50 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: auvolconv.c,v 1.2.2.2 2014/11/23 13:07:05 martin Exp $ */
+/* $NetBSD: auvolconv.c,v 1.2.2.3 2014/11/23 13:23:50 martin Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auvolconv.c,v 1.2.2.2 2014/11/23 13:07:05 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvolconv.c,v 1.2.2.3 2014/11/23 13:23:50 martin Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -49,10 +49,12 @@
stream_filter_t *this;
int16_t j, *wp;
int m, err;
+ u_int vol;
pf = (auvolconv_filter_t *)self;
this = &pf->base;
max_used = (max_used + 1) & ~1;
+ vol = *pf->vol;
if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used)))
return err;
@@ -61,7 +63,7 @@
FILTER_LOOP_PROLOGUE(this->src, 2, dst, 2, m) {
j = le16dec(s);
wp = (int16_t *)d;
- le16enc(wp, (j * *pf->vol) / 255);
+ le16enc(wp, (j * vol) / 255);
} FILTER_LOOP_EPILOGUE(this->src, dst);
return 0;
@@ -75,10 +77,12 @@
stream_filter_t *this;
int16_t j, *wp;
int m, err;
+ u_int vol;
pf = (auvolconv_filter_t *)self;
this = &pf->base;
max_used = (max_used + 1) & ~1;
+ vol = *pf->vol;
if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used)))
return err;
@@ -87,7 +91,7 @@
FILTER_LOOP_PROLOGUE(this->src, 2, dst, 2, m) {
j = be16dec(s);
wp = (int16_t *)d;
- be16enc(wp, (j * *pf->vol) / 255);
+ be16enc(wp, (j * vol) / 255);
} FILTER_LOOP_EPILOGUE(this->src, dst);
return 0;
Home |
Main Index |
Thread Index |
Old Index