[med-svn] [Git][med-team/edflib][master] 15 commits: Add myself to uploaders

Nilesh Patra gitlab at salsa.debian.org
Mon Jan 4 19:37:18 GMT 2021



Nilesh Patra pushed to branch master at Debian Med / edflib


Commits:
2ee59fd8 by Nilesh Patra at 2021-01-04T23:17:22+05:30
Add myself to uploaders

- - - - -
534cabbc by Nilesh Patra at 2021-01-04T23:17:52+05:30
New upstream version 1.19
- - - - -
a75bcc85 by Nilesh Patra at 2021-01-04T23:17:52+05:30
routine-update: New upstream version

- - - - -
e4062e0a by Nilesh Patra at 2021-01-04T23:17:53+05:30
Update upstream source from tag 'upstream/1.19'

Update to upstream version '1.19'
with Debian dir 6deb9c47af3b08e9da1205c23e07ee94f42aa58e
- - - - -
b3ca2434 by Nilesh Patra at 2021-01-04T23:17:53+05:30
routine-update: Standards-Version: 4.5.1

- - - - -
29cb2dc0 by Nilesh Patra at 2021-01-04T23:35:19+05:30
Remove unittests from debian dir since they are vendoered in the project tree now

- - - - -
44a5f34e by Nilesh Patra at 2021-01-04T23:55:14+05:30
Bump MINVERSION according to new upstream release

- - - - -
e5e27888 by Nilesh Patra at 2021-01-04T23:57:41+05:30
Fix unittest and national encoding

- - - - -
f7e10bc8 by Nilesh Patra at 2021-01-04T19:13:35+00:00
Enable static lib generation (for d-shlibs)

- - - - -
5bb7931f by Nilesh Patra at 2021-01-04T19:13:57+00:00
Enable d-shlibs

- - - - -
5d948ad2 by Nilesh Patra at 2021-01-05T00:54:09+05:30
d/u/metadata

- - - - -
af8915ab by Nilesh Patra at 2021-01-05T00:54:46+05:30
d/copyright: s/http/https/

- - - - -
e04c8c97 by Nilesh Patra at 2021-01-05T01:03:06+05:30
Change package section to science and libedf1 section to libs

- - - - -
9bf03739 by Nilesh Patra at 2021-01-05T01:05:35+05:30
Minor fix

- - - - -
2c7209c1 by Nilesh Patra at 2021-01-05T01:06:28+05:30
Update changelog

- - - - -


21 changed files:

- debian/changelog
- debian/control
- debian/copyright
- debian/libedf-dev.examples
- debian/patches/addcmake.patch
- + debian/patches/enable-static-lib-generation.patch
- + debian/patches/fix-unittest.patch
- debian/patches/series
- debian/rules
- − debian/tests/Makefile
- + debian/upstream/metadata
- edflib.c
- edflib.h
- sine_generator.c
- sweep_generator.c
- test_edflib.c
- test_generator.c
- debian/unittest/LICENSE → unittest/LICENSE
- debian/unittest/Makefile → unittest/Makefile
- debian/unittest/README → unittest/README
- debian/unittest/unittest.c → unittest/unittest.c


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,21 @@
+edflib (1.19-1) unstable; urgency=medium
+
+  * New upstream version
+  * Standards-Version: 4.5.1 (routine-update)
+  * Remove unittests from debian dir since
+    they are vendoered in the project tree now
+  * Bump MINVERSION to 19
+    (according to new upstream release)
+  * Fix unittest and national encoding
+  * Enable static lib generation (for d-shlibs)
+  * Enable d-shlibs
+  * Add d/u/metadata
+  * d/copyright: s/http/https/
+  * Change package section to science
+    and libedf1 section to libs
+
+ -- Nilesh Patra <npatra974 at gmail.com>  Tue, 05 Jan 2021 00:45:46 +0530
+
 edflib (1.18-1) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/control
=====================================
@@ -1,11 +1,12 @@
 Source: edflib
 Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
