From bad3b840f0408d18082de5fca8ae5804a751a30d Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Mon, 15 Apr 2013 21:16:52 -0400 Subject: blocks: fix file meta data source to handle repeat of files. --- gr-blocks/lib/file_meta_source_impl.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'gr-blocks/lib') diff --git a/gr-blocks/lib/file_meta_source_impl.cc b/gr-blocks/lib/file_meta_source_impl.cc index 42fdabb54..316f5e7d1 100644 --- a/gr-blocks/lib/file_meta_source_impl.cc +++ b/gr-blocks/lib/file_meta_source_impl.cc @@ -376,7 +376,15 @@ namespace gr { parse_extras(extras, nitems_written(0), d_tags); } else { - return -1; + if(!d_repeat) + return -1; + else { + if(fseek(d_fp, 0, SEEK_SET) == -1) { + std::stringstream s; + s << "[" << __FILE__ << "]" << " fseek failed" << std::endl; + throw std::runtime_error(s.str()); + } + } } } @@ -404,7 +412,7 @@ namespace gr { out += i * d_itemsize; if(size == 0) // done - break; + break; if(i > 0) // short read, try again continue; @@ -424,7 +432,7 @@ namespace gr { } if(size > 0) { // EOF or error - if(size == seg_size) // we didn't read anything; say we're done + if(size == seg_size) // we didn't read anything; say we're done return -1; return seg_size - size; // else return partial result } -- cgit