From aa64b1c216db1cbcd5c48980daf549e2e553bc5f Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Tue, 28 May 2024 17:49:41 +0300 Subject: [PATCH 1/3] compat: include byteswap.h instead of endian.h This fixes the following compile error on systems using musl libc: net_io.c: In function 'bam32ToDouble': net_io.c:1412:32: error: implicit declaration of function '__bswap_32'; did you mean '__bswap32'? [-Werror=implicit-function-declaration] 1412 | return (double) ((int32_t) __bswap_32(bam) * 8.38190317153931E-08); | ^~~~~~~~~~ | __bswap32 net_io.c: In function 'decodeHulcMessage': net_io.c:1440:40: error: implicit declaration of function '__bswap_16'; did you mean '__bswap16'? [-Werror=implicit-function-declaration] 1440 | Modes.receiver.antenna_flags = __bswap_16(hsm.status.flags); | ^~~~~~~~~~ | __bswap16 Compile-tested on both glibc and musl systems. Signed-off-by: Stijn Tintel --- compat/compat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compat/compat.h b/compat/compat.h index 5905e10e..2671b784 100644 --- a/compat/compat.h +++ b/compat/compat.h @@ -20,7 +20,7 @@ #else // other platforms -# include +# include #endif From 305db9b03ffc83d01606c10f22912c09a51faee4 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Wed, 29 May 2024 09:01:10 +0300 Subject: [PATCH 2/3] readsbrrd: fix misplaced widening cast Suggested-by: Rosen Penev Signed-off-by: Stijn Tintel --- readsbrrd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readsbrrd.c b/readsbrrd.c index 77c74ae6..5d23192b 100644 --- a/readsbrrd.c +++ b/readsbrrd.c @@ -578,7 +578,7 @@ int main(int argc, char** argv) { // Run this until we get a termination signal. while (!readsbrrd_exit) { clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_sec += (__time_t) (rrd.step * 1.5); + ts.tv_sec += (__time_t) rrd.step * 1.5; r = sem_getvalue(stats_semptr, &semcnt); // Avoid frequent updates when more than one event is queued in semaphore. // Update only one very last event. From f1a986c77dcb3272fec82ef046947d34c86f3bd4 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Tue, 28 May 2024 21:29:17 +0300 Subject: [PATCH 3/3] readsbrrd: cast timespec.tv_sec addend to time_t This fixes the following compile error on systems using musl libc: readsbrrd.c: In function 'main': readsbrrd.c:581:23: error: '__time_t' undeclared (first use in this function); did you mean 'time_t'? 581 | ts.tv_sec += (__time_t) (rrd.step * 1.5); | ^~~~~~~~ | time_t Compile-tested on both glibc and musl systems. Signed-off-by: Stijn Tintel --- readsbrrd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readsbrrd.c b/readsbrrd.c index 5d23192b..7b4401b3 100644 --- a/readsbrrd.c +++ b/readsbrrd.c @@ -578,7 +578,7 @@ int main(int argc, char** argv) { // Run this until we get a termination signal. while (!readsbrrd_exit) { clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_sec += (__time_t) rrd.step * 1.5; + ts.tv_sec += (time_t) rrd.step * 1.5; r = sem_getvalue(stats_semptr, &semcnt); // Avoid frequent updates when more than one event is queued in semaphore. // Update only one very last event.