$NetBSD: patch-aj,v 1.3 2001/11/18 15:03:39 itohy Exp $ --- src/riff.c.orig Thu Aug 13 08:27:10 1998 +++ src/riff.c Sun Nov 18 22:19:23 2001 @@ -33,7 +33,7 @@ #ifdef linux #include -#elif defined (FreeBSD) +#elif defined (FreeBSD) || defined(__NetBSD__) #include #elif defined (sgi) #include @@ -45,12 +45,12 @@ #include "types.h" #include "audio_file.h" +#include "endian.h" #include "riff.h" #include "xwave.h" #include "ccitt/g711.h" #include "ccitt/g72x.h" #include "adpcm2pcm/adpcm.h" -#include "endian.h" extern Main_Data *MD; @@ -79,9 +79,10 @@ { RiffHeader rh; FmtHeader fh; - long chunk; + int32_t chunk; int headoffs,i; - ulong length,slength; + u_int32_t length; + off_t slength; if (mode==AF_NEW) return(riff_new(af)); @@ -112,7 +113,7 @@ if ((i=read (af->fd,&chunk,sizeof(chunk)))!=sizeof(chunk)) return(AF_ERROR); headoffs+=i; - if ((i=read (af->fd,&length,sizeof(ulong)))!=sizeof(ulong)) + if ((i=read (af->fd,&length,sizeof(length)))!=sizeof(length)) return(AF_ERROR); headoffs+=i; @@ -172,8 +173,9 @@ { RiffHeader rh; FmtHeader fh; - long chunk; - ulong length,count; + int32_t chunk; + u_int32_t length; + int count; length=af->length; @@ -344,19 +346,26 @@ { switch (af.comp) { case AF_PCM: + break; return(lseek(af.fd,pos,mode)); case AF_ALAW: case AF_MULAW: + pos /= 2; + break; return(lseek(af.fd,pos/2,mode)); case AF_ADPCM: + pos /= 4; + break; return(lseek(af.fd,pos/4,mode)); + default: + return(AF_ERROR); } - return(AF_ERROR); + return(lseek(af.fd, mode == SEEK_SET ? pos + af.headoffs : pos, mode)); } int riff_close(Audio_File af) { - if (riff_seek(af,0,SEEK_SET)==AF_ERROR) return(AF_ERROR); + if (lseek(af.fd,0,SEEK_SET)) return(AF_ERROR); if (riff_new (&af)==AF_ERROR) return(AF_ERROR); return(close(af.fd));