[xiph-cvs] cvs commit: vorbis-tools/oggenc audio.c
Michael Smith
msmith at xiph.org
Sat Jul 28 17:59:19 PDT 2001
msmith 01/07/28 17:59:18
Modified: oggenc audio.c
Log:
Another workaround for stupid broken windows apps.
wav is _not_ a hard format to get right, yet these morons fail, all the time.
Revision Changes Path
1.13 +11 -4 vorbis-tools/oggenc/audio.c
Index: audio.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis-tools/oggenc/audio.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- audio.c 2001/05/27 10:30:45 1.12
+++ audio.c 2001/07/29 00:59:18 1.13
@@ -335,7 +335,7 @@
int wav_open(FILE *in, oe_enc_opt *opt, unsigned char *oldbuf, int buflen)
{
- unsigned char buf[18];
+ unsigned char buf[16];
unsigned int len;
int samplesize;
wav_fmt format;
@@ -350,7 +350,7 @@
if(!find_wav_chunk(in, "fmt ", &len))
return 0; /* EOF */
- if(len>18 || len < 16)
+ if(len < 16)
{
fprintf(stderr, "Warning: Unrecognised format chunk in WAV header\n");
return 0; /* Weird format chunk */
@@ -365,13 +365,20 @@
if(len!=16)
fprintf(stderr,
"Warning: INVALID format chunk in wav header.\n"
- " Trying to read anyway (may not work)...\n");
+ " Trying to read anyway (may not work)...\n"
+ " The program that created this wav file is broken.\n"
+ " Don't use it, or report a bug.\n");
- if(fread(buf,1,len,in) < len)
+ if(fread(buf,1,16,in) < len)
{
fprintf(stderr, "Warning: Unexpected EOF in reading WAV header\n");
return 0;
}
+
+ /* Deal with stupid broken apps. Don't use these programs.
+ */
+ if(len - 16 > 0 && !seek_forward(in, len-16))
+ return 0;
format.format = READ_U16_LE(buf);
format.channels = READ_U16_LE(buf+2);
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list