File flac-visibility.patch of Package flac

Index: include/FLAC/export.h
===================================================================
--- include/FLAC/export.h.orig
+++ include/FLAC/export.h
@@ -56,7 +56,7 @@
  */
 
 #if defined(FLAC__NO_DLL) || !defined(_MSC_VER)
-#define FLAC_API
+#define FLAC_API __attribute__ ((visibility ("default")))
 
 #else
 
Index: include/FLAC++/export.h
===================================================================
--- include/FLAC++/export.h.orig
+++ include/FLAC++/export.h
@@ -56,7 +56,7 @@
  */
 
 #if defined(FLAC__NO_DLL) || !defined(_MSC_VER)
-#define FLACPP_API
+#define FLACPP_API __attribute__ ((visibility ("default")))
 
 #else
 
Index: src/libFLAC/Makefile.am
===================================================================
--- src/libFLAC/Makefile.am.orig
+++ src/libFLAC/Makefile.am
@@ -68,7 +68,7 @@ endif
 endif
 endif
 endif
-
+libFLAC_la_CFLAGS = -fvisibility=hidden
 libFLAC_la_LIBADD = $(LOCAL_EXTRA_LIBADD) @OGG_LIBS@
 
 SUBDIRS = $(ARCH_SUBDIRS) include .
@@ -96,7 +96,7 @@ extra_ogg_sources = \
 	ogg_mapping.c
 endif
 # see 'http://www.gnu.org/software/libtool/manual.html#Libtool-versioning' for numbering convention
-libFLAC_la_LDFLAGS = -version-info 10:0:2 -lm $(LOCAL_EXTRA_LDFLAGS)
+libFLAC_la_LDFLAGS = -Wl,-Bsymbolic-functions -no-undefined -version-info 10:0:2 -lm $(LOCAL_EXTRA_LDFLAGS)
 libFLAC_la_SOURCES = \
 	bitmath.c \
 	bitreader.c \
Index: src/libFLAC++/Makefile.am
===================================================================
--- src/libFLAC++/Makefile.am.orig
+++ src/libFLAC++/Makefile.am
@@ -45,8 +45,9 @@ EXTRA_DIST = \
 	libFLAC++_static.vcproj \
 	libFLAC++.m4
 
+libFLAC___la_CXXFLAGS= -fvisibility=hidden -fvisibility-inlines-hidden 
 # see 'http://www.gnu.org/software/libtool/manual.html#Libtool-versioning' for numbering convention
-libFLAC___la_LDFLAGS = -version-info 8:0:2
+libFLAC___la_LDFLAGS = -Wl,-Bsymbolic-functions -no-undefined -version-info 8:0:2
 libFLAC___la_LIBADD = ../libFLAC/libFLAC.la
 
 libFLAC___la_SOURCES = \
Index: configure.in
===================================================================
--- configure.in.orig
+++ configure.in
@@ -18,7 +18,8 @@
 # NOTE that for many of the AM_CONDITIONALs we use the prefix FLaC__
 # instead of FLAC__ since autoconf triggers off 'AC_' in strings
 
-AC_INIT(src/flac/main.c)
+AC_INIT
+AC_CONFIG_SRCDIR([src/flac/main.c])
 AM_INIT_AUTOMAKE(flac, 1.2.1)
 
 # Don't automagically regenerate autoconf/automake generated files unless
@@ -28,23 +29,24 @@ AM_MAINTAINER_MODE
 # We need two libtools, one that builds both shared and static, and
 # one that builds only static.  This is because the resulting libtool
 # does not allow us to choose which to build at runtime.
-AM_PROG_LIBTOOL
-sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-static
-chmod +x libtool-disable-static
+#AM_PROG_LIBTOOL
+#sed -e 's/^build_old_libs=yes/build_old_libs=no/' libtool > libtool-disable-static
+#chmod +x libtool-disable-static
 
 AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
 
 AM_PROG_AS
+AC_PROG_CC_STDC
 AC_PROG_CXX
 AC_PROG_MAKE_SET
-
+AC_USE_SYSTEM_EXTENSIONS
 AC_SYS_LARGEFILE
 AC_FUNC_FSEEKO
-
+LT_INIT([pic-only disable-static])
 AC_CHECK_SIZEOF(void*,0)
 
 #@@@ new name is AC_CONFIG_HEADERS
-AM_CONFIG_HEADER(config.h)
+AC_CONFIG_HEADERS([config.h])
 
 AC_C_BIGENDIAN
 
@@ -110,7 +112,7 @@ AC_DEFINE(FLAC__ALIGN_MALLOC_DATA)
 AH_TEMPLATE(FLAC__ALIGN_MALLOC_DATA, [define to align allocated memory on 32-byte boundaries])
 fi
 
