From d74d4fc1e8a3874e55a43f00198caee569b42593 Mon Sep 17 00:00:00 2001 From: Phil Olynyk Date: Sun, 22 Sep 2019 17:22:48 -0400 Subject: [PATCH] fix dumpStr faults --- dumpSTR/edfparser.cpp | 2 +- dumpSTR/main.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dumpSTR/edfparser.cpp b/dumpSTR/edfparser.cpp index 687b3a42..ad62946f 100644 --- a/dumpSTR/edfparser.cpp +++ b/dumpSTR/edfparser.cpp @@ -59,7 +59,7 @@ QByteArray * EDFInfo::Open(const QString & name) // } fi.close(); if (fileData->size() <= EDFHeaderSize) { - delete fileData; + fileData->clear(); qDebug() << "EDFInfo::Open() File too short " << name; sleep(1); return nullptr; diff --git a/dumpSTR/main.cpp b/dumpSTR/main.cpp index d5b86b8e..c8024de6 100644 --- a/dumpSTR/main.cpp +++ b/dumpSTR/main.cpp @@ -121,6 +121,10 @@ int main(int argc, char *argv[]) { if (lastSig == 0 ) lastSig = str.GetNumSignals(); + if (((first > 0)&&(last == 0)) || last > size) + last = size; + + date = date.addDays(first); // For each data record, representing 1 day each for (int rec = first; rec < last+1; ++rec, date = date.addDays(1)) { qDebug() << "Record no. " << rec << " Date: " << date.toString() ; @@ -155,8 +159,8 @@ int main(int argc, char *argv[]) { } } } - qDebug() << "Deleting the edf object"; - delete &str; +// qDebug() << "Deleting the edf object"; +// delete &str; QThread::sleep(1); qDebug() << "Done"; }