-Uploaders: Andreas Tille <tille at debian.org>
-Section: libs
+Uploaders: Andreas Tille <tille at debian.org>, Nilesh Patra <npatra974 at gmail.com>
+Section: science
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
-               cmake
-Standards-Version: 4.5.0
+               cmake,
+               d-shlibs
+Standards-Version: 4.5.1
 Vcs-Browser: https://salsa.debian.org/med-team/edflib
 Vcs-Git: https://salsa.debian.org/med-team/edflib.git
 Homepage: https://www.teuniz.net/edflib/
@@ -14,6 +15,7 @@ Rules-Requires-Root: no
 Package: libedf1
 Architecture: any
 Multi-Arch: same
+Section: libs
 Depends: ${misc:Depends},
          ${shlibs:Depends}
 Pre-Depends: ${misc:Pre-Depends}


=====================================
debian/copyright
=====================================
@@ -1,7 +1,7 @@
 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Upstream-Name: edflib
 Upstream-Contact: Teunis van Beelen <teuniz at gmail.com>
-Source: http://www.teuniz.net/edflib/
+Source: https://www.teuniz.net/edflib/
 
 Files: *
 Copyright: 2009-2017 Teunis van Beelen


=====================================
debian/libedf-dev.examples
=====================================
@@ -1,2 +1,2 @@
-debian/unittest/unittest.c
-debian/tests/Makefile
+unittest/Makefile
+unittest/unittest.c


=====================================
debian/patches/addcmake.patch
=====================================
@@ -14,7 +14,7 @@ Author: Mathieu Malaterre <malat at debian.org>
 +add_library(edf SHARED edflib.c)
 +
 +set(VERSION_MAJOR 1)
-+set(VERSION_MINOR 12)
++set(VERSION_MINOR 19)
 +set(VERSION_FULL "${VERSION_MAJOR}.${VERSION_MINOR}")
 +
 +set(API_VERSION "${VERSION_MAJOR}")


=====================================
debian/patches/enable-static-lib-generation.patch
=====================================
@@ -0,0 +1,36 @@
+Description: Also vendor static lib with an ulterior motive of making d-shlibs work
+Author: Nilesh Patra <npatra974 at gmail.com>
+Forwarded: not-needed
+Last-Update: 2021-01-05
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -6,6 +6,7 @@
+ -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE
+ )
+ add_library(edf SHARED edflib.c)
++add_library(edf_static STATIC edflib.c)
+ 
+ set(VERSION_MAJOR 1)
+ set(VERSION_MINOR 19)
+@@ -20,6 +21,11 @@
+   PROPERTIES
+   ${LIBRARY_PROPERTIES}
+   )
++set_target_properties(edf_static
++  PROPERTIES
++  ${LIBRARY_PROPERTIES}
++  OUTPUT_NAME "edf"
++  )
+ 
+ include(CheckSymbolExists)
+ set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
+@@ -36,6 +42,9 @@
+ install(TARGETS edf
+   LIBRARY DESTINATION ${EDFLIB_INSTALL_PATH}
+   )
++install(TARGETS edf_static
++  LIBRARY DESTINATION ${EDFLIB_INSTALL_PATH}
++  )
+ 
+ #
+ add_executable(test_edflib test_edflib.c)


