mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 18:50:44 +00:00
Clean up EDFInfo class to avoid memory leaks
This commit is contained in:
parent
0fd25f2f4e
commit
6624738f67
@ -32,13 +32,17 @@ EDFInfo::EDFInfo()
|
|||||||
datasize = 0;
|
datasize = 0;
|
||||||
signalPtr = nullptr;
|
signalPtr = nullptr;
|
||||||
hdrPtr = nullptr;
|
hdrPtr = nullptr;
|
||||||
fileData = nullptr;
|
// fileData = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
EDFInfo::~EDFInfo()
|
EDFInfo::~EDFInfo()
|
||||||
{
|
{
|
||||||
// if ( fileData )
|
// if ( fileData ) {
|
||||||
// delete fileData;
|
if (fileData.size() > 0) {
|
||||||
|
qDebug() << "EDFInfo destructor clearing fileData";
|
||||||
|
fileData.clear();
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
for (auto & s : edfsignals) {
|
for (auto & s : edfsignals) {
|
||||||
if (s.dataArray)
|
if (s.dataArray)
|
||||||
@ -48,34 +52,35 @@ EDFInfo::~EDFInfo()
|
|||||||
// delete a;
|
// delete a;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray * EDFInfo::Open(const QString & name)
|
bool EDFInfo::Open(const QString & name)
|
||||||
{
|
{
|
||||||
if (hdrPtr != nullptr) {
|
if (hdrPtr != nullptr) {
|
||||||
qWarning() << "EDFInfo::Open() called with file already open " << name;
|
qWarning() << "EDFInfo::Open() called with file already open " << name;
|
||||||
sleep(1);
|
sleep(1);
|
||||||
return nullptr;
|
return false;
|
||||||
}
|
}
|
||||||
QFile fi(name);
|
QFile fi(name);
|
||||||
if (!fi.open(QFile::ReadOnly)) {
|
if (!fi.open(QFile::ReadOnly)) {
|
||||||
qDebug() << "EDFInfo::Open() Couldn't open file " << name;
|
qDebug() << "EDFInfo::Open() Couldn't open file " << name;
|
||||||
sleep(1);
|
sleep(1);
|
||||||
return nullptr;
|
return false;
|
||||||
}
|
}
|
||||||
fileData = new QByteArray();
|
// fileData = new QByteArray();
|
||||||
if (name.endsWith(STR_ext_gz)) {
|
if (name.endsWith(STR_ext_gz)) {
|
||||||
*fileData = gUncompress(fi.readAll()); // Open and decompress file
|
fileData = gUncompress(fi.readAll()); // Open and decompress file
|
||||||
} else {
|
} else {
|
||||||
*fileData = fi.readAll(); // Open and read uncompressed file
|
fileData = fi.readAll(); // Open and read uncompressed file
|
||||||
}
|
}
|
||||||
fi.close();
|
fi.close();
|
||||||
if (fileData->size() <= EDFHeaderSize) {
|
if (fileData.size() <= EDFHeaderSize) {
|
||||||
fileData->clear();;
|
fileData.clear();;
|
||||||
qDebug() << "EDFInfo::Open() File too short " << name;
|
qDebug() << "EDFInfo::Open() File too short " << name;
|
||||||
sleep(1);
|
sleep(1);
|
||||||
return nullptr;
|
return false;
|
||||||
}
|
}
|
||||||
filename = name;
|
filename = name;
|
||||||
return fileData;
|
// return fileData;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EDFInfo::parseHeader( EDFHeaderRaw *hdrPtr )
|
bool EDFInfo::parseHeader( EDFHeaderRaw *hdrPtr )
|
||||||
@ -85,8 +90,8 @@ bool EDFInfo::parseHeader( EDFHeaderRaw *hdrPtr )
|
|||||||
edfHdr.version = QString::fromLatin1(hdrPtr->version, 8).toLong(&ok);
|
edfHdr.version = QString::fromLatin1(hdrPtr->version, 8).toLong(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
qWarning() << "EDFInfo::Parse() Bad Version " << filename;
|
qWarning() << "EDFInfo::Parse() Bad Version " << filename;
|
||||||
sleep(1);
|
// sleep(1);
|
||||||
fileData->clear();
|
fileData.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,48 +109,47 @@ bool EDFInfo::parseHeader( EDFHeaderRaw *hdrPtr )
|
|||||||
edfHdr.num_header_bytes = QString::fromLatin1(hdrPtr->num_header_bytes, 8).toLong(&ok);
|
edfHdr.num_header_bytes = QString::fromLatin1(hdrPtr->num_header_bytes, 8).toLong(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
qWarning() << "EDFInfo::Parse() Bad header byte count " << filename;
|
qWarning() << "EDFInfo::Parse() Bad header byte count " << filename;
|
||||||
sleep(1);
|
// sleep(1);
|
||||||
fileData->clear();
|
fileData.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
edfHdr.reserved44=QString::fromLatin1(hdrPtr->reserved, 44).trimmed();
|
edfHdr.reserved44=QString::fromLatin1(hdrPtr->reserved, 44).trimmed();
|
||||||
edfHdr.num_data_records = QString::fromLatin1(hdrPtr->num_data_records, 8).toLong(&ok);
|
edfHdr.num_data_records = QString::fromLatin1(hdrPtr->num_data_records, 8).toLong(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
qWarning() << "EDFInfo::Parse() Bad data record count " << filename;
|
qWarning() << "EDFInfo::Parse() Bad data record count " << filename;
|
||||||
sleep(1);
|
// sleep(1);
|
||||||
fileData->clear();
|
fileData.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
edfHdr.duration_Seconds = QString::fromLatin1(hdrPtr->dur_data_records, 8).toDouble(&ok);
|
edfHdr.duration_Seconds = QString::fromLatin1(hdrPtr->dur_data_records, 8).toDouble(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
qWarning() << "EDFInfo::Parse() Bad duration " << filename;
|
qWarning() << "EDFInfo::Parse() Bad duration " << filename;
|
||||||
sleep(1);
|
// sleep(1);
|
||||||
fileData->clear();
|
fileData.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
edfHdr.num_signals = QString::fromLatin1(hdrPtr->num_signals, 4).toLong(&ok);
|
edfHdr.num_signals = QString::fromLatin1(hdrPtr->num_signals, 4).toLong(&ok);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
qWarning() << "EDFInfo::Parse() Bad number of signals " << filename;
|
qWarning() << "EDFInfo::Parse() Bad number of signals " << filename;
|
||||||
sleep(1);
|
// sleep(1);
|
||||||
fileData->clear();
|
fileData.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EDFInfo::Parse(QByteArray * fileData )
|
bool EDFInfo::Parse() {
|
||||||
{
|
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
if (fileData == nullptr) {
|
if (fileData.size() == 0) {
|
||||||
qWarning() << "EDFInfo::Parse() called without valid EDF data " << filename;
|
qWarning() << "EDFInfo::Parse() called without valid EDF data " << filename;
|
||||||
sleep(1);
|
// sleep(1);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
hdrPtr = (EDFHeaderRaw *)(*fileData).constData();
|
hdrPtr = (EDFHeaderRaw *)fileData.constData();
|
||||||
signalPtr = (char *)(*fileData).constData() + EDFHeaderSize;
|
signalPtr = (char *)fileData.constData() + EDFHeaderSize;
|
||||||
filesize = (*fileData).size();
|
filesize = fileData.size();
|
||||||
datasize = filesize - EDFHeaderSize;
|
datasize = filesize - EDFHeaderSize;
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
||||||
@ -167,7 +171,7 @@ bool EDFInfo::Parse(QByteArray * fileData )
|
|||||||
if (eof) {
|
if (eof) {
|
||||||
qWarning() << "EDFInfo::Parse() Early end of file " << filename;
|
qWarning() << "EDFInfo::Parse() Early end of file " << filename;
|
||||||
sleep(1);
|
sleep(1);
|
||||||
fileData->clear();
|
fileData.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,8 +208,8 @@ bool EDFInfo::Parse(QByteArray * fileData )
|
|||||||
// could do it earlier, but it won't crash from > EOF Reads
|
// could do it earlier, but it won't crash from > EOF Reads
|
||||||
if (eof) {
|
if (eof) {
|
||||||
qWarning() << "EDFInfo::Parse() Early end of file " << filename;
|
qWarning() << "EDFInfo::Parse() Early end of file " << filename;
|
||||||
sleep(1);
|
// sleep(1);
|
||||||
fileData->clear();
|
fileData.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -220,8 +224,8 @@ bool EDFInfo::Parse(QByteArray * fileData )
|
|||||||
// Space required more than the remainder left to read,
|
// Space required more than the remainder left to read,
|
||||||
// so abort and let the user clean up the corrupted file themselves
|
// so abort and let the user clean up the corrupted file themselves
|
||||||
qWarning() << "EDFInfo::Parse(): " << filename << " is too short!";
|
qWarning() << "EDFInfo::Parse(): " << filename << " is too short!";
|
||||||
sleep(1);
|
// sleep(1);
|
||||||
fileData->clear();
|
fileData.clear();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,7 +252,7 @@ bool EDFInfo::Parse(QByteArray * fileData )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fileData->clear();
|
fileData.clear();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,20 +264,20 @@ EDFHeaderQT * EDFInfo::GetHeader( const QString & name)
|
|||||||
sleep(1);
|
sleep(1);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
fileData = new QByteArray();
|
// fileData = new QByteArray();
|
||||||
if (name.endsWith(STR_ext_gz)) {
|
if (name.endsWith(STR_ext_gz)) {
|
||||||
*fileData = gUncompress(fi.read(sizeof(EDFHeaderRaw))); // Open and decompress file
|
fileData = gUncompress(fi.read(sizeof(EDFHeaderRaw))); // Open and decompress file
|
||||||
} else {
|
} else {
|
||||||
*fileData = fi.read(sizeof(EDFHeaderRaw)); // Open and read uncompressed file
|
fileData = fi.read(sizeof(EDFHeaderRaw)); // Open and read uncompressed file
|
||||||
}
|
}
|
||||||
fi.close();
|
fi.close();
|
||||||
filename = name;
|
filename = name;
|
||||||
hdrPtr = (EDFHeaderRaw *)(*fileData).constData();
|
hdrPtr = (EDFHeaderRaw *)fileData.constData();
|
||||||
|
|
||||||
if ( ! parseHeader( hdrPtr ) )
|
if ( ! parseHeader( hdrPtr ) )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
fileData->clear();
|
fileData.clear();
|
||||||
return & edfHdr;
|
return & edfHdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,9 +120,9 @@ class EDFInfo
|
|||||||
|
|
||||||
virtual ~EDFInfo();
|
virtual ~EDFInfo();
|
||||||
|
|
||||||
virtual QByteArray * Open(const QString & name); //! \brief Open the EDF+ file, and read it's header
|
virtual bool Open(const QString & name); //! \brief Open the EDF+ file, and read it's header
|
||||||
|
|
||||||
virtual bool Parse(QByteArray * fileData); //! \brief Parse the EDF+ file into the EDFheaderQT. Must call Open(..) first.
|
virtual bool Parse(); //! \brief Parse the EDF+ file into the EDFheaderQT. Must call Open(..) first.
|
||||||
|
|
||||||
virtual bool parseHeader( EDFHeaderRaw * hdrPtr ); //! \brief parse just the edf header for duration, etc
|
virtual bool parseHeader( EDFHeaderRaw * hdrPtr ); //! \brief parse just the edf header for duration, etc
|
||||||
|
|
||||||
@ -161,7 +161,7 @@ class EDFInfo
|
|||||||
qint16 Read16(); //! \brief Read 16 bit word of data from the EDF+ data stream
|
qint16 Read16(); //! \brief Read 16 bit word of data from the EDF+ data stream
|
||||||
|
|
||||||
//! \brief This is the array holding the EDF file data
|
//! \brief This is the array holding the EDF file data
|
||||||
QByteArray * fileData;
|
QByteArray fileData;
|
||||||
//! \brief The EDF+ files header structure, used as a place holder while processing the text data.
|
//! \brief The EDF+ files header structure, used as a place holder while processing the text data.
|
||||||
EDFHeaderRaw *hdrPtr;
|
EDFHeaderRaw *hdrPtr;
|
||||||
//! \brief This is the array of signal descriptors and values
|
//! \brief This is the array of signal descriptors and values
|
||||||
|
@ -28,9 +28,9 @@
|
|||||||
ResMedEDFInfo::ResMedEDFInfo() :EDFInfo() { }
|
ResMedEDFInfo::ResMedEDFInfo() :EDFInfo() { }
|
||||||
ResMedEDFInfo::~ResMedEDFInfo() { }
|
ResMedEDFInfo::~ResMedEDFInfo() { }
|
||||||
|
|
||||||
bool ResMedEDFInfo::Parse(QByteArray * fileData ) // overrides and calls the super's Parse
|
bool ResMedEDFInfo::Parse( ) // overrides and calls the super's Parse
|
||||||
{
|
{
|
||||||
EDFInfo::Parse( fileData );
|
EDFInfo::Parse( );
|
||||||
|
|
||||||
// Now massage some stuff into OSCAR's layout
|
// Now massage some stuff into OSCAR's layout
|
||||||
int snp = edfHdr.recordingident.indexOf("SRN=");
|
int snp = edfHdr.recordingident.indexOf("SRN=");
|
||||||
|
@ -29,7 +29,7 @@ public:
|
|||||||
ResMedEDFInfo();
|
ResMedEDFInfo();
|
||||||
~ResMedEDFInfo();
|
~ResMedEDFInfo();
|
||||||
|
|
||||||
virtual bool Parse(QByteArray * fileData) override; // overrides and calls the super's Parse
|
virtual bool Parse() override; // overrides and calls the super's Parse
|
||||||
|
|
||||||
virtual qint64 GetDurationMillis() { return dur_data_record; } // overrides the super
|
virtual qint64 GetDurationMillis() { return dur_data_record; } // overrides the super
|
||||||
|
|
||||||
|
@ -434,8 +434,12 @@ int ResmedLoader::Open(const QString & dirpath)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
ResMedEDFInfo * stredf = new ResMedEDFInfo();
|
ResMedEDFInfo * stredf = new ResMedEDFInfo();
|
||||||
QByteArray * fileData = stredf->Open(fi.canonicalFilePath() );
|
if ( stredf->Open(fi.canonicalFilePath() ) ) {
|
||||||
if (!stredf->Parse(fileData)) {
|
qDebug() << "Failed to open" << filename;
|
||||||
|
delete stredf;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!stredf->Parse()) {
|
||||||
qDebug() << "Faulty STR file" << filename;
|
qDebug() << "Faulty STR file" << filename;
|
||||||
delete stredf;
|
delete stredf;
|
||||||
continue;
|
continue;
|
||||||
@ -1407,8 +1411,11 @@ void BackupSTRfiles( const QString path, const QString strBackupPath, MachineInf
|
|||||||
// Now place any of these files in the Backup folder sorted by the file date
|
// Now place any of these files in the Backup folder sorted by the file date
|
||||||
for (auto & filename : strfiles) {
|
for (auto & filename : strfiles) {
|
||||||
ResMedEDFInfo * stredf = new ResMedEDFInfo();
|
ResMedEDFInfo * stredf = new ResMedEDFInfo();
|
||||||
QByteArray * fileData = stredf->Open(filename);
|
if ( ! stredf->Open(filename) ) {
|
||||||
if ( ! stredf->Parse(fileData)) {
|
qDebug() << "Failed to open" << filename;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( ! stredf->Parse()) {
|
||||||
qDebug() << "Faulty STR file" << filename;
|
qDebug() << "Faulty STR file" << filename;
|
||||||
delete stredf;
|
delete stredf;
|
||||||
continue;
|
continue;
|
||||||
@ -1456,6 +1463,7 @@ void BackupSTRfiles( const QString path, const QString strBackupPath, MachineInf
|
|||||||
QFile::exists(gzfile) && QFile::remove(gzfile);
|
QFile::exists(gzfile) && QFile::remove(gzfile);
|
||||||
|
|
||||||
STRmap[date] = STRFile(backupfile, stredf);
|
STRmap[date] = STRFile(backupfile, stredf);
|
||||||
|
// delete stredf;
|
||||||
} // end for walking the STR files list
|
} // end for walking the STR files list
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2128,15 +2136,21 @@ bool ResmedLoader::LoadCSL(Session *sess, const QString & path)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ResMedEDFInfo edf;
|
ResMedEDFInfo edf;
|
||||||
QByteArray * fileData = edf.Open(path);
|
if ( ! edf.Open(path) ) {
|
||||||
|
qDebug() << "LoadCSL failed to open" << path;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
int edfopentime = time.elapsed();
|
int edfopentime = time.elapsed();
|
||||||
time.start();
|
time.start();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!edf.Parse(fileData))
|
if (!edf.Parse()) {
|
||||||
|
qDebug() << "LoadCSL failed to parse" << path;
|
||||||
|
// fileData->clear();
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
int edfparsetime = time.elapsed();
|
int edfparsetime = time.elapsed();
|
||||||
@ -2183,6 +2197,8 @@ bool ResmedLoader::LoadCSL(Session *sess, const QString & path)
|
|||||||
qDebug() << "Unfinished csr event in " << edf.filename;
|
qDebug() << "Unfinished csr event in " << edf.filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fileData->clear();
|
||||||
|
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
timeMutex.lock();
|
timeMutex.lock();
|
||||||
timeInLoadCSL += time.elapsed();
|
timeInLoadCSL += time.elapsed();
|
||||||
@ -2201,13 +2217,21 @@ bool ResmedLoader::LoadEVE(Session *sess, const QString & path)
|
|||||||
time.start();
|
time.start();
|
||||||
#endif
|
#endif
|
||||||
ResMedEDFInfo edf;
|
ResMedEDFInfo edf;
|
||||||
QByteArray * fileData = edf.Open(path);
|
if ( ! edf.Open(path) ) {
|
||||||
|
qDebug() << "LoadEVE failed to open" << path;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
int edfopentime = time.elapsed();
|
int edfopentime = time.elapsed();
|
||||||
time.start();
|
time.start();
|
||||||
#endif
|
#endif
|
||||||
if (!edf.Parse(fileData))
|
|
||||||
|
if (!edf.Parse()) {
|
||||||
|
qDebug() << "LoadEVE failed to parse" << path;
|
||||||
|
// fileData->clear();
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
int edfparsetime = time.elapsed();
|
int edfparsetime = time.elapsed();
|
||||||
time.start();
|
time.start();
|
||||||
@ -2270,6 +2294,8 @@ bool ResmedLoader::LoadEVE(Session *sess, const QString & path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fileData->clear();
|
||||||
|
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
timeMutex.lock();
|
timeMutex.lock();
|
||||||
timeInLoadEVE += time.elapsed();
|
timeInLoadEVE += time.elapsed();
|
||||||
@ -2288,13 +2314,19 @@ bool ResmedLoader::LoadBRP(Session *sess, const QString & path)
|
|||||||
time.start();
|
time.start();
|
||||||
#endif
|
#endif
|
||||||
ResMedEDFInfo edf;
|
ResMedEDFInfo edf;
|
||||||
QByteArray * fileData = edf.Open(path);
|
if ( ! edf.Open(path) ) {
|
||||||
|
qDebug() << "LoadBRP failed to open" << path;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
int edfopentime = time.elapsed();
|
int edfopentime = time.elapsed();
|
||||||
time.start();
|
time.start();
|
||||||
#endif
|
#endif
|
||||||
if (!edf.Parse(fileData))
|
if (!edf.Parse()) {
|
||||||
|
qDebug() << "LoadBRP failed to parse" << path;
|
||||||
|
// fileData->clear();
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
int edfparsetime = time.elapsed();
|
int edfparsetime = time.elapsed();
|
||||||
time.start();
|
time.start();
|
||||||
@ -2359,6 +2391,8 @@ bool ResmedLoader::LoadBRP(Session *sess, const QString & path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fileData->clear();
|
||||||
|
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
timeMutex.lock();
|
timeMutex.lock();
|
||||||
timeInLoadBRP += time.elapsed();
|
timeInLoadBRP += time.elapsed();
|
||||||
@ -2380,15 +2414,21 @@ bool ResmedLoader::LoadSAD(Session *sess, const QString & path)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
ResMedEDFInfo edf;
|
ResMedEDFInfo edf;
|
||||||
QByteArray * fileData = edf.Open(path);
|
if ( ! edf.Open(path) ) {
|
||||||
|
qDebug() << "LoadSAD failed to open" << path;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
int edfopentime = time.elapsed();
|
int edfopentime = time.elapsed();
|
||||||
time.start();
|
time.start();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!edf.Parse(fileData))
|
if (!edf.Parse()) {
|
||||||
|
qDebug() << "LoadSAD failed to parse" << path;
|
||||||
|
// fileData->clear();
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
int edfparsetime = time.elapsed();
|
int edfparsetime = time.elapsed();
|
||||||
@ -2431,6 +2471,8 @@ bool ResmedLoader::LoadSAD(Session *sess, const QString & path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fileData->clear();
|
||||||
|
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
timeMutex.lock();
|
timeMutex.lock();
|
||||||
timeInLoadSAD += time.elapsed();
|
timeInLoadSAD += time.elapsed();
|
||||||
@ -2449,13 +2491,21 @@ bool ResmedLoader::LoadPLD(Session *sess, const QString & path)
|
|||||||
time.start();
|
time.start();
|
||||||
#endif
|
#endif
|
||||||
ResMedEDFInfo edf;
|
ResMedEDFInfo edf;
|
||||||
QByteArray * fileData = edf.Open(path);
|
if ( ! edf.Open(path) ) {
|
||||||
|
qDebug() << "LoadPLD failed to open" << path;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
int edfopentime = time.elapsed();
|
int edfopentime = time.elapsed();
|
||||||
time.start();
|
time.start();
|
||||||
#endif
|
#endif
|
||||||
if (!edf.Parse(fileData))
|
|
||||||
|
if (!edf.Parse()) {
|
||||||
|
qDebug() << "LoadPLD failed to parse" << path;
|
||||||
|
// fileData->clear();
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
int edfparsetime = time.elapsed();
|
int edfparsetime = time.elapsed();
|
||||||
time.start();
|
time.start();
|
||||||
@ -2596,6 +2646,9 @@ bool ResmedLoader::LoadPLD(Session *sess, const QString & path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// fileData->clear();
|
||||||
|
|
||||||
#ifdef DEBUG_EFFICIENCY
|
#ifdef DEBUG_EFFICIENCY
|
||||||
timeMutex.lock();
|
timeMutex.lock();
|
||||||
timeInLoadPLD += time.elapsed();
|
timeInLoadPLD += time.elapsed();
|
||||||
|
Loading…
Reference in New Issue
Block a user