Accepting request 292127 from multimedia:libs
1 OBS-URL: https://build.opensuse.org/request/show/292127 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/flac?expand=0&rev=48
This commit is contained in:
commit
52e1063a94
@ -1,421 +0,0 @@
|
||||
From 4022b72d8f71110a6e4bc0e32cb59cb7c5b5b25e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org>
|
||||
Date: Sun, 26 May 2013 05:35:30 +0200
|
||||
Subject: [PATCH] Allow use of openSSL
|
||||
|
||||
|
||||
---
|
||||
configure.ac | 3
|
||||
m4/ax_check_openssl.m4 | 124 ++++++++++++++++++++++++++++++++++++++
|
||||
src/libFLAC/Makefile.am | 4 -
|
||||
src/libFLAC/include/private/md5.h | 8 ++
|
||||
src/libFLAC/md5.c | 38 +++++++++++
|
||||
src/libFLAC/stream_decoder.c | 30 +++++++--
|
||||
src/libFLAC/stream_encoder.c | 30 +++++++--
|
||||
7 files changed, 221 insertions(+), 16 deletions(-)
|
||||
|
||||
Index: flac-1.3.0/configure.ac
|
||||
===================================================================
|
||||
--- flac-1.3.0.orig/configure.ac
|
||||
+++ flac-1.3.0/configure.ac
|
||||
@@ -59,6 +59,7 @@ AC_C_INLINE
|
||||
AC_C_VARARRAYS
|
||||
AC_C_TYPEOF
|
||||
|
||||
+AC_FUNC_ALLOCA
|
||||
AC_CHECK_HEADERS([stdint.h inttypes.h byteswap.h sys/param.h termios.h])
|
||||
|
||||
AC_HEADER_TIOCGWINSZ
|
||||
@@ -88,6 +89,8 @@ dnl check for getopt in standard library
|
||||
dnl AC_CHECK_FUNCS(getopt_long , , [LIBOBJS="$LIBOBJS getopt.o getopt1.o"] )
|
||||
AC_CHECK_FUNCS(getopt_long, [], [])
|
||||
|
||||
+AX_CHECK_OPENSSL([AC_DEFINE([HAVE_OPENSSL], [1], [We have openSSL])])
|
||||
+
|
||||
case "$host_cpu" in
|
||||
i*86)
|
||||
cpu_ia32=true
|
||||
Index: flac-1.3.0/m4/ax_check_openssl.m4
|
||||
===================================================================
|
||||
--- /dev/null
|
||||
+++ flac-1.3.0/m4/ax_check_openssl.m4
|
||||
@@ -0,0 +1,124 @@
|
||||
+# ===========================================================================
|
||||
+# http://www.gnu.org/software/autoconf-archive/ax_check_openssl.html
|
||||
+# ===========================================================================
|
||||
+#
|
||||
+# SYNOPSIS
|
||||
+#
|
||||
+# AX_CHECK_OPENSSL([action-if-found[, action-if-not-found]])
|
||||
+#
|
||||
+# DESCRIPTION
|
||||
+#
|
||||
+# Look for OpenSSL in a number of default spots, or in a user-selected
|
||||
+# spot (via --with-openssl). Sets
|
||||
+#
|
||||
+# OPENSSL_INCLUDES to the include directives required
|
||||
+# OPENSSL_LIBS to the -l directives required
|
||||
+# OPENSSL_LDFLAGS to the -L or -R flags required
|
||||
+#
|
||||
+# and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
|
||||
+#
|
||||
+# This macro sets OPENSSL_INCLUDES such that source files should use the
|
||||
+# openssl/ directory in include directives:
|
||||
+#
|
||||
+# #include <openssl/hmac.h>
|
||||
+#
|
||||
+# LICENSE
|
||||
+#
|
||||
+# Copyright (c) 2009,2010 Zmanda Inc. <http://www.zmanda.com/>
|
||||
+# Copyright (c) 2009,2010 Dustin J. Mitchell <dustin@zmanda.com>
|
||||
+#
|
||||
+# Copying and distribution of this file, with or without modification, are
|
||||
+# permitted in any medium without royalty provided the copyright notice
|
||||
+# and this notice are preserved. This file is offered as-is, without any
|
||||
+# warranty.
|
||||
+
|
||||
+#serial 8
|
||||
+
|
||||
+AU_ALIAS([CHECK_SSL], [AX_CHECK_OPENSSL])
|
||||
+AC_DEFUN([AX_CHECK_OPENSSL], [
|
||||
+ found=false
|
||||
+ AC_ARG_WITH([openssl],
|
||||
+ [AS_HELP_STRING([--with-openssl=DIR],
|
||||
+ [root of the OpenSSL directory])],
|
||||
+ [
|
||||
+ case "$withval" in
|
||||
+ "" | y | ye | yes | n | no)
|
||||
+ AC_MSG_ERROR([Invalid --with-openssl value])
|
||||
+ ;;
|
||||
+ *) ssldirs="$withval"
|
||||
+ ;;
|
||||
+ esac
|
||||
+ ], [
|
||||
+ # if pkg-config is installed and openssl has installed a .pc file,
|
||||
+ # then use that information and don't search ssldirs
|
||||
+ AC_PATH_PROG([PKG_CONFIG], [pkg-config])
|
||||
+ if test x"$PKG_CONFIG" != x""; then
|
||||
+ OPENSSL_LDFLAGS=`$PKG_CONFIG openssl --libs-only-L 2>/dev/null`
|
||||
+ if test $? = 0; then
|
||||
+ OPENSSL_LIBS=`$PKG_CONFIG openssl --libs-only-l 2>/dev/null`
|
||||
+ OPENSSL_INCLUDES=`$PKG_CONFIG openssl --cflags-only-I 2>/dev/null`
|
||||
+ found=true
|
||||
+ fi
|
||||
+ fi
|
||||
+
|
||||
+ # no such luck; use some default ssldirs
|
||||
+ if ! $found; then
|
||||
+ ssldirs="/usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr"
|
||||
+ fi
|
||||
+ ]
|
||||
+ )
|
||||
+
|
||||
+
|
||||
+ # note that we #include <openssl/foo.h>, so the OpenSSL headers have to be in
|
||||
+ # an 'openssl' subdirectory
|
||||
+
|
||||
+ if ! $found; then
|
||||
+ OPENSSL_INCLUDES=
|
||||
+ for ssldir in $ssldirs; do
|
||||
+ AC_MSG_CHECKING([for openssl/ssl.h in $ssldir])
|
||||
+ if test -f "$ssldir/include/openssl/ssl.h"; then
|
||||
+ OPENSSL_INCLUDES="-I$ssldir/include"
|
||||
+ OPENSSL_LDFLAGS="-L$ssldir/lib"
|
||||
+ OPENSSL_LIBS="-lssl -lcrypto"
|
||||
+ found=true
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+ break
|
||||
+ else
|
||||
+ AC_MSG_RESULT([no])
|
||||
+ fi
|
||||
+ done
|
||||
+
|
||||
+ # if the file wasn't found, well, go ahead and try the link anyway -- maybe
|
||||
+ # it will just work!
|
||||
+ fi
|
||||
+
|
||||
+ # try the preprocessor and linker with our new flags,
|
||||
+ # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
|
||||
+
|
||||
+ AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
|
||||
+ echo "Trying link with OPENSSL_LDFLAGS=$OPENSSL_LDFLAGS;" \
|
||||
+ "OPENSSL_LIBS=$OPENSSL_LIBS; OPENSSL_INCLUDES=$OPENSSL_INCLUDES" >&AS_MESSAGE_LOG_FD
|
||||
+
|
||||
+ save_LIBS="$LIBS"
|
||||
+ save_LDFLAGS="$LDFLAGS"
|
||||
+ save_CPPFLAGS="$CPPFLAGS"
|
||||
+ LDFLAGS="$LDFLAGS $OPENSSL_LDFLAGS"
|
||||
+ LIBS="$OPENSSL_LIBS $LIBS"
|
||||
+ CPPFLAGS="$OPENSSL_INCLUDES $CPPFLAGS"
|
||||
+ AC_LINK_IFELSE(
|
||||
+ [AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],
|
||||
+ [
|
||||
+ AC_MSG_RESULT([yes])
|
||||
+ $1
|
||||
+ ], [
|
||||
+ AC_MSG_RESULT([no])
|
||||
+ $2
|
||||
+ ])
|
||||
+ CPPFLAGS="$save_CPPFLAGS"
|
||||
+ LDFLAGS="$save_LDFLAGS"
|
||||
+ LIBS="$save_LIBS"
|
||||
+
|
||||
+ AC_SUBST([OPENSSL_INCLUDES])
|
||||
+ AC_SUBST([OPENSSL_LIBS])
|
||||
+ AC_SUBST([OPENSSL_LDFLAGS])
|
||||
+])
|
||||
Index: flac-1.3.0/src/libFLAC/Makefile.am
|
||||
===================================================================
|
||||
--- flac-1.3.0.orig/src/libFLAC/Makefile.am
|
||||
+++ flac-1.3.0/src/libFLAC/Makefile.am
|
||||
@@ -87,7 +87,7 @@ if OS_IS_WINDOWS
|
||||
win_utf8_lib = $(top_builddir)/src/share/win_utf8_io/libwin_utf8_io.la
|
||||
endif
|
||||
|
||||
-libFLAC_la_LIBADD = $(win_utf8_lib) $(LOCAL_EXTRA_LIBADD) @OGG_LIBS@ -lm
|
||||
+libFLAC_la_LIBADD = $(win_utf8_lib) $(LOCAL_EXTRA_LIBADD) @OPENSSL_LIBS@ @OGG_LIBS@ -lm
|
||||
|
||||
SUBDIRS = $(ARCH_SUBDIRS) include .
|
||||
|
||||
@@ -138,5 +138,5 @@ libFLAC_sources = \
|
||||
libFLAC_la_SOURCES = $(libFLAC_sources)
|
||||
|
||||
# needed for test_libFLAC
|
||||
-libFLAC_static_la_LIBADD = $(LOCAL_EXTRA_LIBADD)
|
||||
+libFLAC_static_la_LIBADD = $(LOCAL_EXTRA_LIBADD) $(OPENSSL_LIBS)
|
||||
libFLAC_static_la_SOURCES = $(libFLAC_sources)
|
||||
Index: flac-1.3.0/src/libFLAC/include/private/md5.h
|
||||
===================================================================
|
||||
--- flac-1.3.0.orig/src/libFLAC/include/private/md5.h
|
||||
+++ flac-1.3.0/src/libFLAC/include/private/md5.h
|
||||
@@ -28,6 +28,11 @@
|
||||
|
||||
#include "FLAC/ordinals.h"
|
||||
|
||||
+#if defined(HAVE_OPENSSL)
|
||||
+#include <openssl/evp.h>
|
||||
+#define FLAC__MD5Context EVP_MD_CTX
|
||||
+#else
|
||||
+#define EVP_MAX_MD_SIZE 16
|
||||
typedef struct {
|
||||
FLAC__uint32 in[16];
|
||||
FLAC__uint32 buf[4];
|
||||
@@ -37,7 +42,8 @@ typedef struct {
|
||||
} FLAC__MD5Context;
|
||||
|
||||
void FLAC__MD5Init(FLAC__MD5Context *context);
|
||||
-void FLAC__MD5Final(FLAC__byte digest[16], FLAC__MD5Context *context);
|
||||
+void FLAC__MD5Final(FLAC__byte digest[EVP_MAX_MD_SIZE], FLAC__MD5Context *context);
|
||||
+#endif
|
||||
|
||||
FLAC__bool FLAC__MD5Accumulate(FLAC__MD5Context *ctx, const FLAC__int32 * const signal[], unsigned channels, unsigned samples, unsigned bytes_per_sample);
|
||||
|
||||
Index: flac-1.3.0/src/libFLAC/md5.c
|
||||
===================================================================
|
||||
--- flac-1.3.0.orig/src/libFLAC/md5.c
|
||||
+++ flac-1.3.0/src/libFLAC/md5.c
|
||||
@@ -5,6 +5,19 @@
|
||||
#include <stdlib.h> /* for malloc() */
|
||||
#include <string.h> /* for memcpy() */
|
||||
|
||||
+#ifdef HAVE_ALLOCA_H
|
||||
+# include <alloca.h>
|
||||
+#elif !defined alloca
|
||||
+# ifdef __GNUC__
|
||||
+# define alloca __builtin_alloca
|
||||
+# elif defined _AIX
|
||||
+# define alloca __alloca
|
||||
+# elif defined _MSC_VER
|
||||
+# include <malloc.h>
|
||||
+# define alloca _alloca
|
||||
+# endif
|
||||
+#endif
|
||||
+
|
||||
#include "private/md5.h"
|
||||
#include "share/alloc.h"
|
||||
|
||||
@@ -35,6 +48,7 @@
|
||||
|
||||
/* The four core functions - F1 is optimized somewhat */
|
||||
|
||||
+#if !defined(HAVE_OPENSSL)
|
||||
/* #define F1(x, y, z) (x & y | ~x & z) */
|
||||
#define F1(x, y, z) (z ^ (x & (y ^ z)))
|
||||
#define F2(x, y, z) F1(z, x, y)
|
||||
@@ -267,6 +281,8 @@ void FLAC__MD5Final(FLAC__byte digest[16
|
||||
memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
|
||||
}
|
||||
|
||||
+#endif /* !defined(HAVE_OPENSSL) */
|
||||
+
|
||||
/*
|
||||
* Convert the incoming audio signal to a byte stream
|
||||
*/
|
||||
@@ -401,6 +417,26 @@ FLAC__bool FLAC__MD5Accumulate(FLAC__MD5
|
||||
if((size_t)channels * (size_t)bytes_per_sample > SIZE_MAX / (size_t)samples)
|
||||
return false;
|
||||
|
||||
+#if defined(HAVE_OPENSSL)
|
||||
+ /* Use stack for the most common cases, heap when bytes_needed is larger than 4032 (unlikely)
|
||||
+ * Note that this is a _very_ conservative estimation.
|
||||
+ */
|
||||
+#if defined(_MSC_VER)
|
||||
+/* see http://msdn.microsoft.com/en-us/library/5471dc8s(v=vs.80).aspx for the rationale */
|
||||
+ FLAC__byte *tmp = _malloca(bytes_needed);
|
||||
+#else
|
||||
+ const FLAC__bool usealloca = (bytes_needed < 4032);
|
||||
+ FLAC__byte *tmp = usealloca ? alloca(bytes_needed) : safe_malloc_(bytes_needed);
|
||||
+#endif
|
||||
+ format_input_(tmp, signal, channels, samples, bytes_per_sample);
|
||||
+ const FLAC__bool retval = (EVP_DigestUpdate(ctx, tmp , bytes_needed) == 1);
|
||||
+#if defined(_MSC_VER)
|
||||
+ _freea(tmp)
|
||||
+#else
|
||||
+ if(!usealloca) free(tmp);
|
||||
+#endif
|
||||
+ return retval;
|
||||
+#else
|
||||
if(ctx->capacity < bytes_needed) {
|
||||
FLAC__byte *tmp = realloc(ctx->internal_buf, bytes_needed);
|
||||
if(0 == tmp) {
|
||||
@@ -418,4 +454,6 @@ FLAC__bool FLAC__MD5Accumulate(FLAC__MD5
|
||||
FLAC__MD5Update(ctx, ctx->internal_buf, bytes_needed);
|
||||
|
||||
return true;
|
||||
+#endif
|
||||
+
|
||||
}
|
||||
Index: flac-1.3.0/src/libFLAC/stream_decoder.c
|
||||
===================================================================
|
||||
--- flac-1.3.0.orig/src/libFLAC/stream_decoder.c
|
||||
+++ flac-1.3.0/src/libFLAC/stream_decoder.c
|
||||
@@ -171,7 +171,7 @@ typedef struct FLAC__StreamDecoderPrivat
|
||||
FLAC__bool internal_reset_hack; /* used only during init() so we can call reset to set up the decoder without rewinding the input */
|
||||
FLAC__bool is_seeking;
|
||||
FLAC__MD5Context md5context;
|
||||
- FLAC__byte computed_md5sum[16]; /* this is the sum we computed from the decoded data */
|
||||
+ FLAC__byte computed_md5sum[EVP_MAX_MD_SIZE]; /* this is the sum we computed from the decoded data */
|
||||
/* (the rest of these are only used for seeking) */
|
||||
FLAC__Frame last_frame; /* holds the info of the last frame we seeked to */
|
||||
FLAC__uint64 first_frame_offset; /* hint to the seek routine of where in the stream the first audio frame starts */
|
||||
@@ -308,7 +308,9 @@ FLAC_API FLAC__StreamDecoder *FLAC__stre
|
||||
decoder->private_->file = 0;
|
||||
|
||||
set_defaults_(decoder);
|
||||
-
|
||||
+#if defined(HAVE_OPENSSL)
|
||||
+ EVP_MD_CTX_init(&decoder->private_->md5context);
|
||||
+#endif
|
||||
decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED;
|
||||
|
||||
return decoder;
|
||||
@@ -334,7 +336,9 @@ FLAC_API void FLAC__stream_decoder_delet
|
||||
|
||||
for(i = 0; i < FLAC__MAX_CHANNELS; i++)
|
||||
FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&decoder->private_->partitioned_rice_contents[i]);
|
||||
-
|
||||
+#if defined(HAVE_OPENSSL)
|
||||
+ EVP_MD_CTX_cleanup(&decoder->private_->md5context);
|
||||
+#endif
|
||||
free(decoder->private_);
|
||||
free(decoder->protected_);
|
||||
free(decoder);
|
||||
@@ -654,8 +658,16 @@ FLAC_API FLAC__bool FLAC__stream_decoder
|
||||
/* see the comment in FLAC__seekable_stream_decoder_reset() as to why we
|
||||
* always call FLAC__MD5Final()
|
||||
*/
|
||||
+#if defined(HAVE_OPENSSL)
|
||||
+ /* decoder->private_->computed_md5sum is NULL when decoder->private_->do_md5_checking == false
|
||||
+ * that causes assertion failure crash in openSSL.
|
||||
+ */
|
||||
+ if(decoder->private_->do_md5_checking) {
|
||||
+ md5_failed = (EVP_DigestFinal_ex(&decoder->private_->md5context, decoder->private_->computed_md5sum, NULL) == 0);
|
||||
+ }
|
||||
+#else
|
||||
FLAC__MD5Final(decoder->private_->computed_md5sum, &decoder->private_->md5context);
|
||||
-
|
||||
+#endif
|
||||
if(decoder->private_->has_seek_table && 0 != decoder->private_->seek_table.data.seek_table.points) {
|
||||
free(decoder->private_->seek_table.data.seek_table.points);
|
||||
decoder->private_->seek_table.data.seek_table.points = 0;
|
||||
@@ -1006,11 +1018,15 @@ FLAC_API FLAC__bool FLAC__stream_decoder
|
||||
* FLAC__stream_decoder_finish() to make sure things are always cleaned up
|
||||
* properly.
|
||||
*/
|
||||
- FLAC__MD5Init(&decoder->private_->md5context);
|
||||
+ decoder->private_->first_frame_offset = 0;
|
||||
|
||||
- decoder->private_->first_frame_offset = 0;
|
||||
- decoder->private_->unparseable_frame_count = 0;
|
||||
+ decoder->private_->unparseable_frame_count = 0;
|
||||
|
||||
+#if defined(HAVE_OPENSSL)
|
||||
+ return (EVP_DigestInit_ex(&decoder->private_->md5context, EVP_md5(), NULL) == 1);
|
||||
+#else
|
||||
+▷⋅⋅⋅FLAC__MD5Init(&decoder->private_->md5context);
|
||||
+#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
Index: flac-1.3.0/src/libFLAC/stream_encoder.c
|
||||
===================================================================
|
||||
--- flac-1.3.0.orig/src/libFLAC/stream_encoder.c
|
||||
+++ flac-1.3.0/src/libFLAC/stream_encoder.c
|
||||
@@ -564,7 +564,9 @@ FLAC_API FLAC__StreamEncoder *FLAC__stre
|
||||
FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&encoder->private_->partitioned_rice_contents_extra[i]);
|
||||
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_UNINITIALIZED;
|
||||
-
|
||||
+#if defined(HAVE_OPENSSL)
|
||||
+ if(encoder->protected_->do_md5) EVP_MD_CTX_init(&encoder->private_->md5context);
|
||||
+#endif
|
||||
return encoder;
|
||||
}
|
||||
|
||||
@@ -598,6 +600,11 @@ FLAC_API void FLAC__stream_encoder_delet
|
||||
FLAC__format_entropy_coding_method_partitioned_rice_contents_clear(&encoder->private_->partitioned_rice_contents_extra[i]);
|
||||
|
||||
FLAC__bitwriter_delete(encoder->private_->frame);
|
||||
+#if defined(HAVE_OPENSSL)
|
||||
+ if(encoder->protected_->do_md5) {
|
||||
+ EVP_MD_CTX_cleanup(&encoder->private_->md5context);
|
||||
+ }
|
||||
+#endif
|
||||
free(encoder->private_);
|
||||
free(encoder->protected_);
|
||||
free(encoder);
|
||||
@@ -1031,8 +1038,15 @@ static FLAC__StreamEncoderInitStatus ini
|
||||
encoder->private_->streaminfo.data.stream_info.bits_per_sample = encoder->protected_->bits_per_sample;
|
||||
encoder->private_->streaminfo.data.stream_info.total_samples = encoder->protected_->total_samples_estimate; /* we will replace this later with the real total */
|
||||
memset(encoder->private_->streaminfo.data.stream_info.md5sum, 0, 16); /* we don't know this yet; have to fill it in later */
|
||||
- if(encoder->protected_->do_md5)
|
||||
- FLAC__MD5Init(&encoder->private_->md5context);
|
||||
+ if(encoder->protected_->do_md5) {
|
||||
+#if defined(HAVE_OPENSSL)
|
||||
+ if(EVP_DigestInit_ex(&encoder->private_->md5context, EVP_md5(), NULL) == 0) {
|
||||
+ return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
|
||||
+ }
|
||||
+#else
|
||||
+ FLAC__MD5Init(&encoder->private_->md5context);
|
||||
+#endif
|
||||
+ }
|
||||
if(!FLAC__add_metadata_block(&encoder->private_->streaminfo, encoder->private_->frame)) {
|
||||
encoder->protected_->state = FLAC__STREAM_ENCODER_FRAMING_ERROR;
|
||||
return FLAC__STREAM_ENCODER_INIT_STATUS_ENCODER_ERROR;
|
||||
@@ -1301,9 +1315,13 @@ FLAC_API FLAC__bool FLAC__stream_encoder
|
||||
}
|
||||
}
|
||||
|
||||
- if(encoder->protected_->do_md5)
|
||||
- FLAC__MD5Final(encoder->private_->streaminfo.data.stream_info.md5sum, &encoder->private_->md5context);
|
||||
-
|
||||
+ if(encoder->protected_->do_md5) {
|
||||
+#if defined(HAVE_OPENSSL)
|
||||
+ error = (EVP_DigestFinal_ex(&encoder->private_->md5context, encoder->private_->streaminfo.data.stream_info.md5sum, NULL) == 0);
|
||||
+#else
|
||||
+ FLAC__MD5Final(encoder->private_->streaminfo.data.stream_info.md5sum, &encoder->private_->md5context);
|
||||
+#endif
|
||||
+ }
|
||||
if(!encoder->private_->is_being_deleted) {
|
||||
if(encoder->protected_->state == FLAC__STREAM_ENCODER_OK) {
|
||||
if(encoder->private_->seek_callback) {
|
@ -1,425 +0,0 @@
|
||||
From 58064f7aaf9934799c4ae578194892098cca3995 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Cristian=20Rodr=C3=ADguez?= <crrodriguez@opensuse.org>
|
||||
Date: Sun, 26 May 2013 05:50:21 +0200
|
||||
Subject: [PATCH] getopt_long not broken here.
|
||||
|
||||
bundled version is used everywhere even when linux getopt_long
|
||||
is not broken, exclude that from our builds
|
||||
|
||||
diff --git a/src/flac/Makefile.am b/src/flac/Makefile.am
|
||||
index ceae6a5..bd609e0 100644
|
||||
--- a/src/flac/Makefile.am
|
||||
+++ b/src/flac/Makefile.am
|
||||
@@ -46,7 +46,6 @@ flac_SOURCES = \
|
||||
flac_LDADD = \
|
||||
$(top_builddir)/src/share/utf8/libutf8.la \
|
||||
$(top_builddir)/src/share/grabbag/libgrabbag.la \
|
||||
- $(top_builddir)/src/share/getopt/libgetopt.la \
|
||||
$(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
|
||||
$(top_builddir)/src/share/replaygain_synthesis/libreplaygain_synthesis.la \
|
||||
$(top_builddir)/src/libFLAC/libFLAC.la \
|
||||
diff --git a/src/flac/main.c b/src/flac/main.c
|
||||
index 62e54a4..4cfa64f 100644
|
||||
--- a/src/flac/main.c
|
||||
+++ b/src/flac/main.c
|
||||
@@ -51,13 +51,7 @@
|
||||
#define FLAC__STRCASECMP strcasecmp
|
||||
#endif
|
||||
|
||||
-#if 0
|
||||
-/*[JEC] was:#if HAVE_GETOPT_LONG*/
|
||||
-/*[JEC] see flac/include/share/getopt.h as to why the change */
|
||||
# include <getopt.h>
|
||||
-#else
|
||||
-# include "share/getopt.h"
|
||||
-#endif
|
||||
|
||||
static int do_it(void);
|
||||
|
||||
@@ -88,131 +82,131 @@ static int conditional_fclose(FILE *f);
|
||||
static char *local_strdup(const char *source);
|
||||
|
||||
/*
|
||||
- * share__getopt format struct; note that for long options with no
|
||||
+ * getopt format struct; note that for long options with no
|
||||
* short option equivalent we just set the 'val' field to 0.
|
||||
*/
|
||||
-static struct share__option long_options_[] = {
|
||||
+static struct option long_options_[] = {
|
||||
/*
|
||||
* general options
|
||||
*/
|
||||
- { "help" , share__no_argument, 0, 'h' },
|
||||
- { "explain" , share__no_argument, 0, 'H' },
|
||||
- { "version" , share__no_argument, 0, 'v' },
|
||||
- { "decode" , share__no_argument, 0, 'd' },
|
||||
- { "analyze" , share__no_argument, 0, 'a' },
|
||||
- { "test" , share__no_argument, 0, 't' },
|
||||
- { "stdout" , share__no_argument, 0, 'c' },
|
||||
- { "silent" , share__no_argument, 0, 's' },
|
||||
- { "totally-silent" , share__no_argument, 0, 0 },
|
||||
- { "warnings-as-errors" , share__no_argument, 0, 'w' },
|
||||
- { "force" , share__no_argument, 0, 'f' },
|
||||
- { "delete-input-file" , share__no_argument, 0, 0 },
|
||||
- { "preserve-modtime" , share__no_argument, 0, 0 },
|
||||
- { "keep-foreign-metadata" , share__no_argument, 0, 0 },
|
||||
- { "output-prefix" , share__required_argument, 0, 0 },
|
||||
- { "output-name" , share__required_argument, 0, 'o' },
|
||||
- { "skip" , share__required_argument, 0, 0 },
|
||||
- { "until" , share__required_argument, 0, 0 },
|
||||
- { "channel-map" , share__required_argument, 0, 0 }, /* undocumented */
|
||||
+ { "help" , no_argument, 0, 'h' },
|
||||
+ { "explain" , no_argument, 0, 'H' },
|
||||
+ { "version" , no_argument, 0, 'v' },
|
||||
+ { "decode" , no_argument, 0, 'd' },
|
||||
+ { "analyze" , no_argument, 0, 'a' },
|
||||
+ { "test" , no_argument, 0, 't' },
|
||||
+ { "stdout" , no_argument, 0, 'c' },
|
||||
+ { "silent" , no_argument, 0, 's' },
|
||||
+ { "totally-silent" , no_argument, 0, 0 },
|
||||
+ { "warnings-as-errors" , no_argument, 0, 'w' },
|
||||
+ { "force" , no_argument, 0, 'f' },
|
||||
+ { "delete-input-file" , no_argument, 0, 0 },
|
||||
+ { "preserve-modtime" , no_argument, 0, 0 },
|
||||
+ { "keep-foreign-metadata" , no_argument, 0, 0 },
|
||||
+ { "output-prefix" , required_argument, 0, 0 },
|
||||
+ { "output-name" , required_argument, 0, 'o' },
|
||||
+ { "skip" , required_argument, 0, 0 },
|
||||
+ { "until" , required_argument, 0, 0 },
|
||||
+ { "channel-map" , required_argument, 0, 0 }, /* undocumented */
|
||||
|
||||
/*
|
||||
* decoding options
|
||||
*/
|
||||
- { "decode-through-errors", share__no_argument, 0, 'F' },
|
||||
- { "cue" , share__required_argument, 0, 0 },
|
||||
- { "apply-replaygain-which-is-not-lossless", share__optional_argument, 0, 0 }, /* undocumented */
|
||||
+ { "decode-through-errors", no_argument, 0, 'F' },
|
||||
+ { "cue" , required_argument, 0, 0 },
|
||||
+ { "apply-replaygain-which-is-not-lossless", optional_argument, 0, 0 }, /* undocumented */
|
||||
|
||||
/*
|
||||
* encoding options
|
||||
*/
|
||||
- { "cuesheet" , share__required_argument, 0, 0 },
|
||||
- { "no-cued-seekpoints" , share__no_argument, 0, 0 },
|
||||
- { "picture" , share__required_argument, 0, 0 },
|
||||
- { "tag" , share__required_argument, 0, 'T' },
|
||||
- { "tag-from-file" , share__required_argument, 0, 0 },
|
||||
- { "compression-level-0" , share__no_argument, 0, '0' },
|
||||
- { "compression-level-1" , share__no_argument, 0, '1' },
|
||||
- { "compression-level-2" , share__no_argument, 0, '2' },
|
||||
- { "compression-level-3" , share__no_argument, 0, '3' },
|
||||
- { "compression-level-4" , share__no_argument, 0, '4' },
|
||||
- { "compression-level-5" , share__no_argument, 0, '5' },
|
||||
- { "compression-level-6" , share__no_argument, 0, '6' },
|
||||
- { "compression-level-7" , share__no_argument, 0, '7' },
|
||||
- { "compression-level-8" , share__no_argument, 0, '8' },
|
||||
- { "compression-level-9" , share__no_argument, 0, '9' },
|
||||
- { "best" , share__no_argument, 0, '8' },
|
||||
- { "fast" , share__no_argument, 0, '0' },
|
||||
- { "verify" , share__no_argument, 0, 'V' },
|
||||
- { "force-raw-format" , share__no_argument, 0, 0 },
|
||||
- { "force-aiff-format" , share__no_argument, 0, 0 },
|
||||
- { "force-rf64-format" , share__no_argument, 0, 0 },
|
||||
- { "force-wave64-format" , share__no_argument, 0, 0 },
|
||||
- { "lax" , share__no_argument, 0, 0 },
|
||||
- { "replay-gain" , share__no_argument, 0, 0 },
|
||||
- { "ignore-chunk-sizes" , share__no_argument, 0, 0 },
|
||||
- { "sector-align" , share__no_argument, 0, 0 }, /* DEPRECATED */
|
||||
- { "seekpoint" , share__required_argument, 0, 'S' },
|
||||
- { "padding" , share__required_argument, 0, 'P' },
|
||||
+ { "cuesheet" , required_argument, 0, 0 },
|
||||
+ { "no-cued-seekpoints" , no_argument, 0, 0 },
|
||||
+ { "picture" , required_argument, 0, 0 },
|
||||
+ { "tag" , required_argument, 0, 'T' },
|
||||
+ { "tag-from-file" , required_argument, 0, 0 },
|
||||
+ { "compression-level-0" , no_argument, 0, '0' },
|
||||
+ { "compression-level-1" , no_argument, 0, '1' },
|
||||
+ { "compression-level-2" , no_argument, 0, '2' },
|
||||
+ { "compression-level-3" , no_argument, 0, '3' },
|
||||
+ { "compression-level-4" , no_argument, 0, '4' },
|
||||
+ { "compression-level-5" , no_argument, 0, '5' },
|
||||
+ { "compression-level-6" , no_argument, 0, '6' },
|
||||
+ { "compression-level-7" , no_argument, 0, '7' },
|
||||
+ { "compression-level-8" , no_argument, 0, '8' },
|
||||
+ { "compression-level-9" , no_argument, 0, '9' },
|
||||
+ { "best" , no_argument, 0, '8' },
|
||||
+ { "fast" , no_argument, 0, '0' },
|
||||
+ { "verify" , no_argument, 0, 'V' },
|
||||
+ { "force-raw-format" , no_argument, 0, 0 },
|
||||
+ { "force-aiff-format" , no_argument, 0, 0 },
|
||||
+ { "force-rf64-format" , no_argument, 0, 0 },
|
||||
+ { "force-wave64-format" , no_argument, 0, 0 },
|
||||
+ { "lax" , no_argument, 0, 0 },
|
||||
+ { "replay-gain" , no_argument, 0, 0 },
|
||||
+ { "ignore-chunk-sizes" , no_argument, 0, 0 },
|
||||
+ { "sector-align" , no_argument, 0, 0 }, /* DEPRECATED */
|
||||
+ { "seekpoint" , required_argument, 0, 'S' },
|
||||
+ { "padding" , required_argument, 0, 'P' },
|
||||
#if FLAC__HAS_OGG
|
||||
- { "ogg" , share__no_argument, 0, 0 },
|
||||
- { "serial-number" , share__required_argument, 0, 0 },
|
||||
+ { "ogg" , no_argument, 0, 0 },
|
||||
+ { "serial-number" , required_argument, 0, 0 },
|
||||
#endif
|
||||
- { "blocksize" , share__required_argument, 0, 'b' },
|
||||
- { "exhaustive-model-search" , share__no_argument, 0, 'e' },
|
||||
- { "max-lpc-order" , share__required_argument, 0, 'l' },
|
||||
- { "apodization" , share__required_argument, 0, 'A' },
|
||||
- { "mid-side" , share__no_argument, 0, 'm' },
|
||||
- { "adaptive-mid-side" , share__no_argument, 0, 'M' },
|
||||
- { "qlp-coeff-precision-search", share__no_argument, 0, 'p' },
|
||||
- { "qlp-coeff-precision" , share__required_argument, 0, 'q' },
|
||||
- { "rice-partition-order" , share__required_argument, 0, 'r' },
|
||||
- { "endian" , share__required_argument, 0, 0 },
|
||||
- { "channels" , share__required_argument, 0, 0 },
|
||||
- { "bps" , share__required_argument, 0, 0 },
|
||||
- { "sample-rate" , share__required_argument, 0, 0 },
|
||||
- { "sign" , share__required_argument, 0, 0 },
|
||||
- { "input-size" , share__required_argument, 0, 0 },
|
||||
+ { "blocksize" , required_argument, 0, 'b' },
|
||||
+ { "exhaustive-model-search" , no_argument, 0, 'e' },
|
||||
+ { "max-lpc-order" , required_argument, 0, 'l' },
|
||||
+ { "apodization" , required_argument, 0, 'A' },
|
||||
+ { "mid-side" , no_argument, 0, 'm' },
|
||||
+ { "adaptive-mid-side" , no_argument, 0, 'M' },
|
||||
+ { "qlp-coeff-precision-search", no_argument, 0, 'p' },
|
||||
+ { "qlp-coeff-precision" , required_argument, 0, 'q' },
|
||||
+ { "rice-partition-order" , required_argument, 0, 'r' },
|
||||
+ { "endian" , required_argument, 0, 0 },
|
||||
+ { "channels" , required_argument, 0, 0 },
|
||||
+ { "bps" , required_argument, 0, 0 },
|
||||
+ { "sample-rate" , required_argument, 0, 0 },
|
||||
+ { "sign" , required_argument, 0, 0 },
|
||||
+ { "input-size" , required_argument, 0, 0 },
|
||||
|
||||
/*
|
||||
* analysis options
|
||||
*/
|
||||
- { "residual-gnuplot", share__no_argument, 0, 0 },
|
||||
- { "residual-text", share__no_argument, 0, 0 },
|
||||
+ { "residual-gnuplot", no_argument, 0, 0 },
|
||||
+ { "residual-text", no_argument, 0, 0 },
|
||||
|
||||
/*
|
||||
* negatives
|
||||
*/
|
||||
- { "no-preserve-modtime" , share__no_argument, 0, 0 },
|
||||
- { "no-decode-through-errors" , share__no_argument, 0, 0 },
|
||||
- { "no-silent" , share__no_argument, 0, 0 },
|
||||
- { "no-force" , share__no_argument, 0, 0 },
|
||||
- { "no-seektable" , share__no_argument, 0, 0 },
|
||||
- { "no-delete-input-file" , share__no_argument, 0, 0 },
|
||||
- { "no-keep-foreign-metadata" , share__no_argument, 0, 0 },
|
||||
- { "no-replay-gain" , share__no_argument, 0, 0 },
|
||||
- { "no-ignore-chunk-sizes" , share__no_argument, 0, 0 },
|
||||
- { "no-sector-align" , share__no_argument, 0, 0 }, /* DEPRECATED */
|
||||
- { "no-utf8-convert" , share__no_argument, 0, 0 },
|
||||
- { "no-lax" , share__no_argument, 0, 0 },
|
||||
+ { "no-preserve-modtime" , no_argument, 0, 0 },
|
||||
+ { "no-decode-through-errors" , no_argument, 0, 0 },
|
||||
+ { "no-silent" , no_argument, 0, 0 },
|
||||
+ { "no-force" , no_argument, 0, 0 },
|
||||
+ { "no-seektable" , no_argument, 0, 0 },
|
||||
+ { "no-delete-input-file" , no_argument, 0, 0 },
|
||||
+ { "no-keep-foreign-metadata" , no_argument, 0, 0 },
|
||||
+ { "no-replay-gain" , no_argument, 0, 0 },
|
||||
+ { "no-ignore-chunk-sizes" , no_argument, 0, 0 },
|
||||
+ { "no-sector-align" , no_argument, 0, 0 }, /* DEPRECATED */
|
||||
+ { "no-utf8-convert" , no_argument, 0, 0 },
|
||||
+ { "no-lax" , no_argument, 0, 0 },
|
||||
#if FLAC__HAS_OGG
|
||||
- { "no-ogg" , share__no_argument, 0, 0 },
|
||||
+ { "no-ogg" , no_argument, 0, 0 },
|
||||
#endif
|
||||
- { "no-exhaustive-model-search", share__no_argument, 0, 0 },
|
||||
- { "no-mid-side" , share__no_argument, 0, 0 },
|
||||
- { "no-adaptive-mid-side" , share__no_argument, 0, 0 },
|
||||
- { "no-qlp-coeff-prec-search" , share__no_argument, 0, 0 },
|
||||
- { "no-padding" , share__no_argument, 0, 0 },
|
||||
- { "no-verify" , share__no_argument, 0, 0 },
|
||||
- { "no-warnings-as-errors" , share__no_argument, 0, 0 },
|
||||
- { "no-residual-gnuplot" , share__no_argument, 0, 0 },
|
||||
- { "no-residual-text" , share__no_argument, 0, 0 },
|
||||
+ { "no-exhaustive-model-search", no_argument, 0, 0 },
|
||||
+ { "no-mid-side" , no_argument, 0, 0 },
|
||||
+ { "no-adaptive-mid-side" , no_argument, 0, 0 },
|
||||
+ { "no-qlp-coeff-prec-search" , no_argument, 0, 0 },
|
||||
+ { "no-padding" , no_argument, 0, 0 },
|
||||
+ { "no-verify" , no_argument, 0, 0 },
|
||||
+ { "no-warnings-as-errors" , no_argument, 0, 0 },
|
||||
+ { "no-residual-gnuplot" , no_argument, 0, 0 },
|
||||
+ { "no-residual-text" , no_argument, 0, 0 },
|
||||
/*
|
||||
* undocumented debugging options for the test suite
|
||||
*/
|
||||
- { "disable-constant-subframes", share__no_argument, 0, 0 },
|
||||
- { "disable-fixed-subframes" , share__no_argument, 0, 0 },
|
||||
- { "disable-verbatim-subframes", share__no_argument, 0, 0 },
|
||||
- { "no-md5-sum" , share__no_argument, 0, 0 },
|
||||
+ { "disable-constant-subframes", no_argument, 0, 0 },
|
||||
+ { "disable-fixed-subframes" , no_argument, 0, 0 },
|
||||
+ { "disable-verbatim-subframes", no_argument, 0, 0 },
|
||||
+ { "no-md5-sum" , no_argument, 0, 0 },
|
||||
|
||||
{0, 0, 0, 0}
|
||||
};
|
||||
@@ -616,17 +610,17 @@ int parse_options(int argc, char *argv[])
|
||||
FLAC__bool had_error = false;
|
||||
const char *short_opts = "0123456789aA:b:cdefFhHl:mMo:pP:q:r:sS:tT:vVw";
|
||||
|
||||
- while ((short_option = share__getopt_long(argc, argv, short_opts, long_options_, &option_index)) != -1) {
|
||||
+ while ((short_option = getopt_long(argc, argv, short_opts, long_options_, &option_index)) != -1) {
|
||||
switch (short_option) {
|
||||
case 0: /* long option with no equivalent short option */
|
||||
- had_error |= (parse_option(short_option, long_options_[option_index].name, share__optarg) != 0);
|
||||
+ had_error |= (parse_option(short_option, long_options_[option_index].name, optarg) != 0);
|
||||
break;
|
||||
case '?':
|
||||
case ':':
|
||||
had_error = true;
|
||||
break;
|
||||
default: /* short option */
|
||||
- had_error |= (parse_option(short_option, 0, share__optarg) != 0);
|
||||
+ had_error |= (parse_option(short_option, 0, optarg) != 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -635,16 +629,16 @@ int parse_options(int argc, char *argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
- FLAC__ASSERT(share__optind <= argc);
|
||||
+ FLAC__ASSERT(optind <= argc);
|
||||
|
||||
- option_values.num_files = argc - share__optind;
|
||||
+ option_values.num_files = argc - optind;
|
||||
|
||||
if(option_values.num_files > 0) {
|
||||
unsigned i = 0;
|
||||
if(0 == (option_values.filenames = malloc(sizeof(char*) * option_values.num_files)))
|
||||
die("out of memory allocating space for file names list");
|
||||
- while(share__optind < argc)
|
||||
- option_values.filenames[i++] = local_strdup(argv[share__optind++]);
|
||||
+ while(optind < argc)
|
||||
+ option_values.filenames[i++] = local_strdup(argv[optind++]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
diff --git a/src/metaflac/Makefile.am b/src/metaflac/Makefile.am
|
||||
index 35460b1..114a066 100644
|
||||
--- a/src/metaflac/Makefile.am
|
||||
+++ b/src/metaflac/Makefile.am
|
||||
@@ -44,7 +44,6 @@ metaflac_LDFLAGS = $(AM_LDFLAGS)
|
||||
metaflac_LDADD = \
|
||||
$(top_builddir)/src/share/grabbag/libgrabbag.la \
|
||||
$(top_builddir)/src/share/replaygain_analysis/libreplaygain_analysis.la \
|
||||
- $(top_builddir)/src/share/getopt/libgetopt.la \
|
||||
$(top_builddir)/src/share/utf8/libutf8.la \
|
||||
$(top_builddir)/src/libFLAC/libFLAC.la \
|
||||
@LIBICONV@
|
||||
diff --git a/src/metaflac/options.c b/src/metaflac/options.c
|
||||
index e8e6151..68aab3e 100644
|
||||
--- a/src/metaflac/options.c
|
||||
+++ b/src/metaflac/options.c
|
||||
@@ -33,10 +33,10 @@
|
||||
#include <string.h>
|
||||
|
||||
/*
|
||||
- share__getopt format struct; note we don't use short options so we just
|
||||
+ getopt format struct; note we don't use short options so we just
|
||||
set the 'val' field to 0 everywhere to indicate a valid option.
|
||||
*/
|
||||
-struct share__option long_options_[] = {
|
||||
+struct option long_options_[] = {
|
||||
/* global options */
|
||||
{ "preserve-modtime", 0, 0, 0 },
|
||||
{ "with-filename", 0, 0, 0 },
|
||||
@@ -159,10 +159,10 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options)
|
||||
int option_index = 1;
|
||||
FLAC__bool had_error = false;
|
||||
|
||||
- while ((ret = share__getopt_long(argc, argv, "", long_options_, &option_index)) != -1) {
|
||||
+ while ((ret = getopt_long(argc, argv, "", long_options_, &option_index)) != -1) {
|
||||
switch (ret) {
|
||||
case 0:
|
||||
- had_error |= !parse_option(option_index, share__optarg, options);
|
||||
+ had_error |= !parse_option(option_index, optarg, options);
|
||||
break;
|
||||
case '?':
|
||||
case ':':
|
||||
@@ -175,22 +175,22 @@ FLAC__bool parse_options(int argc, char *argv[], CommandLineOptions *options)
|
||||
}
|
||||
|
||||
if(options->prefix_with_filename == 2)
|
||||
- options->prefix_with_filename = (argc - share__optind > 1);
|
||||
+ options->prefix_with_filename = (argc - optind > 1);
|
||||
|
||||
- if(share__optind >= argc && !options->show_long_help && !options->show_version) {
|
||||
+ if(optind >= argc && !options->show_long_help && !options->show_version) {
|
||||
flac_fprintf(stderr,"ERROR: you must specify at least one FLAC file;\n");
|
||||
flac_fprintf(stderr," metaflac cannot be used as a pipe\n");
|
||||
had_error = true;
|
||||
}
|
||||
|
||||
- options->num_files = argc - share__optind;
|
||||
+ options->num_files = argc - optind;
|
||||
|
||||
if(options->num_files > 0) {
|
||||
unsigned i = 0;
|
||||
if(0 == (options->filenames = safe_malloc_mul_2op_(sizeof(char*), /*times*/options->num_files)))
|
||||
die("out of memory allocating space for file names list");
|
||||
- while(share__optind < argc)
|
||||
- options->filenames[i++] = local_strdup(argv[share__optind++]);
|
||||
+ while(optind < argc)
|
||||
+ options->filenames[i++] = local_strdup(argv[optind++]);
|
||||
}
|
||||
|
||||
if(options->args.checks.num_major_ops > 0) {
|
||||
diff --git a/src/metaflac/options.h b/src/metaflac/options.h
|
||||
index 63079fe..944b1bf 100644
|
||||
--- a/src/metaflac/options.h
|
||||
+++ b/src/metaflac/options.h
|
||||
@@ -21,15 +21,9 @@
|
||||
|
||||
#include "FLAC/format.h"
|
||||
|
||||
-#if 0
|
||||
-/*[JEC] was:#if HAVE_GETOPT_LONG*/
|
||||
-/*[JEC] see flac/include/share/getopt.h as to why the change */
|
||||
-# include <getopt.h>
|
||||
-#else
|
||||
-# include "share/getopt.h"
|
||||
-#endif
|
||||
+#include <getopt.h>
|
||||
|
||||
-extern struct share__option long_options_[];
|
||||
+extern struct option long_options_[];
|
||||
|
||||
typedef enum {
|
||||
OP__SHOW_MD5SUM,
|
||||
diff --git a/src/share/Makefile.am b/src/share/Makefile.am
|
||||
index d9521ce..e9f8dcd 100644
|
||||
--- a/src/share/Makefile.am
|
||||
+++ b/src/share/Makefile.am
|
||||
@@ -42,7 +42,6 @@ EXTRA_DIST = \
|
||||
|
||||
|
||||
noinst_LTLIBRARIES = \
|
||||
- getopt/libgetopt.la \
|
||||
grabbag/libgrabbag.la \
|
||||
utf8/libutf8.la \
|
||||
$(libwin_utf8_io) \
|
||||
@@ -59,8 +58,6 @@ libwin_utf8_io =
|
||||
endif
|
||||
|
||||
|
||||
-getopt_libgetopt_la_SOURCES = getopt/getopt.c getopt/getopt1.c
|
||||
-
|
||||
grabbag_libgrabbag_la_SOURCES = \
|
||||
grabbag/alloc.c \
|
||||
grabbag/cuesheet.c \
|
||||
--
|
||||
1.8.1.4
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:fa2d64aac1f77e31dfbb270aeb08f5b32e27036a52ad15e69a77e309528010dc
|
||||
size 1084256
|
3
flac-1.3.1.tar.xz
Normal file
3
flac-1.3.1.tar.xz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4773c0099dba767d963fd92143263be338c48702172e8754b9bc5103efe1c56c
|
||||
size 941848
|
32
flac-cflags.patch
Normal file
32
flac-cflags.patch
Normal file
@ -0,0 +1,32 @@
|
||||
diff -up flac-1.3.1/configure.ac.cflags flac-1.3.1/configure.ac
|
||||
--- flac-1.3.1/configure.ac.cflags 2014-11-27 03:45:33.598155763 +0100
|
||||
+++ flac-1.3.1/configure.ac 2014-11-27 13:45:18.092749862 +0100
|
||||
@@ -352,8 +352,7 @@ if test "x$debug" = xtrue; then
|
||||
CFLAGS="-g $CFLAGS"
|
||||
else
|
||||
CPPFLAGS="-DNDEBUG $CPPFLAGS"
|
||||
- CFLAGS=$(echo "$CFLAGS" | sed 's/-O2//;s/-g//')
|
||||
- CFLAGS="-O3 -funroll-loops $CFLAGS"
|
||||
+ CFLAGS="$user_cflags"
|
||||
fi
|
||||
|
||||
XIPH_GCC_VERSION
|
||||
@@ -363,7 +362,6 @@ if test x$ac_cv_c_compiler_gnu = xyes ;
|
||||
CXXFLAGS="$CXXFLAGS -Wall -Wextra -Wcast-align -Wshadow -Wwrite-strings -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wsign-promo -Wundef -Wunreachable-code " # -Wcast-qual -Wbad-function-cast -Wwrite-strings -Woverloaded-virtual -Wmissing-declarations
|
||||
|
||||
XIPH_ADD_CFLAGS([-Wdeclaration-after-statement])
|
||||
- XIPH_ADD_CFLAGS([-D_FORTIFY_SOURCE=2])
|
||||
|
||||
AC_LANG_PUSH([C++])
|
||||
XIPH_ADD_CXXFLAGS([-Weffc++])
|
||||
@@ -385,10 +383,6 @@ if test x$ac_cv_c_compiler_gnu = xyes ;
|
||||
XIPH_ADD_CFLAGS([-fgnu89-inline])
|
||||
fi
|
||||
|
||||
- if test "x$asm_optimisation$sse_os" = "xyesyes" ; then
|
||||
- XIPH_ADD_CFLAGS([-msse2])
|
||||
- fi
|
||||
-
|
||||
fi
|
||||
|
||||
XIPH_ADD_CFLAGS([-Wextra])
|
@ -1,35 +0,0 @@
|
||||
From 5b3033a2b355068c11fe637e14ac742d273f076e Mon Sep 17 00:00:00 2001
|
||||
From: Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
Date: Tue, 18 Nov 2014 07:20:25 -0800
|
||||
Subject: [PATCH] src/libFLAC/stream_decoder.c : Fix buffer read overflow.
|
||||
|
||||
This is CVE-2014-8962.
|
||||
|
||||
Reported-by: Michele Spagnuolo,
|
||||
Google Security Team <mikispag@google.com>
|
||||
---
|
||||
src/libFLAC/stream_decoder.c | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/src/libFLAC/stream_decoder.c
|
||||
+++ b/src/libFLAC/stream_decoder.c
|
||||
@@ -71,7 +71,7 @@ FLAC_API int FLAC_API_SUPPORTS_OGG_FLAC
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
-static FLAC__byte ID3V2_TAG_[3] = { 'I', 'D', '3' };
|
||||
+static const FLAC__byte ID3V2_TAG_[3] = { 'I', 'D', '3' };
|
||||
|
||||
/***********************************************************************
|
||||
*
|
||||
@@ -1381,6 +1381,10 @@ FLAC__bool find_metadata_(FLAC__StreamDe
|
||||
id = 0;
|
||||
continue;
|
||||
}
|
||||
+
|
||||
+ if(id >= 3)
|
||||
+ return false;
|
||||
+
|
||||
if(x == ID3V2_TAG_[id]) {
|
||||
id++;
|
||||
i = 0;
|
@ -1,29 +0,0 @@
|
||||
From fcf0ba06ae12ccd7c67cee3c8d948df15f946b85 Mon Sep 17 00:00:00 2001
|
||||
From: Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
Date: Wed, 19 Nov 2014 19:35:59 -0800
|
||||
Subject: [PATCH] src/libFACL/stream_decoder.c : Fail safely to avoid a heap overflow.
|
||||
|
||||
A file provided by the reporters caused the stream decoder to write to
|
||||
un-allocated heap space resulting in a segfault. The solution is to
|
||||
error out (by returning false from read_residual_partitioned_rice_())
|
||||
instead of trying to continue to decode.
|
||||
|
||||
Fixes: CVE-2014-9028
|
||||
Reported-by: Michele Spagnuolo,
|
||||
Google Security Team <mikispag@google.com>
|
||||
---
|
||||
src/libFLAC/stream_decoder.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/src/libFLAC/stream_decoder.c
|
||||
+++ b/src/libFLAC/stream_decoder.c
|
||||
@@ -2725,7 +2725,8 @@ FLAC__bool read_residual_partitioned_ric
|
||||
if(decoder->private_->frame.header.blocksize < predictor_order) {
|
||||
send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC);
|
||||
decoder->protected_->state = FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC;
|
||||
- return true;
|
||||
+ /* We have received a potentially malicious bt stream. All we can do is error out to avoid a heap overflow. */
|
||||
+ return false;
|
||||
}
|
||||
}
|
||||
else {
|
@ -1,7 +1,7 @@
|
||||
Index: flac-1.2.1_git201212051942/src/libFLAC/flac.pc.in
|
||||
Index: flac-1.3.1/src/libFLAC/flac.pc.in
|
||||
===================================================================
|
||||
--- flac-1.2.1_git201212051942.orig/src/libFLAC/flac.pc.in
|
||||
+++ flac-1.2.1_git201212051942/src/libFLAC/flac.pc.in
|
||||
--- flac-1.3.1.orig/src/libFLAC/flac.pc.in
|
||||
+++ flac-1.3.1/src/libFLAC/flac.pc.in
|
||||
@@ -1,7 +1,7 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
@ -11,10 +11,10 @@ Index: flac-1.2.1_git201212051942/src/libFLAC/flac.pc.in
|
||||
|
||||
Name: FLAC
|
||||
Description: Free Lossless Audio Codec Library
|
||||
Index: flac-1.2.1_git201212051942/src/libFLAC++/flac++.pc.in
|
||||
Index: flac-1.3.1/src/libFLAC++/flac++.pc.in
|
||||
===================================================================
|
||||
--- flac-1.2.1_git201212051942.orig/src/libFLAC++/flac++.pc.in
|
||||
+++ flac-1.2.1_git201212051942/src/libFLAC++/flac++.pc.in
|
||||
--- flac-1.3.1.orig/src/libFLAC++/flac++.pc.in
|
||||
+++ flac-1.3.1/src/libFLAC++/flac++.pc.in
|
||||
@@ -1,7 +1,7 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
|
@ -1,6 +1,8 @@
|
||||
--- flac-1.2.99_git201305252226.orig/src/libFLAC/metadata_iterators.c
|
||||
+++ flac-1.2.99_git201305252226/src/libFLAC/metadata_iterators.c
|
||||
@@ -420,10 +420,10 @@ static FLAC__bool simple_iterator_prime_
|
||||
Index: flac-1.3.1/src/libFLAC/metadata_iterators.c
|
||||
===================================================================
|
||||
--- flac-1.3.1.orig/src/libFLAC/metadata_iterators.c
|
||||
+++ flac-1.3.1/src/libFLAC/metadata_iterators.c
|
||||
@@ -421,10 +421,10 @@ static FLAC__bool simple_iterator_prime_
|
||||
|
||||
FLAC__ASSERT(0 != iterator);
|
||||
|
||||
@ -13,20 +15,24 @@
|
||||
iterator->status = FLAC__METADATA_SIMPLE_ITERATOR_STATUS_ERROR_OPENING_FILE;
|
||||
return false;
|
||||
}
|
||||
--- flac-1.2.99_git201305252226.orig/src/libFLAC/stream_decoder.c
|
||||
+++ flac-1.2.99_git201305252226/src/libFLAC/stream_decoder.c
|
||||
Index: flac-1.3.1/src/libFLAC/stream_decoder.c
|
||||
===================================================================
|
||||
--- flac-1.3.1.orig/src/libFLAC/stream_decoder.c
|
||||
+++ flac-1.3.1/src/libFLAC/stream_decoder.c
|
||||
@@ -606,7 +606,7 @@ static FLAC__StreamDecoderInitStatus ini
|
||||
if(0 == write_callback || 0 == error_callback)
|
||||
return decoder->protected_->state = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS;
|
||||
return decoder->protected_->initstate = FLAC__STREAM_DECODER_INIT_STATUS_INVALID_CALLBACKS;
|
||||
|
||||
- file = filename? flac_fopen(filename, "rb") : stdin;
|
||||
+ file = filename? flac_fopen(filename, "rbe") : stdin;
|
||||
|
||||
if(0 == file)
|
||||
return FLAC__STREAM_DECODER_INIT_STATUS_ERROR_OPENING_FILE;
|
||||
--- flac-1.2.99_git201305252226.orig/src/libFLAC/stream_encoder.c
|
||||
+++ flac-1.2.99_git201305252226/src/libFLAC/stream_encoder.c
|
||||
@@ -1250,7 +1250,7 @@ static FLAC__StreamEncoderInitStatus ini
|
||||
Index: flac-1.3.1/src/libFLAC/stream_encoder.c
|
||||
===================================================================
|
||||
--- flac-1.3.1.orig/src/libFLAC/stream_encoder.c
|
||||
+++ flac-1.3.1/src/libFLAC/stream_encoder.c
|
||||
@@ -1389,7 +1389,7 @@ static FLAC__StreamEncoderInitStatus ini
|
||||
if(encoder->protected_->state != FLAC__STREAM_ENCODER_UNINITIALIZED)
|
||||
return FLAC__STREAM_ENCODER_INIT_STATUS_ALREADY_INITIALIZED;
|
||||
|
||||
|
34
flac.changes
34
flac.changes
@ -1,3 +1,37 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Mar 20 15:22:04 UTC 2015 - mpluskal@suse.com
|
||||
|
||||
- Cleanup spec file with spec-cleaner
|
||||
- Update url
|
||||
- Remove no longer needed patches
|
||||
* flac-fix-CVE-2014-8962.patch
|
||||
* flac-fix-CVE-2014-9028.patch
|
||||
* 0001-getopt_long-not-broken-here.patch
|
||||
- Remove following as benefit of using openssl is small
|
||||
* 0001-Allow-use-of-openSSL.patch
|
||||
- Add flac-cflags.patch
|
||||
- Use doxygen to build documentation
|
||||
- Split documentation to separate package
|
||||
- Update to 1.3.1
|
||||
* Improved decoding efficiency of all bit depths but especially
|
||||
so for 24 bits for IA32 architecture (lvqcl and Miroslav Lichvar).
|
||||
* Faster encoding using SSE and AVX (lvqcl).
|
||||
* Fixed bartlett, bartlett_hann and triangle functions.
|
||||
* New apodization functions partial_tukey and punchout_tukey for
|
||||
improved compression (Martijn van Beurden).
|
||||
* Retuned compression presets to incorporate new apodization
|
||||
functions (Martijn van Beurden).
|
||||
* Fix -Wcast-align warnings on armhf architecture (Erik de
|
||||
Castro Lopo).
|
||||
* Help output documentation improvements.
|
||||
* I/O buffering improvements on Windows to reduce disk
|
||||
fragmentation when writing files.
|
||||
* Only write vorbis-comments if they are non-empty.
|
||||
* Fix symbol visibility in XMMS plugin.
|
||||
* Many fixes and improvements across all the build systems.
|
||||
* Fix CVE-2014-9028 (heap write overflow) and CVE-2014-8962
|
||||
(heap read overflow)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Nov 26 09:56:05 CET 2014 - tiwai@suse.de
|
||||
|
||||
|
52
flac.spec
52
flac.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package flac
|
||||
#
|
||||
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -17,43 +17,42 @@
|
||||
|
||||
|
||||
Name: flac
|
||||
Version: 1.3.0
|
||||
Version: 1.3.1
|
||||
Release: 0
|
||||
Summary: Free Lossless Audio Codec
|
||||
License: BSD-3-Clause and GPL-2.0+ and GFDL-1.2
|
||||
Group: Productivity/Multimedia/Sound/Utilities
|
||||
Url: http://flac.sourceforge.net/
|
||||
|
||||
Url: https://xiph.org/flac/
|
||||
#Git-Web: https://git.xiph.org/?p=flac.git
|
||||
#Git-Clone: git://git.xiph.org/flac
|
||||
Source: http://downloads.xiph.org/releases/flac/%name-%version.tar.xz
|
||||
Source: http://downloads.xiph.org/releases/flac/%{name}-%{version}.tar.xz
|
||||
Source2: baselibs.conf
|
||||
Patch1: flac-ocloexec.patch
|
||||
Patch2: 0001-Allow-use-of-openSSL.patch
|
||||
Patch3: flac-fix-pkgconfig.patch
|
||||
Patch5: 0001-getopt_long-not-broken-here.patch
|
||||
Patch6: flac-fix-CVE-2014-8962.patch
|
||||
Patch7: flac-fix-CVE-2014-9028.patch
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
Patch6: flac-cflags.patch
|
||||
BuildRequires: autoconf >= 2.60
|
||||
BuildRequires: automake >= 1.11
|
||||
BuildRequires: doxygen
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: libogg-devel
|
||||
BuildRequires: libtool
|
||||
BuildRequires: openssl-devel
|
||||
BuildRequires: pkg-config
|
||||
BuildRequires: xz
|
||||
%ifarch %{ix86}
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
%ifarch %ix86
|
||||
BuildRequires: nasm
|
||||
%endif
|
||||
%ifarch ppc64
|
||||
# bug437293
|
||||
Obsoletes: flac-64bit
|
||||
%endif
|
||||
|
||||
%description
|
||||
FLAC is an open source lossless audio codec developed by Josh Coalson.
|
||||
|
||||
%package doc
|
||||
Summary: Free Lossless Audio Codec Library
|
||||
Group: Documentation/HTML
|
||||
|
||||
%description doc
|
||||
This package contains documentation for flac
|
||||
|
||||
%package -n libFLAC8
|
||||
Summary: Free Lossless Audio Codec Library
|
||||
Group: System/Libraries
|
||||
@ -87,19 +86,13 @@ FLAC library.
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch7 -p1
|
||||
|
||||
%build
|
||||
touch config.rpath
|
||||
autoreconf --force --install
|
||||
%define warn_flags -O3 -W -Wall -Wstrict-prototypes -Wformat-security
|
||||
export CFLAGS="%{optflags} %{warn_flags}"
|
||||
export CXXFLAGS="$CFLAGS"
|
||||
%configure --disable-thorough-tests \
|
||||
./autogen.sh
|
||||
%configure \
|
||||
--disable-thorough-tests \
|
||||
--disable-xmms-plugin \
|
||||
--disable-static \
|
||||
--disable-rpath \
|
||||
@ -109,8 +102,8 @@ export CXXFLAGS="$CFLAGS"
|
||||
make %{?_smp_mflags} V=1
|
||||
|
||||
%install
|
||||
make install DESTDIR="%buildroot" docdir="%_docdir/%name"
|
||||
rm -f "%buildroot/%_libdir"/*.la
|
||||
make install DESTDIR=%{buildroot} docdir="%{_docdir}/%{name}"
|
||||
find %{buildroot} -type f -name "*.la" -delete -print
|
||||
# documents
|
||||
cp -a AUTHORS README COPYING.* %{buildroot}%{_docdir}/%{name}
|
||||
|
||||
@ -127,10 +120,13 @@ make check %{?_smp_mflags}
|
||||
|
||||
%files
|
||||
%defattr(-, root, root)
|
||||
%doc %{_docdir}/%{name}
|
||||
%{_bindir}/*
|
||||
%{_mandir}/man*/*
|
||||
|
||||
%files doc
|
||||
%defattr(-, root, root)
|
||||
%doc %{_docdir}/%{name}
|
||||
|
||||
%files -n libFLAC8
|
||||
%defattr(-, root, root)
|
||||
%{_libdir}/libFLAC.so.8*
|
||||
|
Loading…
x
Reference in New Issue
Block a user