=====================================
debian/patches/fix-unittest.patch
=====================================
@@ -0,0 +1,60 @@
+Description: Fix tests Makefile to pass during autopkgtests
+Also removed national encoding
+Author: Nilesh Patra <npatra974 at gmail.com>
+Forwarded: not-needed
+Last-Update: 2021-01-04
+--- a/unittest/Makefile
++++ b/unittest/Makefile
+@@ -11,18 +11,17 @@
+ 
+ all: edflib_test
+ 
+-edflib_test : edflib.o unittest.o
+-	$(CC) unittest.o edflib.o -o edflib_test
+ 
+-unittest.o : unittest.c ../edflib.h ../edflib.c
+-	$(CC) $(CFLAGS) -c unittest.c -o unittest.o
++edflib_test : unittest.o
++	$(CC) unittest.o -o edflib_test -ledf
+ 
+-edflib.o : ../edflib.h ../edflib.c
+-	$(CC) $(CFLAGS) -c ../edflib.c -o edflib.o
++unittest.o : unittest.c
++	$(CC) $(CFLAGS) -c unittest.c -o unittest.o
+ 
+ clean :
+ 	$(RM) *.o edflib_test *.[be]df
+ 
++
+ #
+ #
+ #
+--- a/unittest/unittest.c
++++ b/unittest/unittest.c
+@@ -3053,9 +3053,9 @@
+ 
+   if(edf_set_startdatetime(hdl, 2008, 12, 31, 23, 59, 58))  JUMP_TO_EXIT_ERROR_PROC
+ 
+-  if(edf_set_patientname(hdl, "lpha"))  JUMP_TO_EXIT_ERROR_PROC
++  if(edf_set_patientname(hdl, "Alpha"))  JUMP_TO_EXIT_ERROR_PROC
+ 
+-  if(edf_set_patientcode(hdl, "Brv"))  JUMP_TO_EXIT_ERROR_PROC
++  if(edf_set_patientcode(hdl, "Bravo"))  JUMP_TO_EXIT_ERROR_PROC
+ 
+   if(edf_set_gender(hdl, 1))  JUMP_TO_EXIT_ERROR_PROC
+ 
+@@ -3063,11 +3063,11 @@
+ 
+   if(edf_set_patient_additional(hdl, "Charlie"))  JUMP_TO_EXIT_ERROR_PROC
+ 
+-  if(edf_set_admincode(hdl, "Dlta"))  JUMP_TO_EXIT_ERROR_PROC
++  if(edf_set_admincode(hdl, "Delta"))  JUMP_TO_EXIT_ERROR_PROC
+ 
+-  if(edf_set_technician(hdl, "cho"))  JUMP_TO_EXIT_ERROR_PROC
++  if(edf_set_technician(hdl, "Echo"))  JUMP_TO_EXIT_ERROR_PROC
+ 
+-  if(edf_set_equipment(hdl, "Foxtrt"))  JUMP_TO_EXIT_ERROR_PROC
++  if(edf_set_equipment(hdl, "Foxtrot"))  JUMP_TO_EXIT_ERROR_PROC
+ 
+   if(edf_set_recording_additional(hdl, "Golf"))  JUMP_TO_EXIT_ERROR_PROC
+ 


=====================================
debian/patches/series
=====================================
@@ -1,2 +1,4 @@
 addcmake.patch
 properly-check-for-exp10.patch
+fix-unittest.patch
+enable-static-lib-generation.patch


=====================================
debian/rules
=====================================
@@ -22,3 +22,9 @@ override_dh_install:
 	# pkg_dev
 	dh_install -p$(pkg_dev) debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/lib*.so usr/lib/$(DEB_HOST_MULTIARCH)
 	dh_install -p$(pkg_dev) --autodest debian/tmp/usr/include/*
+	d-shlibmove --commit \
+		    --multiarch \
+		    --devunversioned \
+		    --exclude-la \
+		    --movedev "debian/tmp/usr/include/*" usr/include \
+		    debian/tmp/usr/lib/*/*.so


=====================================
debian/tests/Makefile deleted
=====================================
@@ -1,33 +0,0 @@
-#
-#
-# Author: Teunis van Beelen
-#
-# email: teuniz at gmail.com
-#
-#
-
-# unittest Makefile modified to work for autopkgtests
-
-CC = gcc
-CFLAGS = -Wall -Wextra -Wshadow -Wformat-nonliteral -Wformat-security -Wtype-limits -g -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE
-
-all: edflib_test
-
-edflib_test : unittest.o
-	$(CC) unittest.o -o edflib_test -ledf
-
-unittest.o : unittest.c
-	$(CC) $(CFLAGS) -c unittest.c -o unittest.o
-
-clean :
-	$(RM) *.o edflib_test *.[be]df
-
-#
-#
-#
-#
-
-
-
-
-


