From: <sv...@op...> - 2024-10-28 14:00:30
|
Author: manx Date: Mon Oct 28 15:00:22 2024 New Revision: 22007 URL: https://source.openmpt.org/browse/openmpt/?op=revision&rev=22007 Log: [Var] mpg123: Update to 1.32.9-dev+r5448 (2024-10-28). Modified: trunk/OpenMPT/include/mpg123/OpenMPT.txt trunk/OpenMPT/include/mpg123/src/compat/compat.c trunk/OpenMPT/include/mpg123/src/compat/compat.h trunk/OpenMPT/include/mpg123/src/include/mpg123.h trunk/OpenMPT/include/mpg123/src/libmpg123/lfs_wrap.c trunk/OpenMPT/include/mpg123/src/version.h Modified: trunk/OpenMPT/include/mpg123/OpenMPT.txt ============================================================================== --- trunk/OpenMPT/include/mpg123/OpenMPT.txt Mon Oct 28 14:56:27 2024 (r22006) +++ trunk/OpenMPT/include/mpg123/OpenMPT.txt Mon Oct 28 15:00:22 2024 (r22007) @@ -1,4 +1,4 @@ -libmpg123 library version 1.32.8 (2024-10-26). +libmpg123 library version 1.32.9-dev+r5448 (2024-10-28). The following changes have been made: * `ports/makefile/config.h` has been added for plain `Makefile` builds. * `ports/MSVC++/config.h` has been added for MSVC builds. @@ -6,9 +6,6 @@ * `ports/Xcode/config.h` has been modified to let the build system set `OPT_*`. * `ports/Xcode/config.h` has been modified to `#define HAVE_DIRENT_H`. - * `src/libmpg123/lfs_wrap.c` has been modified to work-around - <https://sourceforge.net/p/mpg123/bugs/373/> ("weird LNK4286 warning when - building against ARM64EC UCRT for lseek"). * Modifications are marked by `// OpenMPT` or `/* OpenMPT */`. * Obviously, unnecessary folders and files have been removed. * For building, premake is used to generate Visual Studio project files. Modified: trunk/OpenMPT/include/mpg123/src/compat/compat.c ============================================================================== --- trunk/OpenMPT/include/mpg123/src/compat/compat.c Mon Oct 28 14:56:27 2024 (r22006) +++ trunk/OpenMPT/include/mpg123/src/compat/compat.c Mon Oct 28 15:00:22 2024 (r22007) @@ -88,7 +88,7 @@ open_fallback: #endif -#if (defined(WIN32) && !defined (__CYGWIN__)) +#if defined(MPG123_COMPAT_MSVCRT_IO) /* MSDN says POSIX function is deprecated beginning in Visual C++ 2005 */ /* Try plain old _open(), if it fails, do nothing */ ret = _open(filename, flags|_O_BINARY, _S_IREAD | _S_IWRITE); @@ -138,12 +138,16 @@ FILE* INT123_compat_fdopen(int fd, const char *mode) { +#if defined(MPG123_COMPAT_MSVCRT_IO) + return _fdopen(fd, mode); +#else return fdopen(fd, mode); +#endif } int INT123_compat_close(int infd) { -#if (defined(WIN32) && !defined (__CYGWIN__)) /* MSDN says POSIX function is deprecated beginning in Visual C++ 2005 */ +#if defined(MPG123_COMPAT_MSVCRT_IO) return _close(infd); #else return close(infd); Modified: trunk/OpenMPT/include/mpg123/src/compat/compat.h ============================================================================== --- trunk/OpenMPT/include/mpg123/src/compat/compat.h Mon Oct 28 14:56:27 2024 (r22006) +++ trunk/OpenMPT/include/mpg123/src/compat/compat.h Mon Oct 28 15:00:22 2024 (r22007) @@ -110,7 +110,35 @@ typedef unsigned char byte; +#if (defined(_UCRT) || defined(_MSC_VER) || (defined(__MINGW32__) || defined(__MINGW64__))) && !defined(__CYGWIN__) +#define MPG123_COMPAT_MSVCRT_IO +#endif + +#if defined(MPG123_COMPAT_MSVCRT_IO) +#if defined(_UCRT) +// needs to get checked separately from MSVC and MinGW becuase it is also used by native Clang on Windows +#ifndef MPG123_COMPAT_MSVCRT_IO_64 +#define MPG123_COMPAT_MSVCRT_IO_64 +#endif +#endif #if defined(_MSC_VER) +#if (_MSC_VER >= 1200) +// >= VC6 +#ifndef MPG123_COMPAT_MSVCRT_IO_64 +#define MPG123_COMPAT_MSVCRT_IO_64 +#endif +#endif +#endif +#if defined(__MINGW32__) || defined(__MINGW64__) +#if (defined(__MSVCRT__) || defined(_UCRT)) && !defined(__CRTDLL__) +#ifndef MPG123_COMPAT_MSVCRT_IO_64 +#define MPG123_COMPAT_MSVCRT_IO_64 +#endif +#endif +#endif +#endif + +#if defined(HAVE__SETMODE) || defined(HAVE_SETMODE) || defined(MPG123_COMPAT_MSVCRT_IO) // For _setmode(), at least. #include <io.h> #endif Modified: trunk/OpenMPT/include/mpg123/src/include/mpg123.h ============================================================================== --- trunk/OpenMPT/include/mpg123/src/include/mpg123.h Mon Oct 28 14:56:27 2024 (r22006) +++ trunk/OpenMPT/include/mpg123/src/include/mpg123.h Mon Oct 28 15:00:22 2024 (r22007) @@ -19,7 +19,7 @@ */ #define MPG123_API_VERSION 48 /** library patch level at client build time */ -#define MPG123_PATCHLEVEL 2 +#define MPG123_PATCHLEVEL 3 #ifndef MPG123_EXPORT /** Defines needed for MS Visual Studio(tm) DLL builds. Modified: trunk/OpenMPT/include/mpg123/src/libmpg123/lfs_wrap.c ============================================================================== --- trunk/OpenMPT/include/mpg123/src/libmpg123/lfs_wrap.c Mon Oct 28 14:56:27 2024 (r22006) +++ trunk/OpenMPT/include/mpg123/src/libmpg123/lfs_wrap.c Mon Oct 28 15:00:22 2024 (r22007) @@ -137,7 +137,11 @@ if(ioh->my_fd >= 0) { mdebug("closing my fd %d", ioh->my_fd); +#if defined(MPG123_COMPAT_MSVCRT_IO) + _close(ioh->my_fd); +#else close(ioh->my_fd); +#endif ioh->my_fd = -1; } } @@ -699,6 +703,35 @@ return -1; } +// Defining a wrapper to the native read to be sure the prototype matches. +// There are platforms where it is read(int, void*, unsigned int). +// We know that we read small chunks where the difference does not matter. Could +// apply specific hackery, use a common compat_read() (INT123_unintr_read()?) with system +// specifics. +static mpg123_ssize_t fallback_read(int fd, void *buf, size_t count) +{ +#if defined(MPG123_COMPAT_MSVCRT_IO) + if(count > UINT_MAX) + { + errno = EOVERFLOW; + return -1; + } + return _read(fd, buf, (unsigned int)count); +#else + return read(fd, buf, count); +#endif +} + +static off_t fallback_lseek(int fd, off_t offset, int whence) +{ +#if defined(MPG123_COMPAT_MSVCRT_IO) + // Off_t is 32 bit and does fit into long. We know that. + return _lseek(fd, (long)offset, whence); +#else + return lseek(fd, offset, whence); +#endif +} + // This is assuming an internally opened file, which usually will be // using 64 bit offsets. It keeps reading on on trivial interruptions. // I guess any file descriptor that matches the libc should work fine. @@ -730,7 +763,7 @@ } #endif errno = 0; - ptrdiff_t part = read(fd, (char*)buf+got, bytes); + ptrdiff_t part = fallback_read(fd, (char*)buf+got, bytes); if(part > 0) // == 0 is end of file { SATURATE_SUB(bytes, part, 0) @@ -755,17 +788,15 @@ struct wrap_data* ioh = handle; #ifdef LFS_LARGEFILE_64 return lseek64(ioh->fd, offset, whence); +#elif defined(MPG123_COMPAT_MSVCRT_IO_64) + return _lseeki64(ioh->fd, offset, whence); #else if(offset < OFF_MIN || offset > OFF_MAX) { errno = EOVERFLOW; return -1; } -#if defined(_UCRT) /* OpenMPT */ - return _lseek(ioh->fd, (off_t)offset, whence); /* OpenMPT */ -#else /* OpenMPT */ - return lseek(ioh->fd, (off_t)offset, whence); -#endif /* OpenMPT */ + return fallback_lseek(ioh->fd, (off_t)offset, whence); #endif } @@ -865,16 +896,6 @@ // So, native off_t reader replacement. -// Defining a wrapper to the native read to be sure the prototype matches. -// There are platforms where it is read(int, void*, unsigned int). -// We know that we read small chunks where the difference does not matter. Could -// apply specific hackery, use a common compat_read() (INT123_unintr_read()?) with system -// specifics. -static mpg123_ssize_t fallback_read(int fd, void *buf, size_t count) -{ - return read(fd, buf, count); -} - // In forced 64 bit offset mode, the only definitions of these are // the _64 ones. #ifdef FORCED_OFF_64 @@ -906,11 +927,7 @@ ioh->iotype = IO_FD; ioh->fd = -1; /* On next mpg123_open_fd(), this gets a value. */ ioh->r_read = r_read != NULL ? r_read : fallback_read; -#if defined(_UCRT) /* OpenMPT */ - ioh->r_lseek = r_lseek != NULL ? r_lseek : _lseek; /* OpenMPT */ -#else /* OpenMPT */ - ioh->r_lseek = r_lseek != NULL ? r_lseek : lseek; -#endif /* OpenMPT */ + ioh->r_lseek = r_lseek != NULL ? r_lseek : fallback_lseek; } /* The real reader replacement will happen while opening. */ Modified: trunk/OpenMPT/include/mpg123/src/version.h ============================================================================== --- trunk/OpenMPT/include/mpg123/src/version.h Mon Oct 28 14:56:27 2024 (r22006) +++ trunk/OpenMPT/include/mpg123/src/version.h Mon Oct 28 15:00:22 2024 (r22007) @@ -16,10 +16,10 @@ // only single spaces as separator to ease parsing by build scripts #define MPG123_MAJOR 1 #define MPG123_MINOR 32 -#define MPG123_PATCH 8 +#define MPG123_PATCH 9 // 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 "" +#define MPG123_SUFFIX "-dev" #define MPG123_VERSION_CAT_REALLY(a, b, c) #a "." #b "." #c #define MPG123_VERSION_CAT(a, b, c) MPG123_VERSION_CAT_REALLY(a, b, c) |