diff options
author | 2001-04-11 01:30:24 +0000 | |
---|---|---|
committer | 2001-04-11 01:30:24 +0000 | |
commit | 4820ebda2915a70c0670345716d01f94c9d43ff5 (patch) | |
tree | ef003a82cb953a72bb8af7ace7d4451eabfc4077 | |
parent | Split RealTek 8129/8139 driver into bus-dependent and bus-independent parts; (diff) | |
download | wireguard-openbsd-4820ebda2915a70c0670345716d01f94c9d43ff5.tar.xz wireguard-openbsd-4820ebda2915a70c0670345716d01f94c9d43ff5.zip |
Fix an off-by-one error. Also, SETFRAGMENT ignores the high bit; from NetBSD.
Now the sound from the Linux binary of VGB (Virtual Gameboy) is emulated
correctly, although only with sound cards whose drivers' aren't picky about
rounding blocksizes.
-rw-r--r-- | sys/compat/ossaudio/ossaudio.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/compat/ossaudio/ossaudio.c b/sys/compat/ossaudio/ossaudio.c index 77ef973801e..873cf80a2dd 100644 --- a/sys/compat/ossaudio/ossaudio.c +++ b/sys/compat/ossaudio/ossaudio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ossaudio.c,v 1.3 2001/02/09 18:44:10 mickey Exp $ */ +/* $OpenBSD: ossaudio.c,v 1.4 2001/04/11 01:30:24 aaron Exp $ */ /* $NetBSD: ossaudio.c,v 1.23 1997/10/19 07:41:52 augustss Exp $ */ /* @@ -313,7 +313,7 @@ oss_ioctl_audio(p, uap, retval) if ((idat & 0xffff) < 4 || (idat & 0xffff) > 17) return EINVAL; tmpinfo.blocksize = 1 << (idat & 0xffff); - tmpinfo.hiwat = (idat >> 16) & 0xffff; + tmpinfo.hiwat = (idat >> 16) & 0x7fff; DPRINTF(("oss_audio: SETFRAGMENT blksize=%d, hiwat=%d\n", tmpinfo.blocksize, tmpinfo.hiwat)); if (tmpinfo.hiwat == 0) /* 0 means set to max */ @@ -323,9 +323,9 @@ oss_ioctl_audio(p, uap, retval) if (error) return error; u = tmpinfo.blocksize; - for(idat = 0; u; idat++, u >>= 1) + for(idat = 0; u > 1; idat++, u >>= 1) ; - idat |= (tmpinfo.hiwat & 0xffff) << 16; + idat |= (tmpinfo.hiwat & 0x7fff) << 16; error = copyout(&idat, SCARG(uap, data), sizeof idat); if (error) return error; |