=====================================
debian/upstream/metadata
=====================================
@@ -0,0 +1,7 @@
+---
+Archive: GitLab
+Bug-Database: https://gitlab.com/Teuniz/EDFlib/issues
+Bug-Submit: https://gitlab.com/Teuniz/EDFlib/issues/new
+Changelog: https://gitlab.com/Teuniz/EDFlib/tags
+Repository: https://gitlab.com/Teuniz/EDFlib.git
+Repository-Browse: https://gitlab.com/Teuniz/EDFlib


=====================================
edflib.c
=====================================
@@ -1,7 +1,7 @@
 /*
 *****************************************************************************
 *
-* Copyright (c) 2009 - 2020 Teunis van Beelen
+* Copyright (c) 2009 - 2021 Teunis van Beelen
 * All rights reserved.
 *
 * Email: teuniz at protonmail.com
@@ -42,7 +42,7 @@
 #include "edflib.h"
 
 
-#define EDFLIB_VERSION  (118)
+#define EDFLIB_VERSION  (119)
 #define EDFLIB_MAXFILES  (64)
 
 
@@ -2504,9 +2504,7 @@ static struct edfhdrblock * edflib_check_edf_file(FILE *inputfile, int *edf_erro
         return NULL;
       }
 
-      edfhdr->startdate_year = edflib_atof_nonlocalized(scratchpad2 + 7);
-
-      if(edfhdr->startdate_year<1970)
+      if(edfhdr->startdate_year != edflib_atof_nonlocalized(scratchpad2 + 7))
       {
         *edf_error = EDFLIB_FILE_CONTAINS_FORMAT_ERRORS;
         free(edf_hdr);
@@ -6432,7 +6430,7 @@ int edf_set_startdatetime(int handle, int startdate_year, int startdate_month, i
     return -1;
   }
 
-  if((startdate_year<1970) || (startdate_year>3000) ||
+  if((startdate_year<1985) || (startdate_year>2084) ||
      (startdate_month<1)   || (startdate_month>12)  ||
      (startdate_day<1)     || (startdate_day>31)    ||
      (starttime_hour<0)    || (starttime_hour>23)   ||
@@ -6513,7 +6511,7 @@ int edfwrite_annotation_utf8(int handle, long long onset, long long duration, co
       break;
     }
 
-    if(list_annot->annotation[i] < 32)
+    if(((unsigned char *)(list_annot->annotation))[i] < 32)
     {
       list_annot->annotation[i] = '.';
     }
@@ -6736,7 +6734,7 @@ static int edflib_fprint_int_number_nonlocalized(FILE *file, int q, int minimum,
 
     j++;
 
-    q = -q;
+    base = -base;
   }
   else
   {
@@ -6808,7 +6806,7 @@ static int edflib_fprint_ll_number_nonlocalized(FILE *file, long long q, int min
 
     j++;
 
-    q = -q;
+    base = -base;
   }
   else
   {
@@ -6948,7 +6946,7 @@ static int edflib_snprint_ll_number_nonlocalized(char *dest, long long q, int mi
   {
     dest[j++] = '-';
 
-    q = -q;
+    base = -base;
   }
   else
   {
@@ -7029,7 +7027,7 @@ static int edflib_snprint_number_nonlocalized(char *dest, double val, int sz)
 
     if(q < 0)
     {
-      q = -q;
+      base = -base;
     }
   }
 
@@ -7083,7 +7081,7 @@ static int edflib_snprint_number_nonlocalized(char *dest, double val, int sz)
 
   if(q < 0)
   {
-    q = -q;
+    base = -base;
   }
 
   if(!q)
@@ -7298,10 +7296,10 @@ static int edflib_atoi_nonlocalized(const char *str)
 
     value *= 10;
 
-    value += (str[i] - '0');
+    value += ((str[i] - '0') * sign);
   }
 
-  return value * sign;
+  return value;
 }
 
 


=====================================
edflib.h
=====================================
@@ -1,7 +1,7 @@
 /*
 *****************************************************************************
 *
-* Copyright (c) 2009 - 2020 Teunis van Beelen
+* Copyright (c) 2009 - 2021 Teunis van Beelen
 * All rights reserved.
 *
 * Email: teuniz at protonmail.com
@@ -356,6 +356,8 @@ int edf_set_samplefrequency(int handle, int edfsignal, int samplefrequency);
 int edf_set_physical_maximum(int handle, int edfsignal, double phys_max);
 
 /* Sets the maximum physical value of signal edfsignal. (the value of the input of the ADC when the output equals the value of "digital maximum") */
