From 063279d601f0aeddf5827ae103fbf4c755947870 Mon Sep 17 00:00:00 2001 From: Philpax Date: Sat, 11 Jul 2015 15:51:36 +1000 Subject: [PATCH] Fixed #14 - replaced use of string exceptions with runtime_error --- inputsource.cpp | 6 +++--- main.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/inputsource.cpp b/inputsource.cpp index a1538f9..9c5b3d8 100644 --- a/inputsource.cpp +++ b/inputsource.cpp @@ -13,16 +13,16 @@ InputSource::InputSource(const char *filename, int fft_size) { m_file = fopen(filename, "rb"); if (m_file == nullptr) - throw "Error opening file"; + throw std::runtime_error("Error opening file"); struct stat sb; if (fstat(fileno(m_file), &sb) != 0) - throw "Error fstating file"; + throw std::runtime_error("Error fstating file"); m_file_size = sb.st_size; m_data = (fftwf_complex*)mmap(NULL, m_file_size, PROT_READ, MAP_SHARED, fileno(m_file), 0); if (m_data == 0) - throw "Error mmapping file"; + throw std::runtime_error("Error mmapping file"); m_fftw_in = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * m_fft_size); m_fftw_out = (fftwf_complex*)fftwf_malloc(sizeof(fftwf_complex) * m_fft_size); diff --git a/main.cpp b/main.cpp index 12c50ea..3bc652f 100644 --- a/main.cpp +++ b/main.cpp @@ -53,8 +53,8 @@ bool MyApp::OnInit() try { m_input_source = new InputSource(argv[1], fft_size); - } catch (const char *msg) { - printf("%s\n", msg); + } catch (std::exception const& msg) { + printf("%s\n", msg.what()); return false; }