From 002fbd33e1cd7d5b46beaba05e5c1cbb6da1c65f Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Thu, 5 Jan 2012 14:57:51 +1000 Subject: [PATCH] Forgot to make CRC & Filesize check only if event file version >= 9 --- SleepLib/session.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/SleepLib/session.cpp b/SleepLib/session.cpp index 0395391b..234ebce3 100644 --- a/SleepLib/session.cpp +++ b/SleepLib/session.cpp @@ -514,14 +514,16 @@ bool Session::LoadEvents(QString filename) databytes=temp; } - if (databytes.size()!=datasize) { - qDebug() << "File" << filename << "has returned wrong datasize"; - return false; - } - quint16 crc=qChecksum(databytes.data(),databytes.size()); - if (crc!=crc16) { - qDebug() << "CRC Doesn't match in" << filename; - return false; + if (version>=9) { + if (databytes.size()!=datasize) { + qDebug() << "File" << filename << "has returned wrong datasize"; + return false; + } + quint16 crc=qChecksum(databytes.data(),databytes.size()); + if (crc!=crc16) { + qDebug() << "CRC Doesn't match in" << filename; + return false; + } } QDataStream in(databytes);