summaryrefslogtreecommitdiff
path: root/audio/dap/patches/patch-ak
blob: 6cebf98a7d906ea5445cee4ef846517ee2d7adf9 (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
82
83
84
85
86
87
88
$NetBSD: patch-ak,v 1.1.1.1 1999/12/04 12:56:31 scw Exp $

--- libaudiofile/raw.c.orig	Fri Nov 12 17:46:53 1999
+++ libaudiofile/raw.c	Tue Nov 30 15:54:00 1999
@@ -29,7 +29,7 @@
 /*---------------------------------------------------------------------------
 | FUNCTION AFreadRAW
 ---------------------------------------------------------------------------*/
-AFfilehandle AFreadRAW (int file, rawType details)
+AFfilehandle AFreadRAW (fhandle file, rawType details)
 {
   struct stat s;
   aiffHandle handleAct;
@@ -61,7 +61,11 @@
     handle->aiff.width = 16;
   
   // Can calculate frames from size of file
+#ifndef USE_STDIO
   if (fstat (file,&s) == -1) return AF_NULL_FILEHANDLE;
+#else
+  if (fstat (fileno(file),&s) == -1) return AF_NULL_FILEHANDLE;
+#endif
   
   handle->aiff.framecount = s.st_size / details.channels;
   switch (details.dataFormat)
@@ -83,7 +87,7 @@
 /*---------------------------------------------------------------------------
 | FUNCTION AFwriteRAW
 ---------------------------------------------------------------------------*/
-AFfilehandle AFwriteRAW (int file,AFfilesetup setup)
+AFfilehandle AFwriteRAW (fhandle file,AFfilesetup setup)
 {
   aiffHandle handleAct;
   AFfilehandle handle = &handleAct;
@@ -114,7 +118,11 @@
   // If error then return negative number
 
   if (!handle) return -1;
+#ifndef USE_STDIO
   if (close (handle->file) == -1) return -1;
+#else
+  if (fclose (handle->file) == -1) return -1;
+#endif
   free (handle);
   return 0;
 }
@@ -127,7 +135,7 @@
   int i;
   int j;
   int frameCount;
-  int file;
+  fhandle file;
   unsigned char uctemp;
   signed char ctemp;
   unsigned short ustemp;
@@ -147,7 +155,11 @@
   i = 0;
   frameCount = 0;
   while (handle->actualFrames < handle->aiff.framecount &&
+#ifndef USE_STDIO
     frameCount < count) // && !(feof (file)))
+#else
+    frameCount < count && !(feof (file)))
+#endif
   {
     for (j=0; j<handle->aiff.channels; j++)
     {
@@ -252,7 +264,7 @@
   int i;
   int j;
   int frameCount;
-  int file;
+  fhandle file;
   unsigned char uctemp;
   signed char ctemp;
   unsigned short ustemp;
@@ -271,7 +283,11 @@
 
   i = 0;
   frameCount = 0;
+#ifndef USE_STDIO
   while (frameCount < count) // && !(feof (file)))
+#else
+  while (frameCount < count && !(feof (file)))
+#endif
   {
     for (j=0; j<handle->aiff.channels; j++)
     {