mpg123: mpg123-1.32.3

From 530d2f6056692ae3ae49fe6c6ded8d40882d2b0d Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Wed, 4 Oct 2023 11:11:10 +0300
Subject: [PATCH] mpg123-1.32.3

---
 NEWS                           |  8 ++++++++
 configure                      | 24 ++++++++++++------------
 mpg123.spec                    |  2 +-
 ports/cmake/src/CMakeLists.txt | 23 ++++++++++++++---------
 src/compat/compat.h            |  5 +++++
 src/libmpg123/lfs_wrap.c       |  7 +++++--
 src/libmpg123/mpg123.h         |  2 +-
 src/libsyn123/resample.c       |  8 ++++++--
 src/libsyn123/syn123.h         |  2 +-
 src/version.h                  |  2 +-
 10 files changed, 54 insertions(+), 29 deletions(-)

diff --git a/NEWS b/NEWS
index 4cde934..dfc00e4 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+1.32.3
+------
+- ports/cmake: Only enable modules with GetThreadErrorMode() on Windows.
+- compat: Define EOVERFLOW for ancient Windows toolchains.
+- libmpg123, libsyn123: always ifdef LFS_LARGEFILE_64 (not just if)
+- libsyn123: re-introduce _32 wrappers in addition to suffix-less ones
+  (regression from 1.31, bug 363)
+
 1.32.2
 ------
 
diff --git a/configure b/configure
index 15e6f7e..b3ff3d7 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.71 for mpg123 1.32.2.
+# Generated by GNU Autoconf 2.71 for mpg123 1.32.3.
 #
 # Report bugs to <maintainer@mpg123.org>.
 #
@@ -621,8 +621,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='mpg123'
 PACKAGE_TARNAME='mpg123'
-PACKAGE_VERSION='1.32.2'
-PACKAGE_STRING='mpg123 1.32.2'
+PACKAGE_VERSION='1.32.3'
+PACKAGE_STRING='mpg123 1.32.3'
 PACKAGE_BUGREPORT='maintainer@mpg123.org'
 PACKAGE_URL=''
 
