diff -Nru edflib-1.20/debian/changelog edflib-1.21/debian/changelog --- edflib-1.20/debian/changelog 2021-11-09 18:40:18.000000000 +0000 +++ edflib-1.21/debian/changelog 2022-02-19 20:06:16.000000000 +0000 @@ -1,3 +1,9 @@ +edflib (1.21-1) unstable; urgency=medium + + * New upstream version + + -- Andreas Tille Sat, 19 Feb 2022 21:06:16 +0100 + edflib (1.20-1) unstable; urgency=medium [ Andreas Tille ] diff -Nru edflib-1.20/edflib.c edflib-1.21/edflib.c --- edflib-1.20/edflib.c 2021-10-30 13:38:05.000000000 +0000 +++ edflib-1.21/edflib.c 2022-01-13 18:04:48.000000000 +0000 @@ -1,7 +1,7 @@ /* ***************************************************************************** * -* Copyright (c) 2009 - 2021 Teunis van Beelen +* Copyright (c) 2009 - 2022 Teunis van Beelen * All rights reserved. * * Email: teuniz@protonmail.com @@ -35,7 +35,7 @@ #include "edflib.h" -#define EDFLIB_VERSION (120) +#define EDFLIB_VERSION (121) #define EDFLIB_MAXFILES (64) #if defined(__APPLE__) || defined(__MACH__) || defined(__APPLE_CC__) || defined(__HAIKU__) @@ -2341,7 +2341,7 @@ } p = 0; - if(edfhdr->patient[p]=='X') + if((edfhdr->patient[p]=='X') && (edfhdr->patient[p+1]==' ')) { edfhdr->plus_patientcode[0] = 0; p += 2; @@ -2550,7 +2550,7 @@ edfhdr->plus_startdate[11] = 0; p += i + 1; - if(edfhdr->recording[p]=='X') + if((edfhdr->recording[p]=='X') && (edfhdr->recording[p+1]==' ')) { edfhdr->plus_admincode[0] = 0; p += 2; @@ -2570,7 +2570,7 @@ p += i + 1; } - if(edfhdr->recording[p]=='X') + if((edfhdr->recording[p]=='X') && (edfhdr->recording[p+1]==' ')) { edfhdr->plus_technician[0] = 0; p += 2; @@ -2590,7 +2590,7 @@ p += i + 1; } - if(edfhdr->recording[p]=='X') + if((edfhdr->recording[p]=='X') && (edfhdr->recording[p+1]==' ')) { edfhdr->plus_equipment[0] = 0; p += 2; diff -Nru edflib-1.20/edflib.h edflib-1.21/edflib.h --- edflib-1.20/edflib.h 2021-10-30 08:22:43.000000000 +0000 +++ edflib-1.21/edflib.h 2022-01-13 18:04:48.000000000 +0000 @@ -1,7 +1,7 @@ /* ***************************************************************************** * -* Copyright (c) 2009 - 2021 Teunis van Beelen +* Copyright (c) 2009 - 2022 Teunis van Beelen * All rights reserved. * * Email: teuniz@protonmail.com diff -Nru edflib-1.20/unittest/unittest.c edflib-1.21/unittest/unittest.c --- edflib-1.20/unittest/unittest.c 2021-10-31 07:52:20.000000000 +0000 +++ edflib-1.21/unittest/unittest.c 2022-01-13 18:04:48.000000000 +0000 @@ -78,7 +78,7 @@ setlocale(LC_ALL, "C"); - if(edflib_version() != 120) JUMP_TO_EXIT_ERROR_PROC + if(edflib_version() != 121) JUMP_TO_EXIT_ERROR_PROC ibuf = (int *)malloc(100 * sizeof(int)); if(ibuf == NULL) @@ -167,6 +167,101 @@ if(strcmp(hdr.signalparam[0].physdimension, "uV ")) JUMP_TO_EXIT_ERROR_PROC + if(strcmp(hdr.patientcode, "")) JUMP_TO_EXIT_ERROR_PROC + + if(strcmp(hdr.patient_name, "X")) JUMP_TO_EXIT_ERROR_PROC + + if(strcmp(hdr.admincode, "")) JUMP_TO_EXIT_ERROR_PROC + + if(strcmp(hdr.technician, "")) JUMP_TO_EXIT_ERROR_PROC + + if(strcmp(hdr.equipment, "")) JUMP_TO_EXIT_ERROR_PROC + + if(edfclose_file(hdl)) + { + hdl = -1; + + JUMP_TO_EXIT_ERROR_PROC + } + + hdl = -1; + +/********************************** EDF writing ******************************/ + + hdl = edfopen_file_writeonly_with_params("test.edf", EDFLIB_FILETYPE_EDFPLUS, 65, 633, 3000, "uV"); + + if(hdl < 0) JUMP_TO_EXIT_ERROR_PROC + + if(edf_set_patientname(hdl, "XY_Z")) JUMP_TO_EXIT_ERROR_PROC + + if(edf_set_patientcode(hdl, "X2_3")) JUMP_TO_EXIT_ERROR_PROC + + if(edf_set_admincode(hdl, "X6_7")) JUMP_TO_EXIT_ERROR_PROC + + if(edf_set_technician(hdl, "X.Fo_o")) JUMP_TO_EXIT_ERROR_PROC + + if(edf_set_equipment(hdl, "Xe_q")) JUMP_TO_EXIT_ERROR_PROC + + for(i=0; i<633; i++) + { + dbuf[i] = i; + } + + for(i=0; i<10; i++) + { + for(j=0; j<65; j++) + { + if(edfwrite_physical_samples(hdl, dbuf)) JUMP_TO_EXIT_ERROR_PROC + } + } + + if(edfclose_file(hdl)) + { + hdl = -1; + + JUMP_TO_EXIT_ERROR_PROC + } + +/********************************** EDF reading ******************************/ + + if(edfopen_file_readonly("test.edf", &hdr, EDFLIB_READ_ALL_ANNOTATIONS)) JUMP_TO_EXIT_ERROR_PROC + + hdl = hdr.handle; + + if(hdr.filetype != 1) JUMP_TO_EXIT_ERROR_PROC + + if(hdr.edfsignals != 65) JUMP_TO_EXIT_ERROR_PROC + + if(hdr.file_duration != 100000000) JUMP_TO_EXIT_ERROR_PROC + + if(hdr.datarecord_duration != 10000000) JUMP_TO_EXIT_ERROR_PROC + + if(hdr.datarecords_in_file != 10) JUMP_TO_EXIT_ERROR_PROC + + if(hdr.signalparam[0].smp_in_file != 6330) JUMP_TO_EXIT_ERROR_PROC + + if(hdr.signalparam[0].phys_max != 3000) JUMP_TO_EXIT_ERROR_PROC + + if(hdr.signalparam[0].phys_min != -3000) JUMP_TO_EXIT_ERROR_PROC + + if(hdr.signalparam[0].dig_max != 32767) JUMP_TO_EXIT_ERROR_PROC + + if(hdr.signalparam[0].dig_min != -32768) JUMP_TO_EXIT_ERROR_PROC + + if(hdr.signalparam[0].smp_in_datarecord != 633) JUMP_TO_EXIT_ERROR_PROC + + if(strcmp(hdr.signalparam[0].physdimension, "uV ")) JUMP_TO_EXIT_ERROR_PROC + + if(strcmp(hdr.patientcode, "X2 3")) JUMP_TO_EXIT_ERROR_PROC + + if(strcmp(hdr.patient_name, "XY Z")) JUMP_TO_EXIT_ERROR_PROC + + if(strcmp(hdr.admincode, "X6 7")) JUMP_TO_EXIT_ERROR_PROC + + if(strcmp(hdr.technician, "X.Fo o")) JUMP_TO_EXIT_ERROR_PROC + + if(strcmp(hdr.equipment, "Xe q")) JUMP_TO_EXIT_ERROR_PROC + if(edfclose_file(hdl)) { hdl = -1;