summaryrefslogtreecommitdiff
path: root/audio/xwave/patches/patch-ac
blob: e18822a1b5860f860e40146f2eee6fe935eac4eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
$NetBSD: patch-ac,v 1.3 2001/11/18 15:03:39 itohy Exp $

--- src/au.c.orig	Thu Aug 13 08:27:09 1998
+++ src/au.c	Sun Nov 18 22:22:37 2001
@@ -32,7 +32,7 @@
 
 #ifdef linux
 #include <endian.h>
-#elif defined (FreeBSD)
+#elif defined (FreeBSD)  || defined(__NetBSD__)
 #include <machine/endian.h>
 #elif defined (sgi)
 #include <sys/endian.h>
@@ -212,16 +212,19 @@
 {
    switch (af.comp) {
     case AF_PCM:
-      return(lseek(af.fd,pos,mode));
+      break;
     case AF_MULAW:
-      return(lseek(af.fd,pos/2,mode));
+      pos /= 2;
+      break;
+    default:
+      return(AF_ERROR);
    }
-   return(AF_ERROR);
+   return(lseek(af.fd, mode == SEEK_SET ? pos + af.headoffs : pos, mode));
 }
 
 int au_close(Audio_File af)
 {
-   if (au_seek(af,0,SEEK_SET)==AF_ERROR) return(AF_ERROR);
+   if (lseek(af.fd,0,SEEK_SET)==-1) return(AF_ERROR);
    if (au_new (&af)==AF_ERROR) return(AF_ERROR);
    return(close(af.fd));
 }