From a0f43f1b3d4ebfb9eb611dc11c6f27f3b0d95fa1 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Wed, 14 May 2014 07:30:06 +1000 Subject: [PATCH] Little endian test glitch screwing up ResMed MaskPressure graph --- sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp b/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp index 36a7d673..bcb00e89 100644 --- a/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp +++ b/sleepyhead/SleepLib/loader_plugins/resmed_loader.cpp @@ -135,12 +135,12 @@ qint16 EDFParser::Read16() return 0; } -#ifdef LITTLE_ENDIAN +#ifdef Q_LITTLE_ENDIAN // Intel, etc... qint16 res = *(qint16 *)&buffer[pos]; #else // ARM, PPC, etc.. - qint16 res = buffer[pos] | (buffer[pos+1] << 8); + qint16 res = quint8(buffer[pos]) | (qint8(buffer[pos+1]) << 8); #endif pos += 2; @@ -292,10 +292,13 @@ bool EDFParser::Parse() sig.pos = 0; } + if (num_signals == 2) { + int i=5; + } for (int x = 0; x < num_data_records; x++) { for (int i = 0; i < num_signals; i++) { EDFSignal &sig = edfsignals[i]; -#if LITTLE_ENDIAN +#ifdef Q_LITTLE_ENDIAN // Intel x86, etc.. memcpy((char *)&sig.data[sig.pos], (char *)&buffer[pos], sig.nr * 2); sig.pos += sig.nr;