+/* It is the highest value that the equipment is able to record. It does not necessarily mean the signal recorded reaches this level */
+/* Must be un-equal to physical minimum */
 /* Returns 0 on success, otherwise -1 */
 /* This function is required for every signal and can be called only after opening a */
 /* file in writemode and before the first sample write action */
@@ -364,7 +366,9 @@ int edf_set_physical_maximum(int handle, int edfsignal, double phys_max);
 int edf_set_physical_minimum(int handle, int edfsignal, double phys_min);
 
 /* Sets the minimum physical value of signal edfsignal. (the value of the input of the ADC when the output equals the value of "digital minimum") */
+/* It is the lowest value that the equipment is able to record. It does not necessarily mean the signal recorded reaches this level */
 /* Usually this will be (-(phys_max)) */
+/* Must be un-equal to physical maximum */
 /* Returns 0 on success, otherwise -1 */
 /* This function is required for every signal and can be called only after opening a */
 /* file in writemode and before the first sample write action */
@@ -373,7 +377,9 @@ int edf_set_physical_minimum(int handle, int edfsignal, double phys_min);
 int edf_set_digital_maximum(int handle, int edfsignal, int dig_max);
 
 /* Sets the maximum digital value of signal edfsignal. The maximum value is 32767 for EDF+ and 8388607 for BDF+ */
+/* It is the highest value that the equipment is able to record. It does not necessarily mean the signal recorded reaches this level */
 /* Usually it's the extreme output of the ADC */
+/* Must be higher than digital minimum */
 /* Returns 0 on success, otherwise -1 */
 /* This function is required for every signal and can be called only after opening a file in writemode */
 /* and before the first sample write action */
@@ -382,8 +388,10 @@ int edf_set_digital_maximum(int handle, int edfsignal, int dig_max);
 int edf_set_digital_minimum(int handle, int edfsignal, int dig_min);
 
 /* Sets the minimum digital value of signal edfsignal. The minimum value is -32768 for EDF+ and -8388608 for BDF+ */
+/* It is the lowest value that the equipment is able to record. It does not necessarily mean the signal recorded reaches this level */
 /* Usually it's the extreme output of the ADC */
 /* Usually this will be (-(dig_max + 1)) */
+/* Must be lower than digital maximum */
 /* Returns 0 on success, otherwise -1 */
 /* This function is required for every signal and can be called only after opening a file in writemode */
 /* and before the first sample write action */
@@ -429,12 +437,13 @@ int edf_set_startdatetime(int handle, int startdate_year, int startdate_month, i
                                       int starttime_hour, int starttime_minute, int starttime_second);
 
 /* Sets the startdate and starttime. */
-/* year: 1970 - 3000, month: 1 - 12, day: 1 - 31 */
+/* year: 1985 - 2084, month: 1 - 12, day: 1 - 31 */
 /* hour: 0 - 23, minute: 0 - 59, second: 0 - 59 */
 /* If not called, the library will use the system date and time at runtime */
 /* Returns 0 on success, otherwise -1 */
 /* This function is optional and can be called only after opening a file in writemode */
 /* and before the first sample write action */
+/* Note: for anonymization purposes, the consensus is to use 1985-01-01 00:00:00 for the startdate and starttime. */
 
 
 int edf_set_patientname(int handle, const char *patientname);


