# HG changeset patch # User Michael Pavone # Date 1392151515 28800 # Node ID 6e9d1a8c1b083cc9ca8762031f08c6ad529736a4 # Parent f66c78cbdcaa90a261edbe2a5c38eb017af13e30 Fix check of fwrite return value in wave_finalize so that the data subchunk size gets written diff -r f66c78cbdcaa -r 6e9d1a8c1b08 wave.c --- a/wave.c Fri Feb 07 21:18:05 2014 -0800 +++ b/wave.c Tue Feb 11 12:45:15 2014 -0800 @@ -1,6 +1,6 @@ /* Copyright 2013 Michael Pavone - This file is part of BlastEm. + This file is part of BlastEm. BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text. */ #include "wave.h" @@ -31,13 +31,13 @@ uint32_t size = ftell(f); fseek(f, offsetof(wave_header, chunk.size), SEEK_SET); size -= 8; - if (fwrite(&size, sizeof(size), 1, f) != sizeof(size)) { + if (fwrite(&size, sizeof(size), 1, f) != 1) { fclose(f); return 0; } fseek(f, offsetof(wave_header, data_header.size), SEEK_SET); size -= 36; - if (fwrite(&size, sizeof(size), 1, f)) { + if (fwrite(&size, sizeof(size), 1, f) != 1) { fclose(f); return 0; }