]> git.alsa-project.org Git - alsa-oss.git/commitdiff
don't return negative byte count from GET[IO]PTR ioctl
authorClemens Ladisch <clemens@ladisch.de>
Tue, 4 May 2004 13:02:03 +0000 (13:02 +0000)
committerClemens Ladisch <clemens@ladisch.de>
Tue, 4 May 2004 13:02:03 +0000 (13:02 +0000)
alsa/pcm.c

index 50c543bc2c48984744d9f1096f5c30cf92e63457..a3b50a003cd0b149df3bc40f9d6cca66a288acc2 100644 (file)
@@ -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)