-AC_ARG_ENABLE(asm-optimizations, AC_HELP_STRING([--disable-asm-optimizations], [Don't use any assembly optimization routines]), asm_opt=no, asm_opt=yes)
+AC_ARG_ENABLE(asm-optimizations, AS_HELP_STRING([--disable-asm-optimizations],[Don't use any assembly optimization routines]), asm_opt=no, asm_opt=yes)
 AM_CONDITIONAL(FLaC__NO_ASM, test "x$asm_opt" = xno)
 if test "x$asm_opt" = xno ; then
 AC_DEFINE(FLAC__NO_ASM)
@@ -118,7 +120,7 @@ AH_TEMPLATE(FLAC__NO_ASM, [define to dis
 fi
 
 AC_ARG_ENABLE(debug,
-AC_HELP_STRING([--enable-debug], [Turn on debugging]),
+AS_HELP_STRING([--enable-debug],[Turn on debugging]),
 [case "${enableval}" in
 	yes) debug=true ;;
 	no)  debug=false ;;
@@ -127,7 +129,7 @@ esac],[debug=false])
 AM_CONDITIONAL(DEBUG, test "x$debug" = xtrue)
 
 AC_ARG_ENABLE(sse,
-AC_HELP_STRING([--enable-sse], [Enable SSE support by asserting that the OS supports SSE instructions]),
+AS_HELP_STRING([--enable-sse],[Enable SSE support by asserting that the OS supports SSE instructions]),
 [case "${enableval}" in
 	yes) sse_os=true ;;
 	no)  sse_os=false ;;
@@ -140,7 +142,7 @@ AH_TEMPLATE(FLAC__SSE_OS, [define if you
 fi
 
 AC_ARG_ENABLE(3dnow,
-AC_HELP_STRING([--disable-3dnow], [Disable 3DNOW! optimizations]),
+AS_HELP_STRING([--disable-3dnow],[Disable 3DNOW! optimizations]),
 [case "${enableval}" in
 	yes) use_3dnow=true ;;
 	no)  use_3dnow=false ;;
@@ -153,7 +155,7 @@ AH_TEMPLATE(FLAC__USE_3DNOW, [define to
 fi
 
 AC_ARG_ENABLE(altivec,
-AC_HELP_STRING([--disable-altivec], [Disable Altivec optimizations]),
+AS_HELP_STRING([--disable-altivec],[Disable Altivec optimizations]),
 [case "${enableval}" in
 	yes) use_altivec=true ;;
 	no)  use_altivec=false ;;
@@ -166,14 +168,14 @@ AH_TEMPLATE(FLAC__USE_ALTIVEC, [define t
 fi
 
 AC_ARG_ENABLE(thorough-tests,
-AC_HELP_STRING([--disable-thorough-tests], [Disable thorough (long) testing, do only basic tests]),
+AS_HELP_STRING([--disable-thorough-tests],[Disable thorough (long) testing, do only basic tests]),
 [case "${enableval}" in
 	yes) thorough_tests=true ;;
 	no)  thorough_tests=false ;;
 	*) AC_MSG_ERROR(bad value ${enableval} for --enable-thorough-tests) ;;
 esac],[thorough_tests=true])
 AC_ARG_ENABLE(exhaustive-tests,
-AC_HELP_STRING([--enable-exhaustive-tests], [Enable exhaustive testing (VERY long)]),
+AS_HELP_STRING([--enable-exhaustive-tests],[Enable exhaustive testing (VERY long)]),
 [case "${enableval}" in
 	yes) exhaustive_tests=true ;;
 	no)  exhaustive_tests=false ;;
@@ -189,7 +191,7 @@ fi
 AC_SUBST(FLAC__TEST_LEVEL)
 
 AC_ARG_ENABLE(valgrind-testing,
-AC_HELP_STRING([--enable-valgrind-testing], [Run all tests inside Valgrind]),
+AS_HELP_STRING([--enable-valgrind-testing],[Run all tests inside Valgrind]),
 [case "${enableval}" in
 	yes) FLAC__TEST_WITH_VALGRIND=yes ;;
 	no)  FLAC__TEST_WITH_VALGRIND=no ;;
@@ -198,7 +200,7 @@ esac],[FLAC__TEST_WITH_VALGRIND=no])
 AC_SUBST(FLAC__TEST_WITH_VALGRIND)
 
 AC_ARG_ENABLE(doxygen-docs,
-AC_HELP_STRING([--disable-doxygen-docs], [Disable API documentation building via Doxygen]),
+AS_HELP_STRING([--disable-doxygen-docs],[Disable API documentation building via Doxygen]),
 [case "${enableval}" in
 	yes) enable_doxygen_docs=true ;;
 	no)  enable_doxygen_docs=false ;;
@@ -210,7 +212,7 @@ fi
 AM_CONDITIONAL(FLaC__HAS_DOXYGEN, test -n "$DOXYGEN")
 
 AC_ARG_ENABLE(local-xmms-plugin,
-AC_HELP_STRING([--enable-local-xmms-plugin], [Install XMMS plugin to ~/.xmms/Plugins instead of system location]),
+AS_HELP_STRING([--enable-local-xmms-plugin],[Install XMMS plugin to ~/.xmms/Plugins instead of system location]),
 [case "${enableval}" in
 	yes) install_xmms_plugin_locally=true ;;
 	no)  install_xmms_plugin_locally=false ;;
@@ -219,7 +221,7 @@ esac],[install_xmms_plugin_locally=false
 AM_CONDITIONAL(FLaC__INSTALL_XMMS_PLUGIN_LOCALLY, test "x$install_xmms_plugin_locally" = xtrue)
 
 AC_ARG_ENABLE(xmms-plugin,
-AC_HELP_STRING([--disable-xmms-plugin], [Do not build XMMS plugin]),
+AS_HELP_STRING([--disable-xmms-plugin],[Do not build XMMS plugin]),
 [case "${enableval}" in
 	yes) enable_xmms_plugin=true ;;
 	no)  enable_xmms_plugin=false ;;
@@ -232,7 +234,7 @@ AM_CONDITIONAL(FLaC__HAS_XMMS, test -n "
 
 dnl build FLAC++ or not
 AC_ARG_ENABLE([cpplibs],
-AC_HELP_STRING([--disable-cpplibs], [Do not build libFLAC++]),
+AS_HELP_STRING([--disable-cpplibs],[Do not build libFLAC++]),
 [case "${enableval}" in
 	yes) disable_cpplibs=false ;;
 	no)  disable_cpplibs=true ;;
@@ -242,7 +244,7 @@ AM_CONDITIONAL(FLaC__WITH_CPPLIBS, [test
 
 dnl check for ogg library
 AC_ARG_ENABLE([ogg],
-	AC_HELP_STRING([--disable-ogg], [Disable ogg support (default: test for libogg)]),
+	AS_HELP_STRING([--disable-ogg],[Disable ogg support (default: test for libogg)]),
 	[ want_ogg=$enableval ], [ want_ogg=yes ] )
 
 if test "x$want_ogg" != "xno"; then
@@ -300,8 +302,8 @@ if test "x$debug" = xtrue; then
 else
 	CPPFLAGS="-DNDEBUG $CPPFLAGS"
 	if test "x$GCC" = xyes; then
-		CPPFLAGS="-DFLaC__INLINE=__inline__ $CPPFLAGS"
-		CFLAGS="-O3 -funroll-loops -finline-functions -Wall -W -Winline $CFLAGS"
+		CPPFLAGS="-DFLaC__INLINE=__always_inline $CPPFLAGS"
+    CFLAGS="$CFLAGS"
 	fi
 fi
 
Index: Makefile.am
===================================================================
--- Makefile.am.orig
+++ Makefile.am
@@ -30,7 +30,7 @@
 
 AUTOMAKE_OPTIONS = foreign 1.7
 
-SUBDIRS = doc include m4 man src examples test build obj
+SUBDIRS = doc include m4 man src examples build obj
 
 DISTCLEANFILES = libtool-disable-static
 
Index: src/Makefile.am
===================================================================
--- src/Makefile.am.orig
+++ src/Makefile.am
@@ -20,7 +20,7 @@ XMMS_DIRS = plugin_common plugin_xmms
 endif
 
 if FLaC__WITH_CPPLIBS
-CPPLIBS_DIRS = libFLAC++ test_libFLAC++
+CPPLIBS_DIRS = libFLAC++
 endif
 
 SUBDIRS = \
@@ -31,11 +31,6 @@ SUBDIRS = \
 	monkeys_audio_utilities \
 	$(XMMS_DIRS) \
 	plugin_winamp2 \
-	test_grabbag \
-	test_libs_common \
-	test_libFLAC \
-	test_seeking \
-	test_streams \
 	$(CPPLIBS_DIRS)
 
 EXTRA_DIST = \
Index: include/share/alloc.h
===================================================================
--- include/share/alloc.h.orig
+++ include/share/alloc.h
@@ -48,10 +48,14 @@
 #define FLaC__INLINE
 #endif
 
+#define FLAC_ATTR_MALLOC __attribute__((__malloc__))
+#define FLAC_ATTR_ALLOC_SIZE(n) __attribute__((alloc_size(n)))
+#define FLAC_ATTR_ALLOC_SIZE2(x,y) __attribute__((alloc_size(x,y))) 
+
 /* avoid malloc()ing 0 bytes, see:
  * https://www.securecoding.cert.org/confluence/display/seccode/MEM04-A.+Do+not+make+assumptions+about+the+result+of+allocating+0+bytes?focusedCommentId=5407003
 */
-static FLaC__INLINE void *safe_malloc_(size_t size)
+static FLAC_ATTR_MALLOC FLAC_ATTR_ALLOC_SIZE(1) FLaC__INLINE void *safe_malloc_(size_t size)
 {
 	/* malloc(0) is undefined; FLAC src convention is to always allocate */
 	if(!size)
@@ -59,7 +63,7 @@ static FLaC__INLINE void *safe_malloc_(s
 	return malloc(size);
 }
 
-static FLaC__INLINE void *safe_calloc_(size_t nmemb, size_t size)
+static FLAC_ATTR_MALLOC FLAC_ATTR_ALLOC_SIZE2(1,2) FLaC__INLINE void *safe_calloc_(size_t nmemb, size_t size)
 {
 	if(!nmemb || !size)
 		return malloc(1); /* malloc(0) is undefined; FLAC src convention is to always allocate */
Index: src/libFLAC/include/private/bitreader.h
===================================================================
--- src/libFLAC/include/private/bitreader.h.orig
+++ src/libFLAC/include/private/bitreader.h
@@ -80,11 +80,11 @@ FLAC__bool FLAC__bitreader_skip_byte_blo
 FLAC__bool FLAC__bitreader_read_byte_block_aligned_no_crc(FLAC__BitReader *br, FLAC__byte *val, unsigned nvals); /* WATCHOUT: does not CRC the read data! */
 FLAC__bool FLAC__bitreader_read_unary_unsigned(FLAC__BitReader *br, unsigned *val);
 FLAC__bool FLAC__bitreader_read_rice_signed(FLAC__BitReader *br, int *val, unsigned parameter);
-FLAC__bool FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter);
+FLAC__bool __attribute__((__hot__)) FLAC__bitreader_read_rice_signed_block(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter);
 #ifndef FLAC__NO_ASM
 #  ifdef FLAC__CPU_IA32
 #    ifdef FLAC__HAS_NASM
-FLAC__bool FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter);
+FLAC__bool __attribute__((__hot__)) FLAC__bitreader_read_rice_signed_block_asm_ia32_bswap(FLAC__BitReader *br, int vals[], unsigned nvals, unsigned parameter);
 #    endif
 #  endif
 #endif
Index: src/libFLAC/include/private/lpc.h
===================================================================
--- src/libFLAC/include/private/lpc.h.orig
+++ src/libFLAC/include/private/lpc.h
@@ -165,17 +165,17 @@ void FLAC__lpc_compute_residual_from_qlp
  *	IN  data[-order,-1]        previously-reconstructed historical samples
  *	OUT data[0,data_len-1]     original signal
  */
-void FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
-void FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+void __attribute__((__hot__)) FLAC__lpc_restore_signal(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+void __attribute__((__hot__)) FLAC__lpc_restore_signal_wide(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
 #ifndef FLAC__NO_ASM
 #  ifdef FLAC__CPU_IA32
 #    ifdef FLAC__HAS_NASM
-void FLAC__lpc_restore_signal_asm_ia32(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
-void FLAC__lpc_restore_signal_asm_ia32_mmx(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+void __attribute__((__hot__)) FLAC__lpc_restore_signal_asm_ia32(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+void __attribute__((__hot__)) FLAC__lpc_restore_signal_asm_ia32_mmx(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
 #    endif /* FLAC__HAS_NASM */
 #  elif defined FLAC__CPU_PPC
-void FLAC__lpc_restore_signal_asm_ppc_altivec_16(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
-void FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+void __attribute__((__hot__)) FLAC__lpc_restore_signal_asm_ppc_altivec_16(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
+void __attribute__((__hot__)) FLAC__lpc_restore_signal_asm_ppc_altivec_16_order8(const FLAC__int32 residual[], unsigned data_len, const FLAC__int32 qlp_coeff[], unsigned order, int lp_quantization, FLAC__int32 data[]);
 #  endif/* FLAC__CPU_IA32 || FLAC__CPU_PPC */
 #endif /* FLAC__NO_ASM */
 
openSUSE Build Service is sponsored by