From 9eb650cd1eb2673306510d26726cf06a16be6bc8 Mon Sep 17 00:00:00 2001 From: oparviai Date: Sun, 25 Jan 2009 16:30:53 +0000 Subject: [PATCH] Eliminate compiler warning --- source/SoundStretch/WavFile.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/source/SoundStretch/WavFile.cpp b/source/SoundStretch/WavFile.cpp index b84afec..98a45e4 100644 --- a/source/SoundStretch/WavFile.cpp +++ b/source/SoundStretch/WavFile.cpp @@ -630,6 +630,7 @@ void WavOutFile::finishHeader() void WavOutFile::writeHeader() { WavHeader hdrTemp; + int res; // swap byte order if necessary hdrTemp = header; @@ -645,7 +646,12 @@ void WavOutFile::writeHeader() // write the supplemented header in the beginning of the file fseek(fptr, 0, SEEK_SET); - fwrite(&hdrTemp, sizeof(hdrTemp), 1, fptr); + res = fwrite(&hdrTemp, sizeof(hdrTemp), 1, fptr); + if (res != 1) + { + throw runtime_error("Error while writing to a wav file."); + } + // jump back to the end of the file fseek(fptr, 0, SEEK_END); }