=====================================
sine_generator.c
=====================================
@@ -1,7 +1,7 @@
 /*
 *****************************************************************************
 *
-* Copyright (c) 2009 - 2019 Teunis van Beelen
+* Copyright (c) 2009 - 2021 Teunis van Beelen
 * All rights reserved.
 *
 * Email: teuniz at protonmail.com


=====================================
sweep_generator.c
=====================================
@@ -1,7 +1,7 @@
 /*
 *****************************************************************************
 *
-* Copyright (c) 2009 - 2019 Teunis van Beelen
+* Copyright (c) 2009 - 2021 Teunis van Beelen
 * All rights reserved.
 *
 * Email: teuniz at protonmail.com


=====================================
test_edflib.c
=====================================
@@ -1,7 +1,7 @@
 /*
 *****************************************************************************
 *
-* Copyright (c) 2009 - 2019 Teunis van Beelen
+* Copyright (c) 2009 - 2021 Teunis van Beelen
 * All rights reserved.
 *
 * Email: teuniz at protonmail.com


=====================================
test_generator.c
=====================================
@@ -1,7 +1,7 @@
 /*
 *****************************************************************************
 *
-* Copyright (c) 2009 - 2019 Teunis van Beelen
+* Copyright (c) 2009 - 2021 Teunis van Beelen
 * All rights reserved.
 *
 * Email: teuniz at protonmail.com


=====================================
debian/unittest/LICENSE → unittest/LICENSE
=====================================


=====================================
debian/unittest/Makefile → unittest/Makefile
=====================================
@@ -7,7 +7,7 @@
 #
 
 CC = gcc
-CFLAGS = -Wall -Wextra -Wshadow -Wformat-nonliteral -Wformat-security -Wtype-limits -g -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE
+CFLAGS = -Wall -Wextra -Wshadow -Wformat-nonliteral -Wformat-security -Wtype-limits -Wfatal-errors -g -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE
 
 all: edflib_test
 


=====================================
debian/unittest/README → unittest/README
=====================================


=====================================
debian/unittest/unittest.c → unittest/unittest.c
=====================================
@@ -3,7 +3,7 @@
 *
 * Author: Teunis van Beelen
 *
-* Copyright (C) 2017- 2020 Teunis van Beelen
+* Copyright (C) 2017- 2021 Teunis van Beelen
 *
 * Email: teuniz at protonmail.com
 *
@@ -48,19 +48,19 @@ int main(void)
       tmp,
       hdl=-1,
       chns=2,
-      ibuf[20000],
+      *ibuf=NULL,
       line,
       ival1,
       ival2;
 
-  char str[4096]={0,},
-       pbuf[300];
+  char *str=NULL,
+       *pbuf=NULL;
 
-  short sbuf[100];
+  short *sbuf=NULL;
 
   long long l_tmp;
 
-  double dbuf[1000];
+  double *dbuf=NULL;
 
   union {
           unsigned int one;
@@ -74,11 +74,42 @@ int main(void)
 
   struct edf_annotation_struct annot;
 
-  FILE *fp;
+  FILE *fp=NULL;
 
   setlocale(LC_ALL, "C");
 
-  if(edflib_version() != 118)  JUMP_TO_EXIT_ERROR_PROC
+  if(edflib_version() != 119)  JUMP_TO_EXIT_ERROR_PROC
+
+  ibuf = (int *)malloc(100 * sizeof(int));
+  if(ibuf == NULL)
+  {
+    JUMP_TO_EXIT_ERROR_PROC;
+  }
+
+  sbuf = (short *)malloc(100 * sizeof(short));
+  if(sbuf == NULL)
+  {
+    JUMP_TO_EXIT_ERROR_PROC;
+  }
+
+  dbuf = (double *)malloc(10240 * sizeof(double));
+  if(dbuf == NULL)
+  {
+    JUMP_TO_EXIT_ERROR_PROC;
+  }
+
+  str = (char *)malloc(4096 * sizeof(char));
+  if(str == NULL)
+  {
+    JUMP_TO_EXIT_ERROR_PROC;
+  }
+  str[0] = 0;
+
+  pbuf = (char *)malloc(300 * sizeof(char));
+  if(pbuf == NULL)
+  {
+    JUMP_TO_EXIT_ERROR_PROC;
+  }
 
 /********************************** EDF writing ******************************/
 
