2013-09-26 17:14:40 +02:00

82 lines
1.9 KiB
Plaintext

$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));
}