summaryrefslogtreecommitdiff
path: root/gr-blocks/lib/wavfile_source_impl.cc
diff options
context:
space:
mode:
authorMarcus Müller <mmueller@gnuradio.org>2020-04-11 01:04:25 +0200
committerMarcus Müller <marcus@hostalia.de>2020-04-13 15:55:41 +0200
commit95178211eb87d6bf40d51210cf501e6e840863fe (patch)
treef5b78778291f977ea20d50947086e108bd5a36b5 /gr-blocks/lib/wavfile_source_impl.cc
parent7a203ad0481aea3820ea60568402b94cff83ab1d (diff)
blocks: replace stderr logging by calls to GR's logging facilties
Diffstat (limited to 'gr-blocks/lib/wavfile_source_impl.cc')
-rw-r--r--gr-blocks/lib/wavfile_source_impl.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/gr-blocks/lib/wavfile_source_impl.cc b/gr-blocks/lib/wavfile_source_impl.cc
index ad1853e1ae..0bd1209757 100644
--- a/gr-blocks/lib/wavfile_source_impl.cc
+++ b/gr-blocks/lib/wavfile_source_impl.cc
@@ -59,13 +59,15 @@ wavfile_source_impl::wavfile_source_impl(const char* filename, bool repeat)
// we use "open" to use to the O_LARGEFILE flag
int fd;
- if ((fd = open(filename, O_RDONLY | OUR_O_LARGEFILE | OUR_O_BINARY)) < 0) {
- perror(filename);
+ if ((fd = ::open(filename, O_RDONLY | OUR_O_LARGEFILE | OUR_O_BINARY)) < 0) {
+ GR_LOG_ERROR(d_logger,
+ boost::format("::open: %s: %s") % filename % strerror(errno));
throw std::runtime_error("can't open file");
}
if ((d_fp = fdopen(fd, "rb")) == NULL) {
- perror(filename);
+ GR_LOG_ERROR(d_logger,
+ boost::format("fdopen: %s: %s") % filename % strerror(errno));
throw std::runtime_error("can't open file");
}
@@ -123,7 +125,8 @@ int wavfile_source_impl::work(int noutput_items,
}
if (fseek(d_fp, d_first_sample_pos, SEEK_SET) == -1) {
- fprintf(stderr, "[%s] fseek failed\n", __FILE__);
+ GR_LOG_ERROR(d_logger,
+ boost::format("fseek failed %s") % strerror(errno));
exit(-1);
}
@@ -145,9 +148,9 @@ int wavfile_source_impl::work(int noutput_items,
// trouble they won't be processed. Serves them bloody right.
if (feof(d_fp) || ferror(d_fp)) {
if (i == 0) {
- fprintf(stderr,
- "[%s] WAV file has corrupted header or i/o error\n",
- __FILE__);
+ GR_LOG_ERROR(d_logger,
+ boost::format("WAV file has corrupted header or i/o error") %
+ strerror(errno));
return -1;
}
return i;