@@ -193,6 +224,10 @@ int main(void)
 
   if(edf_set_physical_dimension(hdl, 1, str))  JUMP_TO_EXIT_ERROR_PROC
 
+  if(!edf_set_startdatetime(hdl, 2085, 12, 5, 12, 23, 8))  JUMP_TO_EXIT_ERROR_PROC
+
+  if(!edf_set_startdatetime(hdl, 1984, 12, 5, 12, 23, 8))  JUMP_TO_EXIT_ERROR_PROC
+
   if(edf_set_startdatetime(hdl, 2017, 12, 5, 12, 23, 8))  JUMP_TO_EXIT_ERROR_PROC
 
   if(edf_set_patientname(hdl, "John Doe"))  JUMP_TO_EXIT_ERROR_PROC
@@ -2859,6 +2894,47 @@ int main(void)
     JUMP_TO_EXIT_ERROR_PROC
   }
 
+  hdl = -1;
+
+    /****************************************/
+
+  fp = fopen("test.edf", "r+b");
+
+  if(fp == NULL)  JUMP_TO_EXIT_ERROR_PROC
+
+  fseek(fp, 0xae, SEEK_SET);
+
+  fwrite("15", 2, 1, fp);
+
+  fclose(fp);
+
+  if(edfopen_file_readonly("test.edf", &hdr, EDFLIB_READ_ALL_ANNOTATIONS) == 0)  JUMP_TO_EXIT_ERROR_PROC
+
+  if(hdr.filetype != EDFLIB_FILE_CONTAINS_FORMAT_ERRORS)  JUMP_TO_EXIT_ERROR_PROC
+
+  /****************************************/
+
+  fp = fopen("test.edf", "r+b");
+
+  if(fp == NULL)  JUMP_TO_EXIT_ERROR_PROC
+
+  fseek(fp, 0xae, SEEK_SET);
+
+  fwrite("17 ", 2, 1, fp);
+
+  fclose(fp);
+
+  if(edfopen_file_readonly("test.edf", &hdr, EDFLIB_READ_ALL_ANNOTATIONS) != 0)  JUMP_TO_EXIT_ERROR_PROC
+
+  hdl = hdr.handle;
+
+  if(edfclose_file(hdl))
+  {
+    hdl = -1;
+
+    JUMP_TO_EXIT_ERROR_PROC
+  }
+
   hdl = -1;
 
 /********************************** EDF writing ******************************/
@@ -2932,19 +3008,37 @@ int main(void)
 
   if(edf_set_number_of_annotation_signals(hdl, 3))  JUMP_TO_EXIT_ERROR_PROC
 
+  char str_korea[]={0xeb,0x8c,0x80,0xed,0x95,0x9c,0xeb,0xaf,0xbc,0xea,0xb5,0xad,0x00};
+
+  char str_accented[]={0xc3,0xb1,0xe1,0xb8,0xb1,0xc3,0xb6,0xc3,0xa8,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x30,0x00};
+
   for(i=0; i<60; i++)
   {
     l_tmp = 10000LL * (i + 1);
 
     snprintf(str, 4096, "test %i sec", (int)(l_tmp / 10000LL));
 
-    if(edfwrite_annotation_latin1(hdl, l_tmp, -1LL, str))  JUMP_TO_EXIT_ERROR_PROC
+    if(i != 0)
+    {
+     if(edfwrite_annotation_latin1(hdl, l_tmp, -1LL, str))  JUMP_TO_EXIT_ERROR_PROC
+    }
+    else
+    {
+     if(edfwrite_annotation_utf8(hdl, l_tmp, -1LL, str_accented))  JUMP_TO_EXIT_ERROR_PROC
+    }
 
     l_tmp += 3333LL;
 
     snprintf(str, 4096, "test %i.%04i sec", (int)(l_tmp / 10000LL), (int)(l_tmp % 10000LL));
 
-    if(edfwrite_annotation_latin1(hdl, l_tmp, -1LL, str))  JUMP_TO_EXIT_ERROR_PROC
+    if(i != 0)
+    {
+      if(edfwrite_annotation_latin1(hdl, l_tmp, -1LL, str))  JUMP_TO_EXIT_ERROR_PROC
+    }
+    else
+    {
+     if(edfwrite_annotation_utf8(hdl, l_tmp, -1LL, str_korea))  JUMP_TO_EXIT_ERROR_PROC
+    }
   }
 
   if(edf_set_samplefrequency(hdl, 0, 100))  JUMP_TO_EXIT_ERROR_PROC
