Mercurial > repos > blastem
diff wave.c @ 520:6e9d1a8c1b08
Fix check of fwrite return value in wave_finalize so that the data subchunk size gets written
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 11 Feb 2014 12:45:15 -0800 |
parents | 140af5509ce7 |
children | efc75ea79164 |
line wrap: on
line diff
--- 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; }