diff options
author | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2008-08-21 01:52:37 +0800 |
---|---|---|
committer | marcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059> | 2008-08-21 01:52:37 +0800 |
commit | 51084fb7e025b1a12a65fff164bad008c88016f8 (patch) | |
tree | ae5c11a2251bf66bd7f1147933ae01c8a7cf1e55 /audio/libcanberra | |
parent | d47f3cb4dccc6a5389d114a80e6293b2bca1e8c8 (diff) | |
download | marcuscom-ports-51084fb7e025b1a12a65fff164bad008c88016f8.tar marcuscom-ports-51084fb7e025b1a12a65fff164bad008c88016f8.tar.gz marcuscom-ports-51084fb7e025b1a12a65fff164bad008c88016f8.tar.bz2 marcuscom-ports-51084fb7e025b1a12a65fff164bad008c88016f8.tar.lz marcuscom-ports-51084fb7e025b1a12a65fff164bad008c88016f8.tar.xz marcuscom-ports-51084fb7e025b1a12a65fff164bad008c88016f8.tar.zst marcuscom-ports-51084fb7e025b1a12a65fff164bad008c88016f8.zip |
Update diffs so that it can be applied upstream.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@11352 df743ca5-7f9a-e211-a948-0013205c9059
Diffstat (limited to 'audio/libcanberra')
-rw-r--r-- | audio/libcanberra/Makefile | 1 | ||||
-rw-r--r-- | audio/libcanberra/files/patch-config.h.in | 13 | ||||
-rw-r--r-- | audio/libcanberra/files/patch-configure | 218 | ||||
-rw-r--r-- | audio/libcanberra/files/patch-configure.ac | 30 | ||||
-rw-r--r-- | audio/libcanberra/files/patch-src_malloc.c | 32 | ||||
-rw-r--r-- | audio/libcanberra/files/patch-src_malloc.h | 37 | ||||
-rw-r--r-- | audio/libcanberra/files/patch-src_oss.c | 63 |
7 files changed, 239 insertions, 155 deletions
diff --git a/audio/libcanberra/Makefile b/audio/libcanberra/Makefile index d37a44cce..2fd0e46ab 100644 --- a/audio/libcanberra/Makefile +++ b/audio/libcanberra/Makefile @@ -7,6 +7,7 @@ PORTNAME= libcanberra PORTVERSION= 0.7 +PORTREVISION= 1 CATEGORIES= audio devel MASTER_SITES= http://0pointer.de/lennart/projects/libcanberra/ diff --git a/audio/libcanberra/files/patch-config.h.in b/audio/libcanberra/files/patch-config.h.in index d1d6b10e8..bd675d1b6 100644 --- a/audio/libcanberra/files/patch-config.h.in +++ b/audio/libcanberra/files/patch-config.h.in @@ -1,5 +1,5 @@ ---- config.h.in.orig 2008-08-09 15:51:54.000000000 -0400 -+++ config.h.in 2008-08-09 15:51:57.000000000 -0400 +--- config.h.in.orig 2008-08-20 13:18:28.404065000 -0400 ++++ config.h.in 2008-08-20 13:43:13.000000000 -0400 @@ -30,6 +30,9 @@ /* Define to 1 if you have the `lstat' function. */ #undef HAVE_LSTAT @@ -10,17 +10,20 @@ /* Define to 1 if you have the <memory.h> header file. */ #undef HAVE_MEMORY_H -@@ -39,6 +42,9 @@ +@@ -39,6 +42,12 @@ /* Have NULL output? */ #undef HAVE_NULL +/* Have OSS? */ +#undef HAVE_OSS + ++/* Have strndup? */ ++#undef HAVE_STRNDUP ++ /* Define to 1 if you have the `posix_memalign' function. */ #undef HAVE_POSIX_MEMALIGN -@@ -57,6 +63,9 @@ +@@ -57,6 +66,9 @@ /* Define to 1 if you have the `sleep' function. */ #undef HAVE_SLEEP @@ -30,7 +33,7 @@ /* Define to 1 if the system has the type `ssize_t'. */ #undef HAVE_SSIZE_T -@@ -93,6 +102,9 @@ +@@ -93,6 +105,9 @@ /* Define to 1 if you have the <sys/socket.h> header file. */ #undef HAVE_SYS_SOCKET_H diff --git a/audio/libcanberra/files/patch-configure b/audio/libcanberra/files/patch-configure index f9aa33c2c..19e07bfe2 100644 --- a/audio/libcanberra/files/patch-configure +++ b/audio/libcanberra/files/patch-configure @@ -1,5 +1,5 @@ ---- configure.orig 2008-08-20 01:16:41.000000000 -0400 -+++ configure 2008-08-20 01:17:33.000000000 -0400 +--- configure.orig 2008-08-20 13:45:00.000000000 -0400 ++++ configure 2008-08-20 13:45:26.000000000 -0400 @@ -791,7 +791,6 @@ ac_includes_default="\ # include <unistd.h> #endif" @@ -237,7 +237,7 @@ if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized -@@ -21148,10 +21154,6 @@ LIBTOOL='$(SHELL) /space/marcus/ports/li +@@ -21148,10 +21154,6 @@ LIBTOOL='$(SHELL) $(top_builddir)/libtoo @@ -295,76 +295,116 @@ if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat >conftest.$ac_ext <<_ACEOF -@@ -23739,7 +23781,7 @@ fi - - # We must check for the threads library under a number of different - # names; the ordering is very important because some systems --# (e.g. DEC) have both -pthread and -pthreads, where one of the -+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the - # libraries is broken (non-POSIX). - - # Create a list of thread flags to try. Items starting with a "-" are -@@ -23752,7 +23794,7 @@ acx_pthread_flags="pthreads none -Kthrea - # The ordering *is* (sometimes) important. Some notes on the - # individual items follow: - --# pthreads: AIX (must check this before -pthread) -+# pthreads: AIX (must check this before -lpthread) - # none: in case threads are in libc; should be tried before -Kthread and - # other compiler flags to prevent continual compiler warnings - # -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h) -@@ -23775,10 +23817,10 @@ case "${host_cpu}-${host_os}" in - # On Solaris (at least, for some versions), libc contains stubbed - # (non-functional) versions of the pthreads routines, so link-based - # tests will erroneously succeed. (We need to link with -pthreads/-mt/ -- # -pthread.) (The stubs are missing pthread_cleanup_push, or rather -+ # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather - # a function called by this macro, so we could check for that, but - # who knows whether they'll stub that too in a future libc.) So, -- # we'll just look for -pthreads and -pthread first: -+ # we'll just look for -pthreads and -lpthread first: - - acx_pthread_flags="-pthreads pthread -mt -pthread $acx_pthread_flags" - ;; -@@ -23858,9 +23900,9 @@ $as_echo_n "checking for the pthreads li - # Check for various functions. We must include pthread.h, - # since some functions may be macros. (On the Sequent, we - # need a special flag -Kthread to make this header compile.) -- # We check for pthread_join because it is in -pthread on IRIX -+ # We check for pthread_join because it is in -lpthread on IRIX - # while pthread_create is in libc. We check for pthread_attr_init -- # due to DEC craziness with -pthreads. We check for -+ # due to DEC craziness with -lpthreads. We check for - # pthread_cleanup_push because it is one of the few pthread - # functions on Solaris that doesn't have a non-functional libc stub. - # We try pthread_create on general principles. -@@ -24165,12 +24207,12 @@ $as_echo "no" >&6; } - - # - # Linux gcc on some architectures such as mips/mipsel forgets -- # about -pthread -+ # about -lpthread - # - if test x"$ok" = xno; then -- { $as_echo "$as_me:$LINENO: checking whether -pthread fixes that" >&5 --$as_echo_n "checking whether -pthread fixes that... " >&6; } -- LIBS="-pthread $PTHREAD_LIBS $save_LIBS" -+ { $as_echo "$as_me:$LINENO: checking whether -lpthread fixes that" >&5 -+$as_echo_n "checking whether -lpthread fixes that... " >&6; } -+ LIBS="-lpthread $PTHREAD_LIBS $save_LIBS" - cat >conftest.$ac_ext <<_ACEOF - /* confdefs.h. */ - _ACEOF -@@ -24224,7 +24266,7 @@ rm -f core conftest.err conftest.$ac_obj - if test "x$ok" = xyes; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 - $as_echo "yes" >&6; } -- PTHREAD_LIBS="-pthread $PTHREAD_LIBS" -+ PTHREAD_LIBS="-lpthread $PTHREAD_LIBS" - else - { $as_echo "$as_me:$LINENO: result: no" >&5 - $as_echo "no" >&6; } -@@ -25984,6 +26026,197 @@ fi +@@ -23646,6 +23688,108 @@ fi + done + + ++# GNU ++ ++for ac_func in strndup ++do ++as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ++{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 ++$as_echo_n "checking for $ac_func... " >&6; } ++if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then ++ $as_echo_n "(cached) " >&6 ++else ++ cat >conftest.$ac_ext <<_ACEOF ++/* confdefs.h. */ ++_ACEOF ++cat confdefs.h >>conftest.$ac_ext ++cat >>conftest.$ac_ext <<_ACEOF ++/* end confdefs.h. */ ++/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func. ++ For example, HP-UX 11i <limits.h> declares gettimeofday. */ ++#define $ac_func innocuous_$ac_func ++ ++/* System header to define __stub macros and hopefully few prototypes, ++ which can conflict with char $ac_func (); below. ++ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since ++ <limits.h> exists even on freestanding compilers. */ ++ ++#ifdef __STDC__ ++# include <limits.h> ++#else ++# include <assert.h> ++#endif ++ ++#undef $ac_func ++ ++/* Override any GCC internal prototype to avoid an error. ++ Use char because int might match the return type of a GCC ++ builtin and then its argument prototype would still apply. */ ++#ifdef __cplusplus ++extern "C" ++#endif ++char $ac_func (); ++/* The GNU C library defines this for functions which it implements ++ to always fail with ENOSYS. Some functions are actually named ++ something starting with __ and the normal name is an alias. */ ++#if defined __stub_$ac_func || defined __stub___$ac_func ++choke me ++#endif ++ ++int ++main () ++{ ++return $ac_func (); ++ ; ++ return 0; ++} ++_ACEOF ++rm -f conftest.$ac_objext conftest$ac_exeext ++if { (ac_try="$ac_link" ++case "(($ac_try" in ++ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; ++ *) ac_try_echo=$ac_try;; ++esac ++eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" ++$as_echo "$ac_try_echo") >&5 ++ (eval "$ac_link") 2>conftest.er1 ++ ac_status=$? ++ grep -v '^ *+' conftest.er1 >conftest.err ++ rm -f conftest.er1 ++ cat conftest.err >&5 ++ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 ++ (exit $ac_status); } && { ++ test -z "$ac_c_werror_flag" || ++ test ! -s conftest.err ++ } && test -s conftest$ac_exeext && { ++ test "$cross_compiling" = yes || ++ $as_test_x conftest$ac_exeext ++ }; then ++ eval "$as_ac_var=yes" ++else ++ $as_echo "$as_me: failed program was:" >&5 ++sed 's/^/| /' conftest.$ac_ext >&5 ++ ++ eval "$as_ac_var=no" ++fi ++ ++rm -rf conftest.dSYM ++rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ ++ conftest$ac_exeext conftest.$ac_ext ++fi ++ac_res=`eval 'as_val=${'$as_ac_var'} ++ $as_echo "$as_val"'` ++ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 ++$as_echo "$ac_res" >&6; } ++if test `eval 'as_val=${'$as_ac_var'} ++ $as_echo "$as_val"'` = yes; then ++ cat >>confdefs.h <<_ACEOF ++#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 ++_ACEOF ++ ++fi ++done ++ ++ + #### POSIX threads #### + + +@@ -25984,6 +26128,197 @@ fi @@ -562,7 +602,7 @@ ### PulseAudio (optional) #### # Check whether --enable-pulse was given. -@@ -26465,6 +26698,7 @@ HAVE_DSO=0 +@@ -26465,6 +26800,7 @@ HAVE_DSO=0 BUILTIN_DSO=0 BUILTIN_PULSE=0 BUILTIN_ALSA=0 @@ -570,7 +610,7 @@ BUILTIN_NULL=0 case "x$with_builtin" in -@@ -26477,6 +26711,7 @@ $as_echo "$as_me: error: *** PulseAudio +@@ -26477,6 +26813,7 @@ $as_echo "$as_me: error: *** PulseAudio BUILTIN_PULSE=1 HAVE_ALSA=0 @@ -578,7 +618,7 @@ HAVE_NULL=0 ;; -@@ -26488,10 +26723,24 @@ $as_echo "$as_me: error: *** ALSA select +@@ -26488,10 +26825,24 @@ $as_echo "$as_me: error: *** ALSA select fi BUILTIN_ALSA=1 @@ -603,7 +643,7 @@ xnull) if test "x$HAVE_NULL" != x1 ; then { { $as_echo "$as_me:$LINENO: error: *** Null output selected for builtin driver, but not enabled. ***" >&5 -@@ -26502,6 +26751,7 @@ $as_echo "$as_me: error: *** Null output +@@ -26502,6 +26853,7 @@ $as_echo "$as_me: error: *** Null output BUILTIN_NULL=1 HAVE_PULSE=0 HAVE_ALSA=0 @@ -611,7 +651,7 @@ ;; xdso) -@@ -26520,7 +26770,7 @@ $as_echo "$as_me: error: *** Unknown dri +@@ -26520,7 +26872,7 @@ $as_echo "$as_me: error: *** Unknown dri { (exit 1); exit 1; }; } esac @@ -620,7 +660,7 @@ { { $as_echo "$as_me:$LINENO: error: *** No backend enabled. ***" >&5 $as_echo "$as_me: error: *** No backend enabled. ***" >&2;} { (exit 1); exit 1; }; } -@@ -26534,6 +26784,8 @@ fi +@@ -26534,6 +26886,8 @@ fi @@ -629,7 +669,7 @@ if test "x$HAVE_PULSE" = x1; then HAVE_PULSE_TRUE= HAVE_PULSE_FALSE='#' -@@ -26550,6 +26802,14 @@ else +@@ -26550,6 +26904,14 @@ else HAVE_ALSA_FALSE= fi @@ -644,7 +684,7 @@ if test "x$HAVE_NULL" = x1; then HAVE_NULL_TRUE= HAVE_NULL_FALSE='#' -@@ -26582,6 +26842,14 @@ else +@@ -26582,6 +26944,14 @@ else BUILTIN_ALSA_FALSE= fi @@ -659,7 +699,7 @@ if test "x$BUILTIN_NULL" = x1; then BUILTIN_NULL_TRUE= BUILTIN_NULL_FALSE='#' -@@ -26875,6 +27143,13 @@ $as_echo "$as_me: error: conditional \"H +@@ -26875,6 +27245,13 @@ $as_echo "$as_me: error: conditional \"H Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi @@ -673,7 +713,7 @@ if test -z "${HAVE_NULL_TRUE}" && test -z "${HAVE_NULL_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"HAVE_NULL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 -@@ -26903,6 +27178,13 @@ $as_echo "$as_me: error: conditional \"B +@@ -26903,6 +27280,13 @@ $as_echo "$as_me: error: conditional \"B Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi @@ -687,7 +727,7 @@ if test -z "${BUILTIN_NULL_TRUE}" && test -z "${BUILTIN_NULL_FALSE}"; then { { $as_echo "$as_me:$LINENO: error: conditional \"BUILTIN_NULL\" was never defined. Usually this means the macro was only invoked conditionally." >&5 -@@ -27262,9 +27544,9 @@ _ACEOF +@@ -27262,9 +27646,9 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. @@ -700,7 +740,7 @@ _ACEOF -@@ -27717,9 +27999,9 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_writ +@@ -27717,9 +28101,9 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_writ } split(mac1, mac2, "(") #) macro = mac2[1] @@ -711,7 +751,7 @@ print prefix "define", macro P[macro] D[macro] next } else { -@@ -27727,7 +28009,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_writ +@@ -27727,7 +28111,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_writ # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { @@ -720,7 +760,7 @@ next } } -@@ -28244,193 +28526,6 @@ if test "$no_create" != yes; then +@@ -28244,193 +28628,6 @@ if test "$no_create" != yes; then # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi @@ -914,7 +954,7 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:$LINENO: WARNING: Unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2;} -@@ -28461,6 +28556,15 @@ if test "x$BUILTIN_ALSA" = "x1" ; then +@@ -28461,6 +28658,15 @@ if test "x$BUILTIN_ALSA" = "x1" ; then ENABLE_BUILTIN_ALSA=yes fi @@ -930,7 +970,7 @@ ENABLE_NULL=no if test "x$HAVE_NULL" = "x1" ; then ENABLE_NULL=yes -@@ -28490,6 +28594,8 @@ echo " +@@ -28490,6 +28696,8 @@ echo " Builtin PulseAudio: ${ENABLE_BUILTIN_PULSE} Enable ALSA: ${ENABLE_ALSA} Builtin ALSA: ${ENABLE_BUILTIN_ALSA} diff --git a/audio/libcanberra/files/patch-configure.ac b/audio/libcanberra/files/patch-configure.ac index 324d80d3b..c51667542 100644 --- a/audio/libcanberra/files/patch-configure.ac +++ b/audio/libcanberra/files/patch-configure.ac @@ -1,6 +1,16 @@ ---- configure.ac.orig 2008-08-09 15:27:28.000000000 -0400 -+++ configure.ac 2008-08-09 15:27:59.000000000 -0400 -@@ -219,6 +219,35 @@ fi +--- configure.ac.orig 2008-08-20 13:18:28.404065000 -0400 ++++ configure.ac 2008-08-20 13:24:02.000000000 -0400 +@@ -139,6 +139,9 @@ AC_CHECK_FUNCS([strerror_r]) + # BSD + AC_CHECK_FUNCS([lstat]) + ++# GNU ++AC_CHECK_FUNCS([strndup]) ++ + #### POSIX threads #### + + ACX_PTHREAD +@@ -199,6 +202,35 @@ fi AC_SUBST(ALSA_CFLAGS) AC_SUBST(ALSA_LIBS) @@ -36,7 +46,7 @@ ### PulseAudio (optional) #### AC_ARG_ENABLE([pulse], -@@ -333,6 +362,7 @@ HAVE_DSO=0 +@@ -336,6 +368,7 @@ HAVE_DSO=0 BUILTIN_DSO=0 BUILTIN_PULSE=0 BUILTIN_ALSA=0 @@ -44,7 +54,7 @@ BUILTIN_NULL=0 case "x$with_builtin" in -@@ -343,6 +373,7 @@ case "x$with_builtin" in +@@ -346,6 +379,7 @@ case "x$with_builtin" in BUILTIN_PULSE=1 HAVE_ALSA=0 @@ -52,7 +62,7 @@ HAVE_NULL=0 ;; -@@ -352,10 +383,22 @@ case "x$with_builtin" in +@@ -355,10 +389,22 @@ case "x$with_builtin" in fi BUILTIN_ALSA=1 @@ -75,7 +85,7 @@ xnull) if test "x$HAVE_NULL" != x1 ; then AC_MSG_ERROR([*** Null output selected for builtin driver, but not enabled. ***]) -@@ -364,6 +407,7 @@ case "x$with_builtin" in +@@ -367,6 +413,7 @@ case "x$with_builtin" in BUILTIN_NULL=1 HAVE_PULSE=0 HAVE_ALSA=0 @@ -83,7 +93,7 @@ ;; xdso) -@@ -376,24 +420,28 @@ case "x$with_builtin" in +@@ -379,24 +426,28 @@ case "x$with_builtin" in AC_MSG_ERROR([*** Unknown driver $with_builtin selected for builtin ***]) esac @@ -113,7 +123,7 @@ AM_CONDITIONAL([BUILTIN_NULL], [test "x$BUILTIN_NULL" = x1]) GTK_DOC_CHECK(1.9) -@@ -435,6 +483,15 @@ if test "x$BUILTIN_ALSA" = "x1" ; then +@@ -440,6 +491,15 @@ if test "x$BUILTIN_ALSA" = "x1" ; then ENABLE_BUILTIN_ALSA=yes fi @@ -129,7 +139,7 @@ ENABLE_NULL=no if test "x$HAVE_NULL" = "x1" ; then ENABLE_NULL=yes -@@ -464,6 +521,8 @@ echo " +@@ -469,6 +529,8 @@ echo " Builtin PulseAudio: ${ENABLE_BUILTIN_PULSE} Enable ALSA: ${ENABLE_ALSA} Builtin ALSA: ${ENABLE_BUILTIN_ALSA} diff --git a/audio/libcanberra/files/patch-src_malloc.c b/audio/libcanberra/files/patch-src_malloc.c new file mode 100644 index 000000000..fc7b4e86c --- /dev/null +++ b/audio/libcanberra/files/patch-src_malloc.c @@ -0,0 +1,32 @@ +--- src/malloc.c.orig 2008-08-20 13:22:07.000000000 -0400 ++++ src/malloc.c 2008-08-20 13:22:31.000000000 -0400 +@@ -58,3 +58,29 @@ char *ca_sprintf_malloc(const char *form + size *= 2; + } + } ++ ++#ifndef HAVE_STRNDUP ++char *ca_strndup (const char *s, size_t n) { ++ size_t n_avail; ++ char *p; ++ ++ if (!s) { ++ return NULL; ++ } ++ ++ if (memchr (s, '\0', n) != NULL) { ++ n_avail = strlen (s); ++ if (n_avail > n) ++ n_avail = n; ++ } else { ++ n_avail = n; ++ } ++ p = ca_malloc (n_avail + 1); ++ if (p == NULL) ++ return NULL; ++ memcpy (p, s, n_avail); ++ p[n_avail] = '\0'; ++ ++ return p; ++} ++#endif diff --git a/audio/libcanberra/files/patch-src_malloc.h b/audio/libcanberra/files/patch-src_malloc.h index 58efa3096..81b740482 100644 --- a/audio/libcanberra/files/patch-src_malloc.h +++ b/audio/libcanberra/files/patch-src_malloc.h @@ -1,35 +1,14 @@ ---- src/malloc.h.orig 2008-06-10 10:42:46.000000000 -0400 -+++ src/malloc.h 2008-08-05 23:34:40.000000000 -0400 -@@ -31,6 +31,32 @@ +--- src/malloc.h.orig 2008-08-20 13:18:28.404065000 -0400 ++++ src/malloc.h 2008-08-20 13:19:57.000000000 -0400 +@@ -31,7 +31,11 @@ #define ca_free free #define ca_malloc0(size) calloc(1, (size)) #define ca_strdup strdup -+#ifdef __FreeBSD__ -+static inline char *strndup (const char *s, size_t n) -+{ -+ size_t nAvail; -+ char *p; -+ -+ if (!s) { -+ return NULL; -+ } -+ -+ if (memchr (s, '\0', n) != NULL) { -+ nAvail = strlen (s); -+ if (nAvail > n) -+ nAvail = n; -+ } else { -+ nAvail = n; -+ } -+ p = ca_malloc (nAvail + 1); -+ if (p == NULL) -+ return NULL; -+ memcpy (p, s, nAvail); -+ p[nAvail] = '\0'; -+ -+ return p; -+} -+#endif ++#ifdef HAVE_STRNDUP #define ca_strndup strndup ++#else ++char *ca_strndup(const char *s, size_t n); ++#endif void* ca_memdup(const void* p, size_t size); + diff --git a/audio/libcanberra/files/patch-src_oss.c b/audio/libcanberra/files/patch-src_oss.c index 6a6a41166..1df5406fd 100644 --- a/audio/libcanberra/files/patch-src_oss.c +++ b/audio/libcanberra/files/patch-src_oss.c @@ -1,11 +1,11 @@ ---- src/oss.c.orig 2008-08-10 01:57:54.353155000 -0400 -+++ src/oss.c 2008-08-10 02:12:43.640204000 -0400 -@@ -0,0 +1,476 @@ +--- src/oss.c.orig 2008-08-20 13:45:45.835585000 -0400 ++++ src/oss.c 2008-08-20 13:48:16.000000000 -0400 +@@ -0,0 +1,495 @@ +/*** + This file is part of libcanberra. + + Copyright 2008 Lennart Poettering -+ Joe Marcus Clarke ++ Joe Marcus Clarke + + libcanberra is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as @@ -29,6 +29,7 @@ +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/uio.h> ++#include <math.h> +#include <unistd.h> + +#ifdef HAVE_MACHINE_SOUNDCARD_H @@ -95,7 +96,7 @@ + + if (o->pcm > -1) { + close(o->pcm); -+ o->pcm = -1; ++ o->pcm = -1; + } + + ca_free(o); @@ -218,6 +219,8 @@ + return CA_ERROR_OOM; + case EBUSY: + return CA_ERROR_NOTAVAILABLE; ++ case EINVAL: ++ return CA_ERROR_INVALID; + default: + if (ca_debug()) + fprintf(stderr, "Got unhandled error from OSS: %s\n", strerror(error)); @@ -229,6 +232,7 @@ + struct private *p; + int mode; + int val; ++ int test; + int ret; + + ca_return_val_if_fail(c, CA_ERROR_INVALID); @@ -245,32 +249,48 @@ + fcntl(out->pcm, F_SETFL, mode); + + switch (ca_sound_file_get_sample_type(out->file)) { -+ case CA_SAMPLE_U8: -+ val = AFMT_U8; -+ break; -+ case CA_SAMPLE_S16NE: -+ val = AFMT_S16_NE; -+ break; -+ case CA_SAMPLE_S16RE: ++ case CA_SAMPLE_U8: ++ val = AFMT_U8; ++ break; ++ case CA_SAMPLE_S16NE: ++ val = AFMT_S16_NE; ++ break; ++ case CA_SAMPLE_S16RE: +#if _BYTE_ORDER == _LITTLE_ENDIAN -+ val = AFMT_S16_BE; ++ val = AFMT_S16_BE; +#else -+ val = AFMT_S16_LE; ++ val = AFMT_S16_LE; +#endif -+ break; ++ break; + } + + if (ioctl(out->pcm, SNDCTL_DSP_SETFMT, &val) < 0) + goto finish; + -+ val = ca_sound_file_get_nchannels(out->file) > 1 ? 1 : 0; -+ if (ioctl(out->pcm, SNDCTL_DSP_STEREO, &val) < 0) -+ goto finish; ++ if (ioctl(out->pcm, SNDCTL_DSP_GETFMTS, &test) < 0) ++ goto finish; ++ ++ if ((val & test) == 0) { ++ errno = EINVAL; ++ goto finish; ++ } ++ ++ val = ca_sound_file_get_nchannels(out->file); ++ if (ioctl(out->pcm, SNDCTL_DSP_CHANNELS, &val) < 0) ++ goto finish; + -+ val = ca_sound_file_get_rate(out->file); ++ val = test = ca_sound_file_get_rate(out->file); + if (ioctl(out->pcm, SNDCTL_DSP_SPEED, &val) < 0) + goto finish; + ++ /* Taken from esound. Check to make sure the configured rate is close ++ * enough to the requested rate. ++ */ ++ if (fabs((double) (val - test)) > test * 0.05) { ++ errno = EINVAL; ++ goto finish; ++ } ++ + return CA_SUCCESS; + +finish: @@ -347,9 +367,8 @@ + } + + if ((bytes_written = write(out->pcm, d, nbytes)) <= 0) { -+ ret = errno; -+ goto finish; -+ ++ ret = errno; ++ goto finish; + } + + nbytes -= bytes_written; |