Commit 9d825963 authored by Timothy B. Terriberry's avatar Timothy B. Terriberry
Browse files

Make opusfile_example fwrites all-or-nothing.

This makes it more likely the WAV file header matches the amount of
 data actually written if we run out of space.
This is easier than making the accounting better.
parent 1cea8f6b
......@@ -301,7 +301,7 @@ int main(int _argc,const char **_argv){
out[2*si+0]=(unsigned char)(pcm[si]&0xFF);
out[2*si+1]=(unsigned char)(pcm[si]>>8&0xFF);
}
if(!fwrite(out,sizeof(*out)*4,ret,stdout)){
if(!fwrite(out,sizeof(*out)*4*ret,1,stdout)){
fprintf(stderr,"\nError writing decoded audio data: %s\n",
strerror(errno));
ret=EXIT_FAILURE;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment