diff --git a/pkgs/by-name/sh/shntool/bool-type.patch b/pkgs/by-name/sh/shntool/bool-type.patch new file mode 100644 index 000000000000..ed3dcd8d480d --- /dev/null +++ b/pkgs/by-name/sh/shntool/bool-type.patch @@ -0,0 +1,48 @@ +diff --git a/include/format.h b/include/format.h +index 567993e..ab293f8 100644 +--- a/include/format.h ++++ b/include/format.h +@@ -35,7 +35,7 @@ void tagcpy(unsigned char *,unsigned char *); + int tagcmp(unsigned char *,unsigned char *); + + /* function to check if a file name is about to be clobbered, and if so, asks whether this is OK */ +-int clobber_check(char *); ++bool clobber_check(char *); + + /* find an output format module with the given name */ + format_module *find_format(char *); +diff --git a/include/mode.h b/include/mode.h +index a9c8cd0..fc13d4f 100644 +--- a/include/mode.h ++++ b/include/mode.h +@@ -78,7 +78,7 @@ void create_output_filename(char *,char *,char *); + FILE *open_output_stream(char *,proc_info *); + + /* function to determine if two filenames point to the same file */ +-int files_are_identical(char *,char *); ++bool files_are_identical(char *,char *); + + /* function to remove a file if it exists */ + void remove_file(char *); +diff --git a/include/module-types.h b/include/module-types.h +index c49c661..2d7b0a3 100644 +--- a/include/module-types.h ++++ b/include/module-types.h +@@ -23,6 +23,8 @@ + #ifndef __MODULE_TYPES_H__ + #define __MODULE_TYPES_H__ + ++#include ++ + #ifdef HAVE_CONFIG_H + #include "config.h" + #endif +@@ -44,8 +46,6 @@ + #define PATHSEPCHAR '/' + #endif + +-/* boolean type */ +-typedef int bool; + + /* wtypes */ + typedef unsigned long wlong; diff --git a/pkgs/by-name/sh/shntool/function-pointer-type.patch b/pkgs/by-name/sh/shntool/function-pointer-type.patch new file mode 100644 index 000000000000..c88e0dc5d835 --- /dev/null +++ b/pkgs/by-name/sh/shntool/function-pointer-type.patch @@ -0,0 +1,26 @@ +diff --git a/src/core_mode.c b/src/core_mode.c +index d67e317..21d3b9e 100644 +--- a/src/core_mode.c ++++ b/src/core_mode.c +@@ -564,17 +564,17 @@ static int compare_ascii(const wave_info **w1,const wave_info **w2) + + static void ascii_sort_files(wave_info **filenames, int numfiles) + { +- int (*cmpfunc) (); ++ int (*cmpfunc) (const void *, const void *); + +- cmpfunc = compare_ascii; ++ cmpfunc = (int (*)(const void *, const void *))compare_ascii; + qsort(filenames,numfiles,sizeof(wave_info *),cmpfunc); + } + + static void version_sort_files(wave_info **filenames,int numfiles) + { +- int (*cmpfunc) (); ++ int (*cmpfunc) (const void *, const void *); + +- cmpfunc = compare_version; ++ cmpfunc = (int (*)(const void *, const void *))compare_version; + qsort(filenames,numfiles,sizeof(wave_info *),cmpfunc); + } + diff --git a/pkgs/by-name/sh/shntool/package.nix b/pkgs/by-name/sh/shntool/package.nix index a176c11ce5e2..b0fc9a6bb4f0 100644 --- a/pkgs/by-name/sh/shntool/package.nix +++ b/pkgs/by-name/sh/shntool/package.nix @@ -17,10 +17,18 @@ stdenv.mkDerivation rec { sha256 = "sha256-Qn4LwVx34EhypiZDIxuveNhePigkuiICn1nBukoQf5Y="; }; + patches = [ + # Fix conflicts between reserved keywords `bool` (starting from C23) and custom `typedef`s. + ./bool-type.patch + # Fix implicit weak-typed pointer casting. + ./function-pointer-type.patch + ]; + buildInputs = [ flac ]; prePatch = '' - patches=$(grep -v '#' ./debian/patches/series | while read patch; do echo "./debian/patches/$patch"; done | tr '\n' ' ') + additional_patches=$(grep -v '#' ./debian/patches/series | while read patch; do echo "./debian/patches/$patch"; done | tr '\n' ' ') + patches="$patches $additional_patches" ''; meta = {