diff --git a/oscar/SleepLib/calcs.cpp b/oscar/SleepLib/calcs.cpp index f234a09d..048fb532 100644 --- a/oscar/SleepLib/calcs.cpp +++ b/oscar/SleepLib/calcs.cpp @@ -204,7 +204,7 @@ FlowParser::FlowParser() m_startsUpper = true; // Allocate filter chain buffers.. - m_filtered = (EventDataType *) malloc(max_filter_buf_size); + m_filtered = (EventDataType *) malloc(max_filter_buf_size_malloc); } FlowParser::~FlowParser() { @@ -228,7 +228,7 @@ EventDataType *FlowParser::applyFilters(EventDataType *data, int samples) } for (int i = 0; i < num_filter_buffers; i++) { - m_buffers[i] = (EventDataType *) malloc(max_filter_buf_size); + m_buffers[i] = (EventDataType *) malloc(max_filter_buf_size_malloc); } int numfilt = m_filters.size(); @@ -287,9 +287,9 @@ void FlowParser::openFlow(Session *session, EventList *flow) EventStoreType *inraw = flow->rawData(); // Make sure we won't overflow internal buffers - if (m_samples > max_filter_buf_size) { - qDebug() << "Error: Sample size exceeds max_filter_buf_size in FlowParser::openFlow().. Capping!!!"; - m_samples = max_filter_buf_size; + if (m_samples > max_filter_buf_size_entries) { + qDebug() << "Error: Sample size exceeds max_filter_buf_size_entries in FlowParser::openFlow().. Capping!!!"; + m_samples = max_filter_buf_size_entries; } // Begin with the second internal buffer diff --git a/oscar/SleepLib/calcs.h b/oscar/SleepLib/calcs.h index 250aaf81..574c52b3 100644 --- a/oscar/SleepLib/calcs.h +++ b/oscar/SleepLib/calcs.h @@ -87,7 +87,8 @@ bool operator<(const BreathPeak &p1, const BreathPeak &p2); const int num_filter_buffers = 2; -const int max_filter_buf_size = 2097152 * sizeof(EventDataType); +const int max_filter_buf_size_entries = 2097152 ; +const int max_filter_buf_size_malloc = max_filter_buf_size_entries * sizeof(EventDataType); //! \brief Class to process Flow Rate waveform data class FlowParser