On 2020-06-26 15:46:59 +0200, Thomas Orgis wrote: > OK, > > I introduced the additional wrapper now with svn commit 4743 on > svn://scm.orgis.org/mpg123 . > > You can test by using current https://mpg123.org/snapshot or by > applying the attached patch. > > Test reports before I release (this weekend?) are welcome. > > > Alrighty then, > > Thomas
> Index: NEWS
> ===================================================================
> --- NEWS (revisión: 4742)
> +++ NEWS (revisión: 4743)
> @@ -10,6 +10,8 @@
> - More CMake build fixes thanks to David Callu (bug 290).
> - Use PROG_LIBS for output modules, to reinstate not necessarily proper but
> previous behaviour and fix FreeBSD port build (bug 291).
> +- Refine LFS support in libsyn123, avoiding architecture-dependent syn123.h
> + (debian bug 963205).
>
> 1.26.1
> ------
> Index: src/libsyn123/resample.c
> ===================================================================
> --- src/libsyn123/resample.c (revisión: 4742)
> +++ src/libsyn123/resample.c (revisión: 4743)
> @@ -1899,15 +1899,25 @@
> return (tot <= INT64_MAX) ? (int64_t)tot : SYN123_OVERFLOW;
> }
>
> -#if SIZEOF_LONG == 4
> -long attribute_align_arg
> -syn123_resample_total_32(long inrate, long outrate, long ins)
> +int32_t attribute_align_arg
> +syn123_resample_total_32(int32_t inrate, int32_t outrate, int32_t ins)
> {
> int64_t tot = syn123_resample_total_64(inrate, outrate, ins);
> - return (tot <= LONG_MAX) ? (long)tot : SYN123_OVERFLOW;
> + return (tot <= INT32_MAX) ? (int32_t)tot : SYN123_OVERFLOW;
> }
> +
> +lfs_alias_t syn123_resample_total(long inrate, long outrate, lfs_alias_t ins)
> +{
> +#if LFS_ALIAS_BITS+0 == 64
> + return syn123_resample_total_64(inrate, outrate, ins);
> +#elif LFS_ALIAS_BITS+0 == 32
> + return syn123_resample_total_32(inrate, outrate, ins);
> +#else
> + #error "Unexpected LFS_ALIAS_BITS value."
> #endif
> +}
>
> +
> // The inverse function: How many input samples are needed to get at least
> // the desired amount of output?
> int64_t attribute_align_arg
> @@ -1959,17 +1969,24 @@
> return (tot <= INT64_MAX) ? (int64_t)tot : SYN123_OVERFLOW;
> }
>
> -#if SIZEOF_LONG == 4
> -long attribute_align_arg
> -syn123_resample_intotal_32(long inrate, long outrate, long outs)
> +int32_t attribute_align_arg
> +syn123_resample_intotal_32(int32_t inrate, int32_t outrate, int32_t outs)
> {
> int64_t tot = syn123_resample_intotal_64(inrate, outrate, outs);
> - return (tot <= LONG_MAX) ? (long)tot : SYN123_OVERFLOW;
> + return (tot <= INT32_MAX) ? (int32_t)tot : SYN123_OVERFLOW;
> }
> +
> +lfs_alias_t syn123_resample_intotal(long inrate, long outrate, lfs_alias_t
> outs)
> +{
> +#if LFS_ALIAS_BITS+0 == 64
> + return syn123_resample_intotal_64(inrate, outrate, outs);
> +#elif LFS_ALIAS_BITS+0 == 32
> + return syn123_resample_intotal_32(inrate, outrate, outs);
> +#else
> + #error "Unexpected LFS_ALIAS_BITS value."
> #endif
> +}
>
> -#define syn123_resample_total syn123_resample_total_64
> -
> // As any sensible return value is at least 1, this uses the unsigned
> // type and 0 for error/pathological input.
> // This function could be simplified to
> Index: src/libsyn123/syn123.h.in
> ===================================================================
> --- src/libsyn123/syn123.h.in (revisión: 4742)
> +++ src/libsyn123/syn123.h.in (revisión: 4743)
> @@ -977,9 +977,6 @@
> # else
> # error "Unpredicted _FILE_OFFSET_BITS value."
> # endif
> -#else
> -# define syn123_resample_total syn123_resample_total_@LFS_ALIAS_BITS@
> -# define syn123_resample_intotal syn123_resample_intotal_@LFS_ALIAS_BITS@
> #endif
>
> /** Give exact output sample count for total input sample count.
Unfortunately the patch fails to build on i386:
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./src
-DPKGLIBDIR=\"/usr/lib/i386-linux-gnu/mpg123\" -I./src -I./src/compat
-I./src/libmpg123 -I./src/libout123 -I./src/libmpg123 -I./src/libsyn123
-I./src/libout123 -DOPT_MULTI -DOPT_GENERIC -DOPT_GENERIC_DITHER -DOPT_I386
-DOPT_I586 -DOPT_I586_DITHER -DOPT_MMX -DOPT_3DNOW -DOPT_3DNOW_VINTAGE
-DOPT_3DNOWEXT -DOPT_3DNOWEXT_VINTAGE -DOPT_SSE -DOPT_SSE_VINTAGE
-DREAL_IS_FLOAT -DNEWOLD_WRITE_SAMPLE -Wdate-time -D_FORTIFY_SOURCE=2 -O2
-fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math -g -O2
-fdebug-prefix-map=/<<PKGBUILDDIR>>=. -fstack-protector-strong -Wformat
-Werror=format-security -c src/libsyn123/resample.c -fPIC -DPIC -o
src/libsyn123/.libs/resample.o
In file included from src/libsyn123/syn123_int.h:20,
from src/libsyn123/resample.c:84:
src/libsyn123/syn123.h:975:37: error: conflicting types for
‘syn123_resample_total_64’
975 | # define syn123_resample_total syn123_resample_total_64
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/libsyn123/resample.c:1909:13: note: in expansion of macro
‘syn123_resample_total’
1909 | lfs_alias_t syn123_resample_total(long inrate, long outrate,
lfs_alias_t ins)
| ^~~~~~~~~~~~~~~~~~~~~
src/libsyn123/resample.c:1855:1: note: previous definition of
‘syn123_resample_total_64’ was here
1855 | syn123_resample_total_64(long inrate, long outrate, int64_t ins)
| ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from src/libsyn123/syn123_int.h:20,
from src/libsyn123/resample.c:84:
src/libsyn123/syn123.h:976:37: error: conflicting types for
‘syn123_resample_intotal_64’
976 | # define syn123_resample_intotal syn123_resample_intotal_64
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/libsyn123/resample.c:1979:13: note: in expansion of macro
‘syn123_resample_intotal’
1979 | lfs_alias_t syn123_resample_intotal(long inrate, long outrate,
lfs_alias_t outs)
| ^~~~~~~~~~~~~~~~~~~~~~~
src/libsyn123/resample.c:1924:1: note: previous definition of
‘syn123_resample_intotal_64’ was here
1924 | syn123_resample_intotal_64(long inrate, long outrate, int64_t outs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
make[1]: *** [Makefile:3849: src/libsyn123/resample.lo] Error 1
Cheers
--
Sebastian Ramacher
signature.asc
Description: PGP signature

