From a924854297150654c20d17ae9b9dacdcc04d67e9 Mon Sep 17 00:00:00 2001
From: Lilac <lilac@noreply.bgme.me>
Date: Tue, 16 May 2023 07:03:44 +0000
Subject: [PATCH] shntool: auto updated to 3.0.10-7

---
 repo/shntool/PKGBUILD                         | 50 +++++++++++++++++++
 repo/shntool/debian_patches_950803.patch      | 46 +++++++++++++++++
 .../debian_patches_no-cdquality-check.patch   | 21 ++++++++
 repo/shntool/shntool-3.0.10-large-size.diff   | 22 ++++++++
 repo/shntool/shntool-3.0.10-large-times.diff  | 39 +++++++++++++++
 5 files changed, 178 insertions(+)
 create mode 100644 repo/shntool/PKGBUILD
 create mode 100644 repo/shntool/debian_patches_950803.patch
 create mode 100644 repo/shntool/debian_patches_no-cdquality-check.patch
 create mode 100644 repo/shntool/shntool-3.0.10-large-size.diff
 create mode 100644 repo/shntool/shntool-3.0.10-large-times.diff

diff --git a/repo/shntool/PKGBUILD b/repo/shntool/PKGBUILD
new file mode 100644
index 0000000..74d5e14
--- /dev/null
+++ b/repo/shntool/PKGBUILD
@@ -0,0 +1,50 @@
+# Maintainer: schuay <jakob.gruber@gmail.com>
+# Contributor: Michal Hybner <dta081@gmail.com>
+
+pkgname=shntool
+pkgver=3.0.10
+pkgrel=7
+pkgdesc="A multi-purpose WAVE data processing and reporting utility"
+arch=('x86_64')
+url="http://shnutils.freeshell.org/shntool/"
+license=('GPL')
+options=(!emptydirs)
+depends=('glibc')
+optdepends=('mac: support for ape format'
+            'flac: support for flac format'
+            'wavpack: support for wv format')
+source=("http://www.slackware.com/~alien/slackbuilds/${pkgname}/build/${pkgname}-${pkgver}.tar.gz"
+        'debian_patches_950803.patch'
+        'debian_patches_no-cdquality-check.patch'
+        'shntool-3.0.10-large-size.diff'
+        'shntool-3.0.10-large-times.diff')
+
+# Patches taken from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=684600
+# https://salsa.debian.org/debian/shntool/-/tree/master/debian/patches
+
+prepare() {
+	cd "${srcdir}"/${pkgname}-${pkgver}
+  patch -Np1 < "${srcdir}/debian_patches_950803.patch"
+  patch -Np1 < "${srcdir}/shntool-3.0.10-large-size.diff"
+  patch -Np1 < "${srcdir}/shntool-3.0.10-large-times.diff"
+  patch -Np1 < "${srcdir}/debian_patches_no-cdquality-check.patch"
+}
+
+build() {
+	cd "${srcdir}"/${pkgname}-${pkgver}
+	./configure --prefix=/usr
+	make
+}
+
+package() {
+	cd "${srcdir}"/${pkgname}-${pkgver}
+	make DESTDIR="${pkgdir}" install
+}
+
+md5sums=('5d41f8f42c3c15e3145a7a43539c3eae'
+         'a3aa5b817cedb4226fa32340609a5995'
+         '596398b13e02b243078320ebde4743fb'
+         '4265935ef1d684a4b49041278ffda7de'
+         '6f0d61ddbf8cbee5c0b51a99e987ddda')
+
+# vim:set ts=2 sw=2 et:
diff --git a/repo/shntool/debian_patches_950803.patch b/repo/shntool/debian_patches_950803.patch
new file mode 100644
index 0000000..a37e0e9
--- /dev/null
+++ b/repo/shntool/debian_patches_950803.patch
@@ -0,0 +1,46 @@
+Origin: https://github.com/max619/shntool/commit/cfd06e4ed
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=950803
+From cfd06e4edecdca2013e0fe04db135fd110a68203 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=D0=B8=D0=BC=20=D0=91=D0=B0=D0=B3?=
+ =?UTF-8?q?=D1=80=D1=8F=D0=BD=D1=86=D0=B5=D0=B2?= <maxbag97619@gmail.com>
+Date: Mon, 11 Nov 2019 00:53:06 +0300
+Subject: [PATCH] Added WAVE_FORMAT_EXTENSIBLE with value 0xfffe and supressed
+ error on wav header parsing with that format
+
+--- a/include/wave.h
++++ b/include/wave.h
+@@ -58,8 +58,9 @@
+ #define WAVE_FORMAT_MPEG                (0x0050)
+ #define WAVE_FORMAT_MPEGLAYER3          (0x0055)
+ #define WAVE_FORMAT_G726_ADPCM          (0x0064)
+ #define WAVE_FORMAT_G722_ADPCM          (0x0065)
++#define WAVE_FORMAT_EXTENSIBLE          (0xfffe)
+ 
+ #define CD_BLOCK_SIZE                   (2352)
+ #define CD_BLOCKS_PER_SEC               (75)
+ #define CD_BLOCK_ALIGN                  (4)
+--- a/src/core_wave.c
++++ b/src/core_wave.c
+@@ -166,8 +166,9 @@
+     return FALSE;
+   }
+ 
+   switch (info->wave_format) {
++    case WAVE_FORMAT_EXTENSIBLE:
+     case WAVE_FORMAT_PCM:
+       break;
+     default:
+       st_warning("unsupported format 0x%04x (%s) while processing file: [%s]",
+@@ -510,9 +511,11 @@
+       return "MPEG Layer 3";
+     case WAVE_FORMAT_G726_ADPCM:
+       return "G.726 ADPCM";
+     case WAVE_FORMAT_G722_ADPCM:
+-      return "G.722 ADPCM";
++      return "G.722 ADPCM";      
++    case WAVE_FORMAT_EXTENSIBLE:
++      return "WAVE Extensible format";
+   }
+   return "Unknown";
+ }
+ 
diff --git a/repo/shntool/debian_patches_no-cdquality-check.patch b/repo/shntool/debian_patches_no-cdquality-check.patch
new file mode 100644
index 0000000..4ca3717
--- /dev/null
+++ b/repo/shntool/debian_patches_no-cdquality-check.patch
@@ -0,0 +1,21 @@
+Last-Update: 2014-11-15
+Forwarded: yes
+Author: Dmitry Smirnov <onlyjob@member.fsf.org>
+Bug-Debian: http://bugs.debian.org/769585
+Description: disable CD-quality check, needed to process 24bit 96kHz files.
+
+--- a/src/core_mode.c
++++ b/src/core_mode.c
+@@ -344,10 +344,10 @@
+ 
+   *colon = 0;
+   *dot = 0;
+ 
+-  if (PROB_NOT_CD(info))
+-    st_error("m:ss.ff format can only be used with CD-quality files");
++//  if (PROB_NOT_CD(info))
++//    st_error("m:ss.ff format can only be used with CD-quality files");
+ 
+   min = atoi((const char *)buf);
+   sec = atoi((const char *)(colon+1));
+   frames = atoi((const char *)(dot+1));
diff --git a/repo/shntool/shntool-3.0.10-large-size.diff b/repo/shntool/shntool-3.0.10-large-size.diff
new file mode 100644
index 0000000..539c7fb
--- /dev/null
+++ b/repo/shntool/shntool-3.0.10-large-size.diff
@@ -0,0 +1,22 @@
+diff -aur shntool-3.0.10-clean/src/core_fileio.c shntool-3.0.10-size/src/core_fileio.c
+--- shntool-3.0.10-clean/src/core_fileio.c	2009-03-11 17:18:01.000000000 +0000
++++ shntool-3.0.10-size/src/core_fileio.c	2012-08-11 17:20:14.000000000 +0100
+@@ -110,10 +110,16 @@
+   buf[4] = 0;
+ 
+   if (be_val)
+-    *be_val = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
++    *be_val = (((unsigned long)buf[0]) << 24)
++              | (((unsigned long)buf[1]) << 16)
++              | (((unsigned long)buf[2]) << 8)
++              | ((unsigned long)buf[3]);
+ 
+   if (le_val)
+-    *le_val = (buf[3] << 24) | (buf[2] << 16) | (buf[1] << 8) | buf[0];
++    *le_val = (((unsigned long)buf[3]) << 24)
++              | (((unsigned long)buf[2]) << 16)
++              | (((unsigned long)buf[1]) << 8)
++              | ((unsigned long)buf[0]);
+ 
+   if (tag_val)
+     tagcpy(tag_val,buf);
diff --git a/repo/shntool/shntool-3.0.10-large-times.diff b/repo/shntool/shntool-3.0.10-large-times.diff
new file mode 100644
index 0000000..be4716e
--- /dev/null
+++ b/repo/shntool/shntool-3.0.10-large-times.diff
@@ -0,0 +1,39 @@
+diff -aur shntool-3.0.10-clean/src/core_mode.c shntool-3.0.10/src/core_mode.c
+--- shntool-3.0.10-clean/src/core_mode.c	2009-03-30 06:55:33.000000000 +0100
++++ shntool-3.0.10/src/core_mode.c	2012-08-11 16:37:58.000000000 +0100
+@@ -310,8 +310,8 @@
+   if (sec >= 60)
+     st_error("invalid value for seconds: [%d]",sec);
+ 
+-  bytes = (wlong)(min * info->rate * 60) +
+-          (wlong)(sec * info->rate);
++  bytes = (((wlong)min) * info->rate * 60) +
++          (((wlong)sec) * info->rate);
+ 
+   return bytes;
+ }
+@@ -358,9 +358,9 @@
+   if (frames >= 75)
+     st_error("invalid value for frames: [%d]",frames);
+ 
+-  bytes = (wlong)(min * CD_RATE * 60) +
+-          (wlong)(sec * CD_RATE) +
+-          (wlong)(frames * CD_BLOCK_SIZE);
++  bytes = (((wlong)min) * CD_RATE * 60) +
++          (((wlong)sec) * CD_RATE) +
++          (((wlong)frames) * CD_BLOCK_SIZE);
+ 
+   return bytes;
+ }
+@@ -403,8 +403,8 @@
+ 
+   nearest_byte = (int)((((double)ms * (double)info->rate) / 1000.0) + 0.5);
+ 
+-  bytes = (wlong)(min * info->rate * 60) +
+-          (wlong)(sec * info->rate);
++  bytes = (((wlong)min) * info->rate * 60) +
++          (((wlong)sec) * info->rate);
+ 
+   if (PROB_NOT_CD(info)) {
+     bytes += nearest_byte;
+