diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2007-07-17 08:35:34 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2007-07-17 08:35:34 +0000 |
commit | 4efdde5a1d2ee922bbc505542edf36562116656e (patch) | |
tree | 78cbe7354d6e9f106b6444ad21275aebc4a208fa /sys/dev/auconv.c | |
parent | 4d3fa876369d0d30db6f16ec46ac4091f9e1477c (diff) |
when looping through an array and advancing your pointer to the array
2x on each loop, only loop .5x times
fixes hard hangs on i386 and "hiccups" on sgi when these functions are
used through e.g. dd if=/dev/audio of=foo, since mulaw is the default
encoding.
the commit history wrt this code is interesting. I am responsible for
introducing this braindamage to OpenBSD ... and note that
linear16_to_linear8_[lb]e had it right ...
Diffstat (limited to 'sys/dev/auconv.c')
-rw-r--r-- | sys/dev/auconv.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/dev/auconv.c b/sys/dev/auconv.c index fdacfd764b4..d3d409a2c57 100644 --- a/sys/dev/auconv.c +++ b/sys/dev/auconv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: auconv.c,v 1.6 2003/06/27 00:23:43 jason Exp $ */ +/* $OpenBSD: auconv.c,v 1.7 2007/07/17 08:35:33 jakemsr Exp $ */ /* $NetBSD: auconv.c,v 1.3 1999/11/01 18:12:19 augustss Exp $ */ /* @@ -200,7 +200,7 @@ linear16_to_ulinear8_le(void *v, u_char *p, int cc) { u_char *q = p; - while (--cc >= 0) { + while ((cc -= 2) >= 0) { *q++ = p[1] ^ 0x80; p += 2; } @@ -211,7 +211,7 @@ linear16_to_ulinear8_be(void *v, u_char *p, int cc) { u_char *q = p; - while (--cc >= 0) { + while ((cc -= 2) >= 0) { *q++ = p[0] ^ 0x80; p += 2; } |