summaryrefslogtreecommitdiff
path: root/audio/xwave/patches/patch-ab
blob: 6c2d54e81172b11432d01e170342aa2393b1e856 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
$NetBSD: patch-ab,v 1.3 2001/11/18 15:03:39 itohy Exp $

--- src/aifc.c.orig	Thu Aug 13 08:27:09 1998
+++ src/aifc.c	Sun Nov 18 22:28:26 2001
@@ -9,7 +9,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>
@@ -21,8 +21,8 @@
 #include "types.h"
 #include "audio_file.h"
 #include "ieee/ieee.h"
-#include "aifc.h"
 #include "endian.h"
+#include "aifc.h"
 
 static int aifc_new(Audio_File *af);
 
@@ -49,8 +49,8 @@
    int i,count;
    Aif_Form form;
    Aif_Chunk chunk;
-   ulong frames,stamp,block_size,offset;
-   short channels,bps;
+   u_int32_t frames,stamp,block_size,offset;
+   int16_t channels,bps;
    ID comp_typ;
    unsigned char freq[10],plength,*pstring;
    bool com_found=False;
@@ -177,7 +177,7 @@
    Com_Chunk com;
    int headoffs=0;
    char freq[10];
-   ulong stamp,offset,block_size;
+   u_int32_t stamp,offset,block_size;
    int i;
 
    com.channels=af->channels;
@@ -291,7 +291,7 @@
    M_32_SWAP(form.type);
 #endif
    
-   if (aifc_seek(*af,0,SEEK_SET)==AF_ERROR) {
+   if (lseek(af->fd,0,SEEK_SET)==-1) {
       if (com.pstring!=NULL) free(com.pstring);
       return(AF_ERROR);
    }
@@ -301,7 +301,7 @@
       return(AF_ERROR);
    }
    
-   if (aifc_seek(*af,headoffs,SEEK_SET)==AF_ERROR) {
+   if (lseek(af->fd,headoffs,SEEK_SET)==-1) {
       if (com.pstring!=NULL) free(com.pstring);
       return(AF_ERROR);
    }
@@ -348,14 +348,16 @@
 {
    switch (af.comp) {
     case AF_PCM:
-      return(lseek(af.fd,pos,mode));
+      break;
+    default:
+      return(AF_ERROR);
    }
-   return(AF_ERROR);
+   return(lseek(af.fd, mode == SEEK_SET ? pos + af.headoffs : pos, mode));
 }
 
 int aifc_close(Audio_File af)
 {
-   if (aifc_seek(af,0,SEEK_SET)==AF_ERROR) return(AF_ERROR);
+   if (lseek(af.fd,0,SEEK_SET)==-1) return(AF_ERROR);
    if (aifc_new (&af)==AF_ERROR) return(AF_ERROR);
    return(close(af.fd));
 }