From b7b954da4d008a94c3cde60f1ecc04cad9abcfad Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Tue, 4 May 2004 13:02:03 +0000 Subject: [PATCH] don't return negative byte count from GET[IO]PTR ioctl --- alsa/pcm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/alsa/pcm.c b/alsa/pcm.c index 50c543b..a3b50a0 100644 --- a/alsa/pcm.c +++ b/alsa/pcm.c @@ -1149,8 +1149,8 @@ int lib_oss_pcm_ioctl(int fd, unsigned long cmd, ...) diff += str->alsa.boundary; str->oss.hw_bytes += diff; str->oss.hw_bytes %= str->oss.boundary; - info->bytes = str->oss.hw_bytes * str->frame_bytes; - info->ptr = info->bytes % (str->oss.buffer_size * str->frame_bytes); + info->bytes = (str->oss.hw_bytes * str->frame_bytes) & 0x7fffffff; + info->ptr = (str->oss.hw_bytes % str->oss.buffer_size) * str->frame_bytes; if (str->mmap_buffer) { ssize_t n = (hw_ptr / str->oss.period_size) - (str->alsa.old_hw_ptr / str->oss.period_size); if (n < 0) @@ -1192,8 +1192,8 @@ int lib_oss_pcm_ioctl(int fd, unsigned long cmd, ...) diff += str->alsa.boundary; str->oss.hw_bytes += diff; str->oss.hw_bytes %= str->oss.boundary; - info->bytes = str->oss.hw_bytes * str->frame_bytes; - info->ptr = info->bytes % (str->oss.buffer_size * str->frame_bytes); + info->bytes = (str->oss.hw_bytes * str->frame_bytes) & 0x7fffffff; + info->ptr = (str->oss.hw_bytes % str->oss.buffer_size) * str->frame_bytes; if (str->mmap_buffer) { ssize_t n = (hw_ptr / str->oss.period_size) - (str->alsa.old_hw_ptr / str->oss.period_size); if (n < 0) -- 2.47.1