shntool: fix build with GCC 15, format and remove rec (#476145)

This commit is contained in:
Aleksana
2026-01-02 07:46:30 +00:00
committed by GitHub
3 changed files with 89 additions and 5 deletions
+48
View File
@@ -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 <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;
@@ -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);
}
+15 -5
View File
@@ -5,7 +5,7 @@
flac,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
version = "3.0.10+git20130108.4ca41f4-1";
pname = "shntool";
@@ -13,16 +13,26 @@ stdenv.mkDerivation rec {
domain = "salsa.debian.org";
owner = "debian";
repo = "shntool";
rev = "debian/${version}";
rev = "debian/${finalAttrs.version}";
sha256 = "sha256-Qn4LwVx34EhypiZDIxuveNhePigkuiICn1nBukoQf5Y=";
};
buildInputs = [ flac ];
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
];
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"
'';
buildInputs = [
flac
];
meta = {
description = "Multi-purpose WAVE data processing and reporting utility";
homepage = "https://packages.qa.debian.org/s/shntool.html";
@@ -30,4 +40,4 @@ stdenv.mkDerivation rec {
platforms = lib.platforms.all;
maintainers = with lib.maintainers; [ jcumming ];
};
}
})