@@ -1726,7 +1726,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures mpg123 1.32.2 to adapt to many kinds of systems.
+\`configure' configures mpg123 1.32.3 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1797,7 +1797,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of mpg123 1.32.2:";;
+     short | recursive ) echo "Configuration of mpg123 1.32.3:";;
    esac
   cat <<\_ACEOF
 
@@ -2074,7 +2074,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-mpg123 configure 1.32.2
+mpg123 configure 1.32.3
 generated by GNU Autoconf 2.71
 
 Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2619,7 +2619,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by mpg123 $as_me 1.32.2, which was
+It was created by mpg123 $as_me 1.32.3, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -3388,9 +3388,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-LIBMPG123_VERSION=48:0:48
+LIBMPG123_VERSION=48:1:48
 LIBOUT123_VERSION=5:0:5
-LIBSYN123_VERSION=2:1:2
+LIBSYN123_VERSION=2:2:2
 
 
 
@@ -3989,7 +3989,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='mpg123'
- VERSION='1.32.2'
+ VERSION='1.32.3'
 
 
 printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -22648,7 +22648,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by mpg123 $as_me 1.32.2, which was
+This file was extended by mpg123 $as_me 1.32.3, which was
 generated by GNU Autoconf 2.71.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -22716,7 +22716,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-mpg123 config.status 1.32.2
+mpg123 config.status 1.32.3
 configured by $0, generated by GNU Autoconf 2.71,
   with options \\"\$ac_cs_config\\"
 
diff --git a/mpg123.spec b/mpg123.spec
index ea24a01..ca355c2 100644
--- a/mpg123.spec
+++ b/mpg123.spec
@@ -3,7 +3,7 @@
 # - devel packages for alsa, sdl, etc... to build the respective output modules.
 Summary:	The fast console mpeg audio decoder/player.
 Name:		mpg123
-Version:	1.32.2
+Version:	1.32.3
 Release:	1
 URL:		http://www.mpg123.org/
 License:	GPL
diff --git a/ports/cmake/src/CMakeLists.txt b/ports/cmake/src/CMakeLists.txt
index 930fe07..b99de95 100644
--- a/ports/cmake/src/CMakeLists.txt
+++ b/ports/cmake/src/CMakeLists.txt
@@ -139,15 +139,20 @@ check_type_size(long SIZEOF_LONG)
 check_type_size(off_t SIZEOF_OFF_T)
 
 if(WIN32 AND HAVE_WINDOWS_H)
-    check_c_source_compiles("
-        #include <windows.h>
-
-        int main() {
-          LoadLibraryW(0);
-          GetProcAddress(0, 0);
-          FreeLibrary(0);
-        }"
-        HAVE_WIN_DL)
+    check_function_exists(GetThreadErrorMode HAVE_GETTHREADERRORMODE)
+    if(HAVE_GETTHREADERRORMODE)
+        check_c_source_compiles("
+            #include <windows.h>
+
+            int main() {
+              LoadLibraryW(0);
+              GetProcAddress(0, 0);
+              FreeLibrary(0);
+            }"
+            HAVE_WIN_DL)
+    else()
+        set(HAVE_WIN_DL OFF)
+    endif()
 else()
     function(check_dl)
         set(CMAKE_REQUIRED_LIBRARIES dl)
diff --git a/src/compat/compat.h b/src/compat/compat.h
index 5bdefb2..27e820b 100644
--- a/src/compat/compat.h
+++ b/src/compat/compat.h
@@ -332,4 +332,9 @@ size_t INT123_unintr_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *st
 void (*INT123_catchsignal(int signum, void(*handler)(int)))(int);
 #endif
 
+// Some ancient toolchains miss the documented errno value.
+#if defined(_WIN32) && !defined(EOVERFLOW)
+#define EOVERFLOW 132
+#endif
+
 #endif
diff --git a/src/libmpg123/lfs_wrap.c b/src/libmpg123/lfs_wrap.c
index 1474de7..affb0de 100644
--- a/src/libmpg123/lfs_wrap.c
+++ b/src/libmpg123/lfs_wrap.c
@@ -45,6 +45,9 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
+// A paranoid check that someone did not define a wrong SIZEOF_OFF_T at configure time.
+typedef unsigned char MPG123_STATIC_ASSERT[(SIZEOF_OFF_T == sizeof(off_t)) ? 1 : -1];
+
 #include "debug.h"
 
 // We do not want to expose this publicly, but it is cleaner to have it also defined
@@ -91,7 +94,7 @@ struct wrap_data
 	off_t (*r_lseek)(int, off_t, int);
 	mpg123_ssize_t (*r_h_read)(void *, void *, size_t);
 	off_t (*r_h_lseek)(void*, off_t, int);
-#if LFS_LARGEFILE_64
+#ifdef LFS_LARGEFILE_64
 	mpg123_ssize_t (*r_read_64) (int, void *, size_t);
 	off64_t (*r_lseek_64)(int, off64_t, int);
 	mpg123_ssize_t (*r_h_read_64)(void *, void *, size_t);
@@ -176,7 +179,7 @@ static struct wrap_data* wrap_get(mpg123_handle *mh, int force_alloc)
 		whd->r_lseek = NULL;
 		whd->r_h_read = NULL;
 		whd->r_h_lseek = NULL;
-#if LFS_LARGEFILE_64
+#ifdef LFS_LARGEFILE_64
 		whd->r_read_64 = NULL;
 		whd->r_lseek_64 = NULL;
 		whd->r_h_read_64 = NULL;
diff --git a/src/libmpg123/mpg123.h b/src/libmpg123/mpg123.h
index 5f7efde..2eeadcb 100644
--- a/src/libmpg123/mpg123.h
+++ b/src/libmpg123/mpg123.h
@@ -19,7 +19,7 @@
  */
 #define MPG123_API_VERSION 48
 /** library patch level at client build time */
-#define MPG123_PATCHLEVEL  0
+#define MPG123_PATCHLEVEL  1
 
 #ifndef MPG123_EXPORT
 /** Defines needed for MS Visual Studio(tm) DLL builds.
diff --git a/src/libsyn123/resample.c b/src/libsyn123/resample.c
index f8a91ce..adb713a 100644
--- a/src/libsyn123/resample.c
+++ b/src/libsyn123/resample.c
@@ -2040,15 +2040,19 @@ type attribute_align_arg name(long inrate, long outrate, type io) \
 #if  SIZEOF_OFF_T == 8
 resample_total_alias(off_t, syn123_resample_total, syn123_resample_total64)
 resample_total_alias(off_t, syn123_resample_intotal, syn123_resample_intotal64)
+resample_total_alias(off_t, syn123_resample_total_64, syn123_resample_total64)
+resample_total_alias(off_t, syn123_resample_intotal_64, syn123_resample_intotal64)
 #elif SIZEOF_OFF_T == 4
 resample_total_wrap(off_t, INT32_MAX, syn123_resample_total, syn123_resample_total64)
 resample_total_wrap(off_t, INT32_MAX, syn123_resample_intotal, syn123_resample_intotal64)
-#if LFS_LARGEFILE_64
+resample_total_wrap(off_t, INT32_MAX, syn123_resample_total_32, syn123_resample_total64)
+resample_total_wrap(off_t, INT32_MAX, syn123_resample_intotal_32, syn123_resample_intotal64)
+#ifdef LFS_LARGEFILE_64
 resample_total_alias(off64_t, syn123_resample_total_64, syn123_resample_total64)
 resample_total_alias(off64_t, syn123_resample_intotal_64, syn123_resample_intotal64)
 #endif
 #else
-#error "Unexpected LFS_ALIAS_BITS value."
+#error "Unexpected off_t size."
 #endif
 
 #endif
diff --git a/src/libsyn123/syn123.h b/src/libsyn123/syn123.h
index a1e48f0..bbdad2e 100644
--- a/src/libsyn123/syn123.h
+++ b/src/libsyn123/syn123.h
@@ -25,7 +25,7 @@
  */
 #define SYN123_API_VERSION 2
 /** library patch level at client build time */
-#define SYN123_PATCHLEVEL  1
+#define SYN123_PATCHLEVEL  2
 
 #ifndef MPG123_EXPORT
 /** Defines needed for MS Visual Studio(tm) DLL builds.
diff --git a/src/version.h b/src/version.h
index 312db98..8a24747 100644
--- a/src/version.h
+++ b/src/version.h
@@ -16,7 +16,7 @@
 // only single spaces as separator to ease parsing by build scripts
 #define MPG123_MAJOR 1
 #define MPG123_MINOR 32
-#define MPG123_PATCH 2
+#define MPG123_PATCH 3
 // Don't get too wild with that to avoid confusing m4. No brackets.
 // Also, it should fit well into a sane file name for the tarball.
 #define MPG123_SUFFIX ""