@@ -2959,9 +3053,9 @@ int main(void)
 
   if(edf_set_startdatetime(hdl, 2008, 12, 31, 23, 59, 58))  JUMP_TO_EXIT_ERROR_PROC
 
-  if(edf_set_patientname(hdl, "Alpha"))  JUMP_TO_EXIT_ERROR_PROC
+  if(edf_set_patientname(hdl, "lpha"))  JUMP_TO_EXIT_ERROR_PROC
 
-  if(edf_set_patientcode(hdl, "Bravo"))  JUMP_TO_EXIT_ERROR_PROC
+  if(edf_set_patientcode(hdl, "Brv"))  JUMP_TO_EXIT_ERROR_PROC
 
   if(edf_set_gender(hdl, 1))  JUMP_TO_EXIT_ERROR_PROC
 
@@ -2969,11 +3063,11 @@ int main(void)
 
   if(edf_set_patient_additional(hdl, "Charlie"))  JUMP_TO_EXIT_ERROR_PROC
 
-  if(edf_set_admincode(hdl, "Delta"))  JUMP_TO_EXIT_ERROR_PROC
+  if(edf_set_admincode(hdl, "Dlta"))  JUMP_TO_EXIT_ERROR_PROC
 
-  if(edf_set_technician(hdl, "Echo"))  JUMP_TO_EXIT_ERROR_PROC
+  if(edf_set_technician(hdl, "cho"))  JUMP_TO_EXIT_ERROR_PROC
 
-  if(edf_set_equipment(hdl, "Foxtrot"))  JUMP_TO_EXIT_ERROR_PROC
+  if(edf_set_equipment(hdl, "Foxtrt"))  JUMP_TO_EXIT_ERROR_PROC
 
   if(edf_set_recording_additional(hdl, "Golf"))  JUMP_TO_EXIT_ERROR_PROC
 
@@ -3085,6 +3179,12 @@ int main(void)
 
   /****************************************/
 
+  free(ibuf);
+  free(sbuf);
+  free(dbuf);
+  free(str);
+  free(pbuf);
+
   return EXIT_SUCCESS;
 
 OUT_ERROR:
@@ -3094,7 +3194,13 @@ OUT_ERROR:
     edfclose_file(hdl);
   }
 
-  printf("Error, line %i file %s\n", line, __FILE__);
+  free(ibuf);
+  free(sbuf);
+  free(dbuf);
+  free(str);
+  free(pbuf);
+
+  fprintf(stderr, "Error, line %i file %s\n", line, __FILE__);
 
   return EXIT_FAILURE;
 }



View it on GitLab: https://salsa.debian.org/med-team/edflib/-/compare/98c9e05b72c9014aef41397fd661f2d09e9ab0ea...2c7209c1c77a1b631e17acd65ea215f8f1f4115b

-- 
View it on GitLab: https://salsa.debian.org/med-team/edflib/-/compare/98c9e05b72c9014aef41397fd661f2d09e9ab0ea...2c7209c1c77a1b631e17acd65ea215f8f1f4115b
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20210104/aa95b75f/attachment-0001.html>


More information about the debian-med-commit mailing list