summaryrefslogtreecommitdiff
path: root/gr-blocks/lib/wavfile.cc
diff options
context:
space:
mode:
authorMartin Braun <martin.braun@kit.edu>2013-10-06 17:06:49 -0400
committerJohnathan Corgan <johnathan@corganlabs.com>2013-10-09 14:46:03 -0700
commitca32bc0c5ffe1c7a2f8b0896e3f72249ebebcb2f (patch)
treebe22635118d978e858200a9ed29854bae4342733 /gr-blocks/lib/wavfile.cc
parent62c363f5b6aec82c1dda132d12e91c53a64151d2 (diff)
blocks: Fix CID 1088839, 1046407 and 1046395
Diffstat (limited to 'gr-blocks/lib/wavfile.cc')
-rw-r--r--gr-blocks/lib/wavfile.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/gr-blocks/lib/wavfile.cc b/gr-blocks/lib/wavfile.cc
index 1a5b3ff35f..0a4336f443 100644
--- a/gr-blocks/lib/wavfile.cc
+++ b/gr-blocks/lib/wavfile.cc
@@ -133,7 +133,9 @@ namespace gr {
fmt_hdr_skip -= 16;
if(fmt_hdr_skip) {
- fseek(fp, fmt_hdr_skip, SEEK_CUR);
+ if (fseek(fp, fmt_hdr_skip, SEEK_CUR) != 0) {
+ return false;
+ }
}
// data chunk
@@ -165,7 +167,7 @@ namespace gr {
{
int16_t buf_16bit;
- if(!fread(&buf_16bit, bytes_per_sample, 1, fp)) {
+ if(fread(&buf_16bit, bytes_per_sample, 1, fp) != 1) {
return 0;
}
if(bytes_per_sample == 1) {
@@ -238,12 +240,16 @@ namespace gr {
uint32_t chunk_size = (uint32_t)byte_count;
chunk_size = host_to_wav(chunk_size);
- fseek(fp, 40, SEEK_SET);
+ if (fseek(fp, 40, SEEK_SET) != 0) {
+ return false;
+ }
fwrite(&chunk_size, 1, 4, fp);
chunk_size = (uint32_t)byte_count + 36; // fmt chunk and data header
chunk_size = host_to_wav(chunk_size);
- fseek(fp, 4, SEEK_SET);
+ if (fseek(fp, 4, SEEK_SET) != 0) {
+ return false;
+ }
fwrite(&chunk_size, 1, 4, fp);