mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-05 10:40:42 +00:00
Add error checks to edf header values
This commit is contained in:
parent
ec3243c013
commit
23d177b31c
@ -134,7 +134,7 @@ bool EDFInfo::parseHeader( EDFHeaderRaw *hdrPtr )
|
|||||||
}
|
}
|
||||||
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) || (edfHdr.num_data_records < 1) ) {
|
||||||
qWarning() << "EDFInfo::Parse() Bad data record count " << filename;
|
qWarning() << "EDFInfo::Parse() Bad data record count " << filename;
|
||||||
// sleep(1);
|
// sleep(1);
|
||||||
fileData.clear();
|
fileData.clear();
|
||||||
@ -148,7 +148,7 @@ bool EDFInfo::parseHeader( EDFHeaderRaw *hdrPtr )
|
|||||||
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) || (edfHdr.num_signals < 1) || (edfHdr.num_signals > 256) ) {
|
||||||
qWarning() << "EDFInfo::Parse() Bad number of signals " << filename;
|
qWarning() << "EDFInfo::Parse() Bad number of signals " << filename;
|
||||||
// sleep(1);
|
// sleep(1);
|
||||||
fileData.clear();
|
fileData.clear();
|
||||||
|
Loading…
Reference in New Issue
Block a user