Commit b712e01f authored by Justin Chen's avatar Justin Chen
Browse files

shntool: fix build with GCC 15

parent c65bc23e
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
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 <stdbool.h>
+
 #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;
+26 −0
Original line number Diff line number Diff line
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);
 }
 
+9 −1
Original line number Diff line number Diff line
@@ -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 = {