From 00c9bbaa75bab9841492f348e7325c02ae39168c Mon Sep 17 00:00:00 2001 From: Ludovic Malfait Date: Wed, 27 May 2026 16:04:56 +0100 Subject: [PATCH] Fix compilation errors on modern C compilers and CMake >= 3.28 - CMakeLists.txt, src/wmc_tool/CMakeLists.txt: Update cmake_minimum_required to VERSION 3.10...3.31 (range syntax required by CMake >= 3.28) - shiftbit.c: Pass FILE* (Fi) instead of int fd (fi) to fread() - mnru.c: Assign 0 instead of NULL to long field s->seed - endian.c: Add void return types to reverse_endian_short/long, use unsigned types in test functions to match signatures --- CMakeLists.txt | 2 +- src/g711/shiftbit.c | 2 +- src/mnru/mnru.c | 2 +- src/unsup/endian.c | 8 ++++---- src/wmc_tool/CMakeLists.txt | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cbd02f45..1371fcab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.10...3.31) project(STL2023 VERSION 2023) add_definitions( -DVERSION_STL="${CMAKE_PROJECT_NAME}" ) diff --git a/src/g711/shiftbit.c b/src/g711/shiftbit.c index 92cb0d20..f10bbc98 100644 --- a/src/g711/shiftbit.c +++ b/src/g711/shiftbit.c @@ -97,7 +97,7 @@ int main (int argc, char *argv[]) { fprintf (stderr, "%s: Reading, ", inp); for (k = 0; k < l; k += 256) - if (fread (&buf[k],1, 512, fi) < 0) + if (fread (&buf[k],1, 512, Fi) < 0) KILL (inp, 5); fprintf (stderr, "shifting, "); diff --git a/src/mnru/mnru.c b/src/mnru/mnru.c index bdb3c3b3..40b6580b 100644 --- a/src/mnru/mnru.c +++ b/src/mnru/mnru.c @@ -723,7 +723,7 @@ double *P50_MNRU_process(char operation, MNRU_state *s, double* input, double* o return (NULL); /* Seed for random number generation (NO LONGER USED) */ - s->seed = NULL; + s->seed = 0; /* Gain for signal path */ if (mode == MOD_NOISE) diff --git a/src/unsup/endian.c b/src/unsup/endian.c index 97ea087a..70990fe9 100644 --- a/src/unsup/endian.c +++ b/src/unsup/endian.c @@ -9,7 +9,7 @@ --------------------------------------------------------------------------- */ -reverse_endian_short (unsigned short *a, unsigned short *b, long n) { +void reverse_endian_short (unsigned short *a, unsigned short *b, long n) { long i; unsigned short register tmp; for (i = 0; i < n; i++) { @@ -26,7 +26,7 @@ reverse_endian_short (unsigned short *a, unsigned short *b, long n) { 06.Oct.97 v1.0 Created --------------------------------------------------------------------------- */ -reverse_endian_long (unsigned long *a, unsigned long *b, long n) { +void reverse_endian_long (unsigned long *a, unsigned long *b, long n) { long i; union { unsigned long tmp; @@ -52,7 +52,7 @@ int is_little_endian () { } void test_s () { - short a, b; + unsigned short a, b; while (1) { fread (&a, 1, sizeof (short), stdin); if (feof (stdin)) @@ -63,7 +63,7 @@ void test_s () { } void test_l () { - long a, b; + unsigned long a, b; while (1) { fread (&a, 1, sizeof (long), stdin); if (feof (stdin)) diff --git a/src/wmc_tool/CMakeLists.txt b/src/wmc_tool/CMakeLists.txt index 858ee70c..eb97e719 100644 --- a/src/wmc_tool/CMakeLists.txt +++ b/src/wmc_tool/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.10...3.31) project(wmc_tool) include(CTest)