From 84e65c763d8fd09afbfd9743174ad4a81d597783 Mon Sep 17 00:00:00 2001 From: Mans Rullgard Date: Sun, 14 Oct 2012 17:56:00 +0100 Subject: [PATCH 1/2] build: simplify enabling of compat objects Add a configure function to pull in a compat object and set up redirects in one operation. This avoids duplicating conditions across configure and makefiles. Signed-off-by: Mans Rullgard --- configure | 15 +++++++++++---- libavutil/Makefile | 3 +-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/configure b/configure index e6b2a31305..5240a7cbbe 100755 --- a/configure +++ b/configure @@ -641,6 +641,12 @@ add_host_ldflags(){ append host_ldflags $($host_ldflags_filter "$@") } +add_compat(){ + append compat_objs $1 + shift + map 'add_cppflags -D$v' "$@" +} + check_cmd(){ log "$@" "$@" >> $logfile 2>&1 @@ -2906,10 +2912,10 @@ elif check_cpp_condition newlib.h "defined _NEWLIB_VERSION"; then libc_type=newlib elif check_func_headers stdlib.h _get_doserrno; then libc_type=msvcrt - add_cflags -Dstrtod=avpriv_strtod - add_cflags -Dsnprintf=avpriv_snprintf \ - -D_snprintf=avpriv_snprintf \ - -Dvsnprintf=avpriv_vsnprintf + add_compat strtod.o strtod=avpriv_strtod + add_compat msvcrt/snprintf.o snprintf=avpriv_snprintf \ + _snprintf=avpriv_snprintf \ + vsnprintf=avpriv_vsnprintf elif check_cpp_condition stddef.h "defined __KLIBC__"; then libc_type=klibc fi @@ -3753,6 +3759,7 @@ CFLAGS-avplay=$sdl_cflags ZLIB=$($ldflags_filter -lz) LIB_INSTALL_EXTRA_CMD=$LIB_INSTALL_EXTRA_CMD EXTRALIBS=$extralibs +COMPAT_OBJS=$compat_objs INSTALL=install LIBTARGET=${LIBTARGET} SLIBNAME=${SLIBNAME} diff --git a/libavutil/Makefile b/libavutil/Makefile index e2b84e0cc2..a85d3ae153 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -88,8 +88,7 @@ OBJS = adler32.o \ utils.o \ xtea.o \ -OBJS-$(HAVE_MSVCRT) += ../compat/msvcrt/snprintf.o \ - ../compat/strtod.o +OBJS += $(COMPAT_OBJS:%=../compat/%) SKIPHEADERS = old_pix_fmts.h From c1fcfdec75468009dc7de29a5d1c6adf3b2ef77d Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 12 Oct 2012 21:14:56 +0200 Subject: [PATCH 2/2] rangecoder-test: Return in case of an error --- libavcodec/rangecoder.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavcodec/rangecoder.c b/libavcodec/rangecoder.c index 147e58de40..df1000844e 100644 --- a/libavcodec/rangecoder.c +++ b/libavcodec/rangecoder.c @@ -150,8 +150,10 @@ STOP_TIMER("put_rac") for (i = 0; i < SIZE; i++) { START_TIMER - if ((r[i] & 1) != get_rac(&c, state)) + if ((r[i] & 1) != get_rac(&c, state)) { av_log(NULL, AV_LOG_ERROR, "rac failure at %d\n", i); + return 1; + } STOP_TIMER("get_rac") }