Fixed #14 - replaced use of string exceptions with runtime_error

This commit is contained in:
Philpax
2015-07-11 15:51:36 +10:00
parent dc41a1394f
commit 063279d601
2 changed files with 5 additions and 5 deletions

View File

@@ -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);