From 0c2a302948d7e2ca5938e19bdc6c66649c7b6a34 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Wed, 29 Feb 2012 22:49:18 +0200 Subject: configure: show PKG_CONFIG_PATH and CFLAGS in config.log When the build wrapper repo scripts run configure they set a custom PKG_CONFIG_PATH environment variable. Show the value of this in config.log to make it easier to rerun configure with a tweaked version of the same parameters. Also show CFLAGS if set, as it's likely to break things. --- configure | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 4a1f9ddd9c..f59b1b5a73 100755 --- a/configure +++ b/configure @@ -1374,7 +1374,14 @@ TMPH="$mplayer_tmpdir/tmp.h" TMPS="$mplayer_tmpdir/tmp.S" rm -f "$TMPLOG" -echo configuration: $configuration > "$TMPLOG" +echo Parameters configure was run with: > "$TMPLOG" +if test -n "$CFLAGS" ; then + echo ${_echo_n} CFLAGS="'$CFLAGS' ${_echo_c}" >> "$TMPLOG" +fi +if test -n "$PKG_CONFIG_PATH" ; then + echo ${_echo_n} PKG_CONFIG_PATH="'$PKG_CONFIG_PATH' ${_echo_c}" >> "$TMPLOG" +fi +echo ./configure $configuration >> "$TMPLOG" echo >> "$TMPLOG" -- cgit v1.2.3 From 75bc1591e8be6c4f39e67dcaff8f1564ff4ffd02 Mon Sep 17 00:00:00 2001 From: Kovensky Date: Mon, 2 Aug 2010 01:21:51 -0300 Subject: configure: fix target triplet check for mingw targets mingw32 and mingw64's recommended triplets are i686-pc-mingw32 / x86_64-w64-mingw32, neither has mingw32 in the middle. --- configure | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/configure b/configure index f59b1b5a73..b28b38d6d5 100755 --- a/configure +++ b/configure @@ -1268,21 +1268,25 @@ if test -z "$_target" ; then ;; esac else # if test -z "$_target" - system_name=$(echo $_target | cut -d '-' -f 2) - case "$(echo $system_name | tr A-Z a-z)" in - linux) system_name=Linux ;; - freebsd) system_name=FreeBSD ;; - gnu/kfreebsd) system_name=FreeBSD ;; - netbsd) system_name=NetBSD ;; - bsd/os) system_name=BSD/OS ;; - openbsd) system_name=OpenBSD ;; - dragonfly) system_name=DragonFly ;; - sunos) system_name=SunOS ;; - qnx) system_name=QNX ;; - morphos) system_name=MorphOS ;; - amigaos) system_name=AmigaOS ;; - mingw32*) system_name=MINGW32 ;; - esac + for i in 2 3; do + system_name=$(echo $_target | cut -d '-' -f $i) + case "$(echo $system_name | tr A-Z a-z)" in + linux) system_name=Linux ;; + freebsd) system_name=FreeBSD ;; + gnu/kfreebsd) system_name=FreeBSD ;; + netbsd) system_name=NetBSD ;; + bsd/os) system_name=BSD/OS ;; + openbsd) system_name=OpenBSD ;; + dragonfly) system_name=DragonFly ;; + sunos) system_name=SunOS ;; + qnx) system_name=QNX ;; + morphos) system_name=MorphOS ;; + amigaos) system_name=AmigaOS ;; + mingw32*) system_name=MINGW32 ;; + *) continue ;; + esac + break + done # We need to convert underscores so that values like k6-2 and pentium-mmx can be passed host_arch=$(echo $_target | cut -d '-' -f 1) if test $(echo $host_arch) != "x86_64" ; then -- cgit v1.2.3 From cca0b196bac19dac82ba778ef5527ba0b9431925 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 31 Jan 2012 19:36:16 +0100 Subject: configure: disable cross compilation auto detection This didn't work very well when cross compiling from Linux to Windows: it tries to execute an .exe file, which succeeds if wine is installed. As consequence it detects "no" as result. In general this won't work if emulation for the target architecture is available. Remove it. --- configure | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/configure b/configure index b28b38d6d5..c5c99c7d33 100755 --- a/configure +++ b/configure @@ -476,7 +476,7 @@ Available values for --language-msg are: all $msg_lang_all Miscellaneous options: --enable-runtime-cpudetection enable runtime CPU detection [disable] - --enable-cross-compile enable cross-compilation [autodetect] + --enable-cross-compile enable cross-compilation [disable] --cc=COMPILER C compiler to build MPlayer [gcc] --host-cc=COMPILER C compiler for tools needed while building [gcc] --as=ASSEMBLER assembler to build MPlayer [as] @@ -560,7 +560,7 @@ _as=auto _nm=auto _yasm=yasm _runtime_cpudetection=no -_cross_compile=auto +_cross_compile=no _prefix="/usr/local" ffmpeg=auto ffmpeg_internals=no @@ -1478,9 +1478,10 @@ echo "Detected operating system: $system_name" echo "Detected host architecture: $host_arch" echocheck "cross compilation" -if test $_cross_compile = auto ; then +if test $_cross_compile = yes ; then _cross_compile=yes - cflag_check "" && "$TMPEXE" && _cross_compile=no +else + _cross_compile=no fi echores $_cross_compile -- cgit v1.2.3 From 2e2c03ecb1c6c3681179d105241b64256cfde600 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 31 Jan 2012 08:29:53 +0100 Subject: configure: use cross toolchain if --target is given If --enable-cross-compile is specified, passing --target=i686-w64-mingw32 for example will check if i686-w64-mingw32-gcc can be used. This is only done if the compiler isn't specified via --cc or the CC environment variable. The same is done for some other build tools, such as pkg-config. (Only the C compiler will try to use a fallback in this case.) --- configure | 105 ++++++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 61 insertions(+), 44 deletions(-) diff --git a/configure b/configure index c5c99c7d33..053e00dc74 100755 --- a/configure +++ b/configure @@ -551,14 +551,15 @@ neon=auto _iwmmxt=auto _altivec=auto _install=install -_ranlib=ranlib -_windres=windres -_cc=cc -_ar=ar +_pkg_config=auto +_ranlib=auto +_windres=auto +_cc=auto +_ar=auto test "$CC" && _cc="$CC" _as=auto _nm=auto -_yasm=yasm +_yasm=auto _runtime_cpudetection=no _cross_compile=no _prefix="/usr/local" @@ -1198,6 +1199,58 @@ test -z "$_confdir" && _confdir="$_prefix/etc/mplayer" test -z "$_libdir" && _libdir="$_prefix/lib" test -z "$_localedir" && _localedir="$_prefix/share/locale" +for tmpdir in "$TMPDIR" "$TEMPDIR" "/tmp" ; do + test "$tmpdir" && break +done + +mplayer_tmpdir="$tmpdir/mplayer-configure-$RANDOM-$$" +mkdir $mplayer_tmpdir || die "Unable to create tmpdir." + +TMPLOG="config.log" + +rm -f "$TMPLOG" +echo Parameters configure was run with: > "$TMPLOG" +if test -n "$CFLAGS" ; then + echo ${_echo_n} CFLAGS="'$CFLAGS' ${_echo_c}" >> "$TMPLOG" +fi +if test -n "$PKG_CONFIG_PATH" ; then + echo ${_echo_n} PKG_CONFIG_PATH="'$PKG_CONFIG_PATH' ${_echo_c}" >> "$TMPLOG" +fi +echo ./configure $configuration >> "$TMPLOG" +echo >> "$TMPLOG" + + +echocheck "cross compilation" +echores $_cross_compile + +if test $_cross_compile = yes; then + tmp_run() { + return 0 + } + test "$_host_cc" || _host_cc=cc +fi + +tool_prefix="" + +if test $_cross_compile = yes ; then + # Usually cross-compiler prefixes match with the target triplet + test -n "$_target" && tool_prefix="$_target"- +fi + +test "$_ranlib" = auto && _ranlib="$tool_prefix"ranlib +test "$_windres" = auto && _windres="$tool_prefix"windres +test "$_ar" = auto && _ar="$tool_prefix"ar +test "$_yasm" = auto && _yasm="$tool_prefix"yasm +test "$_pkg_config" = auto && _pkg_config="$tool_prefix"pkg-config + +if test "$_cc" = auto ; then + if test -n "$tool_prefix" ; then + _cc="$tool_prefix"gcc + else + _cc=cc + fi +fi + # Determine our OS name and CPU architecture if test -z "$_target" ; then # OS name @@ -1363,32 +1416,12 @@ if os2 ; then def_priority="#define CONFIG_PRIORITY 1" fi -for tmpdir in "$TMPDIR" "$TEMPDIR" "/tmp" ; do - test "$tmpdir" && break -done - -mplayer_tmpdir="$tmpdir/mplayer-configure-$RANDOM-$$" -mkdir $mplayer_tmpdir || die "Unable to create tmpdir." - -TMPLOG="config.log" TMPC="$mplayer_tmpdir/tmp.c" TMPCPP="$mplayer_tmpdir/tmp.cpp" TMPEXE="$mplayer_tmpdir/tmp$_exesuf" TMPH="$mplayer_tmpdir/tmp.h" TMPS="$mplayer_tmpdir/tmp.S" -rm -f "$TMPLOG" -echo Parameters configure was run with: > "$TMPLOG" -if test -n "$CFLAGS" ; then - echo ${_echo_n} CFLAGS="'$CFLAGS' ${_echo_c}" >> "$TMPLOG" -fi -if test -n "$PKG_CONFIG_PATH" ; then - echo ${_echo_n} PKG_CONFIG_PATH="'$PKG_CONFIG_PATH' ${_echo_c}" >> "$TMPLOG" -fi -echo ./configure $configuration >> "$TMPLOG" -echo >> "$TMPLOG" - - if test "$_runtime_cpudetection" = yes && ! x86 && ! ppc; then die "Runtime CPU detection only works for x86, x86-64 and PPC!" fi @@ -1474,28 +1507,13 @@ EOF cc_check && host_arch=x86_64 || host_arch=i386 fi -echo "Detected operating system: $system_name" -echo "Detected host architecture: $host_arch" - -echocheck "cross compilation" -if test $_cross_compile = yes ; then - _cross_compile=yes -else - _cross_compile=no -fi -echores $_cross_compile - -if test $_cross_compile = yes; then - tmp_run() { - return 0 - } - test "$_host_cc" || _host_cc=cc -fi - echocheck "host cc" test "$_host_cc" || _host_cc=$_cc echores $_host_cc +echo "Detected operating system: $system_name" +echo "Detected host architecture: $host_arch" + # --- # now that we know what compiler should be used for compilation, try to find @@ -3623,7 +3641,6 @@ echores "$_apple_ir" fi #if linux echocheck "pkg-config" -_pkg_config=pkg-config if $($_pkg_config --version > /dev/null 2>&1); then if test "$_ld_static"; then _pkg_config="$_pkg_config --static" -- cgit v1.2.3 From 7332ae76b789fa0feda14a3f4ff880808e438d6a Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 31 Jan 2012 08:30:09 +0100 Subject: configure: allow changing pkg-config binary with --pkg-config --- configure | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure b/configure index 053e00dc74..1b66ca7b17 100755 --- a/configure +++ b/configure @@ -483,6 +483,7 @@ Miscellaneous options: --nm=NM nm tool to build MPlayer [nm] --yasm=YASM Yasm assembler to build MPlayer [yasm] --ar=AR librarian to build MPlayer [ar] + --pkg-config=PKGCONFIG pkg-config to find some libraries [pkg-config] --ranlib=RANLIB ranlib to build MPlayer [ranlib] --windres=WINDRES windres to build MPlayer [windres] --target=PLATFORM target platform (i386-linux, arm-linux, etc) @@ -800,6 +801,9 @@ for ac_option do --ar=*) _ar=$(echo $ac_option | cut -d '=' -f 2) ;; + --pkg-config=*) + _pkg_config=$(echo $ac_option | cut -d '=' -f 2) + ;; --ranlib=*) _ranlib=$(echo $ac_option | cut -d '=' -f 2) ;; -- cgit v1.2.3 From 3dbb18d91a0d4b17f0187e3b5faa3b6f3cd1b31e Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 20 Oct 2011 08:13:14 +0200 Subject: windows support: remove _UWIN define The _UWIN define causes the mingw headers not to declare deprecated (on Windows) function names such as open and mkdir. But the code uses these. I have no idea why this used to work (if it even did), but the original reason why it was defined seems to have vanished. --- mplayer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mplayer.c b/mplayer.c index 3fef3b1f12..cdcd1d645e 100644 --- a/mplayer.c +++ b/mplayer.c @@ -28,7 +28,6 @@ #include "talloc.h" #if defined(__MINGW32__) || defined(__CYGWIN__) -#define _UWIN 1 /*disable Non-underscored versions of non-ANSI functions as otherwise int eof would conflict with eof()*/ #include #endif #include -- cgit v1.2.3 From eebe9309ecd70f86f0a52f09712db833df589206 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 31 Jan 2012 08:31:04 +0100 Subject: configure: add __USE_MINGW_ANSI_STDIO on MinGW This makes MinGW redirect certain stdio functions (such as the sprintf family) from the MSVCRT libc to a standard compliant MinGW implementation. This fixes a crash in talloc.c when compiling mplayer with MinGW-w64. The problem is most likely with talloc_vasprintf(), which calls vsnprintf with a small buffer and checks its return value to find out how much space the formatted string requires. Without this commit, vsnprintf would always return -1, and then the code calls abort(). (lachs0r figured out this one.) --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 1b66ca7b17..fd3bfc83bd 100755 --- a/configure +++ b/configure @@ -1397,6 +1397,7 @@ fi if mingw32 ; then _getch=getch2-win.c need_shmem=no + extra_cflags="$extra_cflags -D__USE_MINGW_ANSI_STDIO=1" fi if amigaos ; then -- cgit v1.2.3 From 25417a626d0b9077bfbb940952f3858d7b8b549b Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 31 Jan 2012 08:32:06 +0100 Subject: windows: fix format string attributes on MinGW MinGW maps the "printf" format string archetype to the non-standard MSVCRT functions, even if __USE_MINGW_ANSI_STDIO is defined and set to 1. We need to use "gnu_printf" to use the format strings as provided by vsnprintf and similar functions to get correct warnings. Since "gnu_printf" isn't necessarily available on other GCC compatible compilers (such as clang), do this only on MinGW. --- mp_msg.h | 12 ++++-------- mpcommon.h | 20 ++++++++++++++++++++ talloc.h | 14 ++------------ 3 files changed, 26 insertions(+), 20 deletions(-) diff --git a/mp_msg.h b/mp_msg.h index 6e800aecf2..686ed8316c 100644 --- a/mp_msg.h +++ b/mp_msg.h @@ -130,19 +130,15 @@ void mp_msg_init(void); int mp_msg_test(int mod, int lev); #include "config.h" +#include "mpcommon.h" char *mp_gtext(const char *string); void mp_msg_va(int mod, int lev, const char *format, va_list va); -#ifdef __GNUC__ -void mp_msg(int mod, int lev, const char *format, ... ) __attribute__ ((format (printf, 3, 4))); -void mp_tmsg(int mod, int lev, const char *format, ... ) __attribute__ ((format (printf, 3, 4))); -static inline void mp_dbg(int mod, int lev, const char *format, ...) __attribute__ ((format (printf, 3, 4))); -#else // not GNU C -void mp_msg(int mod, int lev, const char *format, ... ); -void mp_tmsg(int mod, int lev, const char *format, ...) -#endif /* __GNUC__ */ +void mp_msg(int mod, int lev, const char *format, ... ) PRINTF_ATTRIBUTE(3, 4); +void mp_tmsg(int mod, int lev, const char *format, ... ) PRINTF_ATTRIBUTE(3, 4); +static inline void mp_dbg(int mod, int lev, const char *format, ...) PRINTF_ATTRIBUTE(3, 4); static inline void mp_dbg(int mod, int lev, const char *format, ...) { diff --git a/mpcommon.h b/mpcommon.h index fd520eacf6..2ff66fed40 100644 --- a/mpcommon.h +++ b/mpcommon.h @@ -31,6 +31,26 @@ #define MP_RESIZE_ARRAY(ctx, p, count) do { \ p = talloc_realloc_size((ctx), p, (count) * sizeof(p[0])); } while (0) +#ifdef __GNUC__ + +/** Use gcc attribute to check printf fns. a1 is the 1-based index of + * the parameter containing the format, and a2 the index of the first + * argument. **/ +#ifdef __MINGW32__ +// MinGW maps "printf" to the non-standard MSVCRT functions, even if +// __USE_MINGW_ANSI_STDIO is defined and set to 1. We need to use "gnu_printf", +// which isn't necessarily available on other GCC compatible compilers. +#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (gnu_printf, a1, a2))) +#else +#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (printf, a1, a2))) +#endif + +#else + +#define PRINTF_ATTRIBUTE(a1, a2) + +#endif + extern const char *mplayer_version; #endif /* MPLAYER_MPCOMMON_H */ diff --git a/talloc.h b/talloc.h index b60e0fb040..e98dbae902 100644 --- a/talloc.h +++ b/talloc.h @@ -29,6 +29,8 @@ #include #include +#include "mpcommon.h" + /* HACK: libsmbclient uses dynamically linked libtalloc.so which has * identically named symbols. This name collision caused a crash under * stream_smb when trying to play anything with smb://. This hack @@ -54,18 +56,6 @@ typedef void TALLOC_CTX; #define TALLOC_DEPRECATED 0 #endif -#ifndef PRINTF_ATTRIBUTE -#if (__GNUC__ >= 3) -/** Use gcc attribute to check printf fns. a1 is the 1-based index of - * the parameter containing the format, and a2 the index of the first - * argument. Note that some gcc 2.x versions don't handle this - * properly **/ -#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2))) -#else -#define PRINTF_ATTRIBUTE(a1, a2) -#endif -#endif - /* try to make talloc_set_destructor() and talloc_steal() type safe, if we have a recent gcc */ #if (__GNUC__ >= 3) -- cgit v1.2.3 From 24be34f1e9e37111a06108c090324426aff6f1db Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 27 Feb 2012 19:15:13 +0100 Subject: cleanup: Silence compilation warnings on MinGW-w64 Some of the code, especially the dshow and windows codec loader parts, are extremely hacky and likely full of bugs. The goal is merely getting rid of warnings that could obscure more important warnings and actual bugs, instead of fixing actual problems. This reduces the number of warnings from over 500 to almost the same as when compiling on Linux. Note that many problems stem from using the ancient wine-derived windows headers. There are some differences to the "proper" windows header. Changing the code to compile with the proper headers would be too much trouble, and it still has to work on Unix. Some of the changes might actually break compilation on legacy MinGW, but we don't support that anymore. Always use MinGW-w64, even when compiling to 32 bit. Fixes some warnings in the win32 loader code on Linux too. --- command.c | 2 +- libao2/ao_dsound.c | 6 ++++-- libmpcodecs/ad_qtaudio.c | 3 +-- libmpcodecs/ad_twin.c | 4 ++-- libmpcodecs/vd_qtvideo.c | 2 +- libmpcodecs/vd_vfw.c | 4 ++-- libmpdemux/aviheader.h | 2 ++ libvo/vo_directx.c | 6 +++--- libvo/w32_common.c | 14 ++++++++------ loader/afl.c | 2 +- loader/dmo/DMO_VideoDecoder.c | 5 +++-- loader/dshow/DS_Filter.c | 4 ++-- loader/dshow/DS_VideoDecoder.c | 4 ++-- loader/dshow/allocator.c | 2 ++ loader/dshow/graph.c | 32 +++++++++++++++++--------------- loader/dshow/graph.h | 19 ------------------- loader/dshow/outputpin.c | 6 +++--- loader/ext.c | 7 +++---- loader/module.c | 22 +++++++++++----------- loader/pe_image.c | 14 +++++--------- loader/registry.c | 3 +-- loader/win32.c | 18 +++++++++--------- loader/wine/winbase.h | 4 ++-- loader/wine/windef.h | 12 ++++++++---- osdep/getch2-win.c | 4 ++-- osdep/setenv.c | 2 ++ stream/cache2.c | 2 ++ sub/vobsub.c | 4 ++-- 28 files changed, 101 insertions(+), 108 deletions(-) diff --git a/command.c b/command.c index 58dd68454f..5551da715c 100644 --- a/command.c +++ b/command.c @@ -1579,7 +1579,7 @@ static int mp_property_sub(m_option_t *prop, int action, void *arg, { struct MPOpts *opts = &mpctx->opts; demux_stream_t *const d_sub = mpctx->d_sub; - int source = -1, reset_spu = 0; + int source = -1, reset_spu av_unused = 0; // used under CONFIG_DVDREAD int source_pos = -1; update_global_sub_size(mpctx); diff --git a/libao2/ao_dsound.c b/libao2/ao_dsound.c index 605b0f16e0..63cc02e92c 100644 --- a/libao2/ao_dsound.c +++ b/libao2/ao_dsound.c @@ -81,12 +81,14 @@ static const GUID KSDATAFORMAT_SUBTYPE_PCM = {0x1,0x0000,0x0010, {0x80,0x00,0x00 #define SPEAKER_TOP_BACK_RIGHT 0x20000 #define SPEAKER_RESERVED 0x80000000 +#if 0 #define DSSPEAKER_HEADPHONE 0x00000001 #define DSSPEAKER_MONO 0x00000002 #define DSSPEAKER_QUAD 0x00000003 #define DSSPEAKER_STEREO 0x00000004 #define DSSPEAKER_SURROUND 0x00000005 #define DSSPEAKER_5POINT1 0x00000006 +#endif #ifndef _WAVEFORMATEXTENSIBLE_ typedef struct { @@ -337,14 +339,14 @@ static int write_buffer(unsigned char *data, int len) numsamp = dwBytes1 / (ao_data.channels * sampsize); // number of samples for each channel in this buffer for( i = 0; i < numsamp; i++ ) for( j = 0; j < ao_data.channels; j++ ) { - memcpy(lpvPtr1+(i*ao_data.channels*sampsize)+(chantable[j]*sampsize),data+(i*ao_data.channels*sampsize)+(j*sampsize),sampsize); + memcpy((char*)lpvPtr1+(i*ao_data.channels*sampsize)+(chantable[j]*sampsize),data+(i*ao_data.channels*sampsize)+(j*sampsize),sampsize); } if (NULL != lpvPtr2 ) { numsamp = dwBytes2 / (ao_data.channels * sampsize); for( i = 0; i < numsamp; i++ ) for( j = 0; j < ao_data.channels; j++ ) { - memcpy(lpvPtr2+(i*ao_data.channels*sampsize)+(chantable[j]*sampsize),data+dwBytes1+(i*ao_data.channels*sampsize)+(j*sampsize),sampsize); + memcpy((char*)lpvPtr2+(i*ao_data.channels*sampsize)+(chantable[j]*sampsize),data+dwBytes1+(i*ao_data.channels*sampsize)+(j*sampsize),sampsize); } } diff --git a/libmpcodecs/ad_qtaudio.c b/libmpcodecs/ad_qtaudio.c index b6c7ef6299..1edd87cd17 100644 --- a/libmpcodecs/ad_qtaudio.c +++ b/libmpcodecs/ad_qtaudio.c @@ -300,7 +300,6 @@ static void uninit(sh_audio_t *sh){ } static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen){ - int error; unsigned long FramesToGet=0; //how many frames the demuxer has to get unsigned long InputBufferSize=0; //size of the input buffer unsigned long ConvertedFrames=0; @@ -331,7 +330,7 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen) // printf("\nSoundConverterConvertBuffer(myConv=%p,inbuf=%p,frames=%d,outbuf=%p,&convframes=%p,&convbytes=%p)\n", // myConverter,sh->a_in_buffer,FramesToGet,buf,&ConvertedFrames,&ConvertedBytes); - error = SoundConverterConvertBuffer(myConverter,sh->a_in_buffer, + SoundConverterConvertBuffer(myConverter,sh->a_in_buffer, FramesToGet,buf,&ConvertedFrames,&ConvertedBytes); // printf("SoundConverterConvertBuffer:%i\n",error); // printf("ConvertedFrames = %li\n",ConvertedFrames); diff --git a/libmpcodecs/ad_twin.c b/libmpcodecs/ad_twin.c index 954ca17809..9aa304e4fc 100644 --- a/libmpcodecs/ad_twin.c +++ b/libmpcodecs/ad_twin.c @@ -54,8 +54,8 @@ static void (*TvqUpdateVectorInfo)(int varbits, int *ndiv, int bits0[], int bits static int (*TvqCheckVersion)(char *versionID); static void (*TvqGetConfInfo)(tvqConfInfo *cf); -static int (*TvqGetFrameSize)(); -static int (*TvqGetNumFixedBitsPerFrame)(); +static int (*TvqGetFrameSize)(void); +static int (*TvqGetNumFixedBitsPerFrame)(void); #define BYTE_BIT 8 #define BBUFSIZ 1024 /* Bit buffer size (bytes) */ diff --git a/libmpcodecs/vd_qtvideo.c b/libmpcodecs/vd_qtvideo.c index d3dbeacc45..5e37ca456e 100644 --- a/libmpcodecs/vd_qtvideo.c +++ b/libmpcodecs/vd_qtvideo.c @@ -129,7 +129,7 @@ static int init(sh_video_t *sh){ DecompressSequenceFrameS = (OSErr (*)(ImageSequence,Ptr,long,CodecFlags,CodecFlags*,ICMCompletionProcRecordPtr))GetProcAddress(handler, "DecompressSequenceFrameS"); GetGWorldPixMap = (PixMapHandle (*)(GWorldPtr))GetProcAddress(handler, "GetGWorldPixMap"); QTNewGWorldFromPtr = (OSErr(*)(GWorldPtr *,OSType,const Rect *,CTabHandle,void*,GWorldFlags,void *,long))GetProcAddress(handler, "QTNewGWorldFromPtr"); - NewHandleClear = (OSErr(*)(Size))GetProcAddress(handler, "NewHandleClear"); + NewHandleClear = (Handle(*)(Size))GetProcAddress(handler, "NewHandleClear"); DisposeHandle = (void (*)(Handle))GetProcAddress(handler, "DisposeHandle"); DisposeGWorld = (void (*)(GWorldPtr))GetProcAddress(handler, "DisposeGWorld"); CDSequenceEnd = (OSErr (*)(ImageSequence))GetProcAddress(handler, "CDSequenceEnd"); diff --git a/libmpcodecs/vd_vfw.c b/libmpcodecs/vd_vfw.c index 55cc1642f0..331755a2b1 100644 --- a/libmpcodecs/vd_vfw.c +++ b/libmpcodecs/vd_vfw.c @@ -153,7 +153,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){ static int init(sh_video_t *sh){ HRESULT ret; // unsigned int outfmt=sh->codec->outfmt[sh->outfmtidx]; - int i, o_bih_len; + int o_bih_len; vd_vfw_ctx *priv; /* Hack for VSSH codec: new dll can't decode old files @@ -198,7 +198,7 @@ static int init(sh_video_t *sh){ ret = ICDecompressGetFormat(priv->handle, sh->bih, priv->o_bih); if(ret < 0){ mp_msg(MSGT_WIN32,MSGL_ERR,"ICDecompressGetFormat failed: Error %d\n", (int)ret); - for (i=0; i < o_bih_len; i++) mp_msg(MSGT_WIN32, MSGL_DBG2, "%02x ", priv->o_bih[i]); + //for (i=0; i < o_bih_len; i++) mp_msg(MSGT_WIN32, MSGL_DBG2, "%02x ", priv->o_bih[i]); return 0; } mp_msg(MSGT_WIN32,MSGL_V,"ICDecompressGetFormat OK\n"); diff --git a/libmpdemux/aviheader.h b/libmpdemux/aviheader.h index 6c86378a4a..8d226606de 100644 --- a/libmpdemux/aviheader.h +++ b/libmpdemux/aviheader.h @@ -128,8 +128,10 @@ typedef struct { #define AVIIF_NOTIME 0x00000100L // this frame doesn't take any time #define AVIIF_COMPUSE 0x0FFF0000L // these bits are for compressor use +#ifndef FOURCC_RIFF #define FOURCC_RIFF mmioFOURCC('R', 'I', 'F', 'F') #define FOURCC_LIST mmioFOURCC('L', 'I', 'S', 'T') +#endif typedef struct { diff --git a/libvo/vo_directx.c b/libvo/vo_directx.c index 419c0f2b94..d504e23567 100644 --- a/libvo/vo_directx.c +++ b/libvo/vo_directx.c @@ -276,7 +276,7 @@ static uint32_t Directx_CreateOverlay(uint32_t imgfmt) case DDERR_OUTOFVIDEOMEMORY: {mp_msg(MSGT_VO, MSGL_ERR,"not enough video memory\n");break;} default: - mp_msg(MSGT_VO, MSGL_ERR,"create surface failed with 0x%x\n",ddrval); + mp_msg(MSGT_VO, MSGL_ERR,"create surface failed with 0x%xu\n",(unsigned)ddrval); } return 1; } @@ -588,7 +588,7 @@ static uint32_t Directx_ManageDisplay(void) // we should try upping the destination size a bit, or // perhaps shrinking the source size mp_msg(MSGT_VO, MSGL_ERR ,"UpdateOverlay failed\n" ); - mp_msg(MSGT_VO, MSGL_ERR ,"Overlay:x1:%i,y1:%i,x2:%i,y2:%i,w:%i,h:%i\n",rd.left,rd.top,rd.right,rd.bottom,rd.right - rd.left,rd.bottom - rd.top ); + mp_msg(MSGT_VO, MSGL_ERR ,"Overlay:x1:%li,y1:%li,x2:%li,y2:%li,w:%li,h:%li\n",rd.left,rd.top,rd.right,rd.bottom,rd.right - rd.left,rd.bottom - rd.top ); mp_msg(MSGT_VO, MSGL_ERR ,""); switch (ddrval) { @@ -618,7 +618,7 @@ static uint32_t Directx_ManageDisplay(void) break; } default: - mp_msg(MSGT_VO, MSGL_ERR ," 0x%x\n",ddrval); + mp_msg(MSGT_VO, MSGL_ERR ," 0x%xu\n",(unsigned)ddrval); } /*ok we can't do anything about it -> hide overlay*/ if(ddrval != DD_OK) diff --git a/libvo/w32_common.c b/libvo/w32_common.c index a8a59d02c9..475327ce5c 100644 --- a/libvo/w32_common.c +++ b/libvo/w32_common.c @@ -41,6 +41,8 @@ #define MONITOR_DEFAULTTOPRIMARY 1 #endif +#define WIN_ID_TO_HWND(x) ((HWND)(uint32_t)(x)) + static const char classname[] = "MPlayer - The Movie Player"; int vo_vm = 0; @@ -116,7 +118,7 @@ static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l break; case WM_WINDOWPOSCHANGING: if (vo_keepaspect && !vo_fs && WinID < 0) { - WINDOWPOS *wpos = lParam; + WINDOWPOS *wpos = (WINDOWPOS*)lParam; int xborder, yborder; r.left = r.top = 0; r.right = wpos->cx; @@ -232,10 +234,10 @@ int vo_w32_check_events(void) { vo_dx = p.x; vo_dy = p.y; event_flags |= VO_EVENT_MOVE; } - res = GetClientRect(WinID, &r); + res = GetClientRect(WIN_ID_TO_HWND(WinID), &r); if (res && (r.right != vo_dwidth || r.bottom != vo_dheight)) MoveWindow(vo_window, 0, 0, r.right, r.bottom, FALSE); - if (!IsWindow(WinID)) + if (!IsWindow(WIN_ID_TO_HWND(WinID))) // Window has probably been closed, e.g. due to program crash mplayer_put_key(KEY_CLOSE_WIN); } @@ -514,11 +516,11 @@ int vo_w32_init(void) { if (WinID >= 0) { RECT r; - GetClientRect(WinID, &r); + GetClientRect(WIN_ID_TO_HWND(WinID), &r); vo_dwidth = r.right; vo_dheight = r.bottom; vo_window = CreateWindowEx(WS_EX_NOPARENTNOTIFY, classname, classname, - WS_CHILD | WS_VISIBLE, - 0, 0, vo_dwidth, vo_dheight, WinID, 0, hInstance, 0); + WS_CHILD | WS_VISIBLE, 0, 0, vo_dwidth, vo_dheight, + WIN_ID_TO_HWND(WinID), 0, hInstance, 0); EnableWindow(vo_window, 0); } else vo_window = CreateWindowEx(0, classname, classname, diff --git a/loader/afl.c b/loader/afl.c index 337cbcd551..b29471cdce 100644 --- a/loader/afl.c +++ b/loader/afl.c @@ -227,7 +227,7 @@ MMRESULT WINAPI acmDriverOpen(PHACMDRIVER phad, HACMDRIVERID hadid, DWORD fdwOpe return MMSYSERR_ERROR; } - pad->pfnDriverProc = GetProcAddress(pad->hDrvr, "DriverProc"); + pad->pfnDriverProc = (DRIVERPROC)GetProcAddress(pad->hDrvr, "DriverProc"); /* insert new pad at beg of list */ pad->pNextACMDriver = padid->pACMDriverList; diff --git a/loader/dmo/DMO_VideoDecoder.c b/loader/dmo/DMO_VideoDecoder.c index db0cd4c995..dcc0affe2c 100644 --- a/loader/dmo/DMO_VideoDecoder.c +++ b/loader/dmo/DMO_VideoDecoder.c @@ -361,7 +361,7 @@ int DMO_VideoDecoder_DecodeInternal(DMO_VideoDecoder *this, const void* src, int int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int csp) { HRESULT result; - int should_test=1; + //int should_test=1; Debug printf("DMO_VideoDecoder_SetDestFmt (%p, %d, %d)\n",this,bits,(int)csp); @@ -467,7 +467,7 @@ int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int c else this->m_sDestType.cbFormat = sizeof(VIDEOINFOHEADER); - +#if 0 switch(csp) { case fccYUY2: @@ -499,6 +499,7 @@ int DMO_VideoDecoder_SetDestFmt(DMO_VideoDecoder *this, int bits, unsigned int c should_test=false; break; } +#endif #ifdef WIN32_LOADER Setup_FS_Segment(); diff --git a/loader/dshow/DS_Filter.c b/loader/dshow/DS_Filter.c index 693d59c25f..88f881523a 100644 --- a/loader/dshow/DS_Filter.c +++ b/loader/dshow/DS_Filter.c @@ -216,7 +216,7 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, enum_pins->vt->Reset(enum_pins); result = enum_pins->vt->Next(enum_pins, (ULONG)256, (IPin**)array, &fetched); - enum_pins->vt->Release(enum_pins); + enum_pins->vt->Release((IUnknown*)enum_pins); Debug printf("Pins enumeration returned %ld pins, error is %x\n", fetched, (int)result); for (i = 0; i < fetched; i++) @@ -306,7 +306,7 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, init++; break; } - tempAll->vt->Release(tempAll); + tempAll->vt->Release((IUnknown*)tempAll); if (!init) { diff --git a/loader/dshow/DS_VideoDecoder.c b/loader/dshow/DS_VideoDecoder.c index 8af025b475..c8cc988b61 100644 --- a/loader/dshow/DS_VideoDecoder.c +++ b/loader/dshow/DS_VideoDecoder.c @@ -600,8 +600,8 @@ int DS_VideoDecoder_SetDestFmt(DS_VideoDecoder *this, int bits, unsigned int csp } if(this->m_pDS_Filter->m_pAll) - this->m_pDS_Filter->m_pAll->vt->Release(this->m_pDS_Filter->m_pAll); - this->m_pDS_Filter->m_pAll=MemAllocatorCreate(); + this->m_pDS_Filter->m_pAll->vt->Release((IUnknown*)this->m_pDS_Filter->m_pAll); + this->m_pDS_Filter->m_pAll=(IMemAllocator*)MemAllocatorCreate(); if (!this->m_pDS_Filter->m_pAll) { printf("Call to MemAllocatorCreate failed\n"); diff --git a/loader/dshow/allocator.c b/loader/dshow/allocator.c index a90bd9d3d2..744debf968 100644 --- a/loader/dshow/allocator.c +++ b/loader/dshow/allocator.c @@ -114,6 +114,7 @@ static inline avm_list_t* avm_list_find(avm_list_t* head, void* member) return NULL; } +#ifdef WIN32_LOADER static long MemAllocator_CreateAllocator(GUID* clsid, const GUID* iid, void** ppv) { IUnknown* p; @@ -130,6 +131,7 @@ static long MemAllocator_CreateAllocator(GUID* clsid, const GUID* iid, void** pp return result; } +#endif static HRESULT STDCALL MemAllocator_SetProperties(IMemAllocator * This, /* [in] */ ALLOCATOR_PROPERTIES *pRequest, diff --git a/loader/dshow/graph.c b/loader/dshow/graph.c index 01bf6c7253..14517a627f 100644 --- a/loader/dshow/graph.c +++ b/loader/dshow/graph.c @@ -34,6 +34,7 @@ // Used for knowing when to register and unregister the class in COM. static int GraphKeeper = 0; +#ifdef WIN32_LOADER static long FilterGraph_CreateGraph(GUID* clsid, const GUID* iid, void** ppv) { IUnknown* p; @@ -50,6 +51,7 @@ static long FilterGraph_CreateGraph(GUID* clsid, const GUID* iid, void** ppv) return result; } +#endif static void FilterGraph_Destroy(FilterGraph* This) { @@ -62,56 +64,56 @@ static void FilterGraph_Destroy(FilterGraph* This) free(This); } -HRESULT STDCALL FilterGraph_AddFilter(FilterGraph* This, - IBaseFilter* pFilter, - unsigned short* pName) +static HRESULT STDCALL FilterGraph_AddFilter(IFilterGraph* This, + IBaseFilter* pFilter, + unsigned short* pName) { Debug printf("FilterGraph_AddFilter(%p) called\n", This); return E_NOTIMPL; } -HRESULT STDCALL FilterGraph_RemoveFilter(FilterGraph* This, IBaseFilter* pFilter) +static HRESULT STDCALL FilterGraph_RemoveFilter(IFilterGraph* This, IBaseFilter* pFilter) { Debug printf("FilterGraph_RemoveFilter(%p) called\n", This); return E_NOTIMPL; } -HRESULT STDCALL FilterGraph_EnumFilters(FilterGraph* This, IEnumFilters** ppEnum) +static HRESULT STDCALL FilterGraph_EnumFilters(IFilterGraph* This, IEnumFilters** ppEnum) { Debug printf("FilterGraph_EnumFilters(%p) called\n", This); return E_NOTIMPL; } -HRESULT STDCALL FilterGraph_FindFilterByName(FilterGraph* This, - unsigned short* pName, - IBaseFilter** ppFilter) +static HRESULT STDCALL FilterGraph_FindFilterByName(IFilterGraph* This, + unsigned short* pName, + IBaseFilter** ppFilter) { Debug printf("FilterGraph_FindFilterByName(%p) called\n", This); return E_NOTIMPL; } -HRESULT STDCALL FilterGraph_ConnectDirect(FilterGraph* This, - IPin* ppinOut, - IPin* ppinIn, - const AM_MEDIA_TYPE* pmt) +static HRESULT STDCALL FilterGraph_ConnectDirect(IFilterGraph* This, + IPin* ppinOut, + IPin* ppinIn, + const AM_MEDIA_TYPE* pmt) { Debug printf("FilterGraph_ConnectDirect(%p) called\n", This); return E_NOTIMPL; } -HRESULT STDCALL FilterGraph_Reconnect(FilterGraph* This, IPin* ppin) +static HRESULT STDCALL FilterGraph_Reconnect(IFilterGraph* This, IPin* ppin) { Debug printf("FilterGraph_Reconnect(%p) called\n", This); return E_NOTIMPL; } -HRESULT STDCALL FilterGraph_Disconnect(FilterGraph* This, IPin* ppin) +static HRESULT STDCALL FilterGraph_Disconnect(IFilterGraph* This, IPin* ppin) { Debug printf("FilterGraph_Disconnect(%p) called\n", This); return E_NOTIMPL; } -HRESULT STDCALL FilterGraph_SetDefaultSyncSource(FilterGraph* This) +static HRESULT STDCALL FilterGraph_SetDefaultSyncSource(IFilterGraph* This) { Debug printf("FilterGraph_SetDefaultSyncSource(%p) called\n", This); return E_NOTIMPL; diff --git a/loader/dshow/graph.h b/loader/dshow/graph.h index 2fa72b49b4..7667f5a39e 100644 --- a/loader/dshow/graph.h +++ b/loader/dshow/graph.h @@ -52,25 +52,6 @@ struct FilterGraph { HRESULT STDCALL (*SetDefaultSyncSource)(FilterGraph* This); }; - -HRESULT STDCALL FilterGraph_AddFilter(FilterGraph* This, - IBaseFilter* pFilter, - unsigned short* pName); -HRESULT STDCALL FilterGraph_RemoveFilter(FilterGraph* This, - IBaseFilter* pFilter); -HRESULT STDCALL FilterGraph_EnumFilters(FilterGraph* This, - IEnumFilters** ppEnum); -HRESULT STDCALL FilterGraph_FindFilterByName(FilterGraph* This, - unsigned short* pName, - IBaseFilter** ppFilter); -HRESULT STDCALL FilterGraph_ConnectDirect(FilterGraph* This, - IPin* ppinOut, - IPin* ppinIn, - const AM_MEDIA_TYPE* pmt); -HRESULT STDCALL FilterGraph_Reconnect(FilterGraph* This, IPin* ppin); -HRESULT STDCALL FilterGraph_Disconnect(FilterGraph* This, IPin* ppin); -HRESULT STDCALL FilterGraph_SetDefaultSyncSource(FilterGraph* This); - FilterGraph* FilterGraphCreate(void); #endif /* MPLAYER_GRAPH_H */ diff --git a/loader/dshow/outputpin.c b/loader/dshow/outputpin.c index ad53303df5..a1baf80116 100644 --- a/loader/dshow/outputpin.c +++ b/loader/dshow/outputpin.c @@ -552,8 +552,8 @@ static HRESULT STDCALL COutputPin_NewSegment(IPin * This, /* [in] */ REFERENCE_TIME tStop, /* [in] */ double dRate) { - Debug printf("COutputPin_NewSegment(%Ld,%Ld,%f) called\n", - tStart, tStop, dRate); + Debug printf("COutputPin_NewSegment(%d,%d,%f) called\n", + (int)tStart, (int)tStop, dRate); return 0; } @@ -749,7 +749,7 @@ static HRESULT STDCALL COutputMemPin_ReceiveMultiple(IMemInputPin * This, /* [in] */ long nSamples, /* [out] */ long *nSamplesProcessed) { - HRESULT hr; + HRESULT hr = 0; Debug printf("COutputMemPin_ReceiveMultiple(%p) %ld\n", This,nSamples); for(*nSamplesProcessed=0; *nSamplesProcessed < nSamples; *nSamplesProcessed++) { hr = This->vt->Receive(This,pSamples[*nSamplesProcessed]); diff --git a/loader/ext.c b/loader/ext.c index d91ab4a3de..feab985167 100644 --- a/loader/ext.c +++ b/loader/ext.c @@ -443,12 +443,12 @@ LPVOID WINAPI VirtualAlloc(LPVOID address, DWORD size, DWORD type, DWORD protec if (type&MEM_RESERVE && (unsigned)address&0xffff) { size += (unsigned)address&0xffff; - address = (unsigned)address&~0xffff; + address = (void*)((unsigned)address&~0xffff); } pgsz = sysconf(_SC_PAGESIZE); if (type&MEM_COMMIT && (unsigned)address%pgsz) { size += (unsigned)address%pgsz; - address -= (unsigned)address%pgsz; + address = (void*)((unsigned)address - (unsigned)address%pgsz); } if (type&MEM_RESERVE && size<0x10000) size = 0x10000; @@ -531,7 +531,6 @@ LPVOID WINAPI VirtualAlloc(LPVOID address, DWORD size, DWORD type, DWORD protec WIN_BOOL WINAPI VirtualFree(LPVOID address, SIZE_T dwSize, DWORD dwFreeType)//not sure { virt_alloc* str=vm; - int answer; //printf("VirtualFree(0x%08X, %d, 0x%08X)\n", (unsigned)address, dwSize, dwFreeType); while(str) @@ -542,7 +541,7 @@ WIN_BOOL WINAPI VirtualFree(LPVOID address, SIZE_T dwSize, DWORD dwFreeType)//n continue; } //printf(" VirtualFree(...) munmap(0x%08X, %d)\n", (unsigned)str->address, str->mapping_size); - answer=munmap(str->address, str->mapping_size); + munmap(str->address, str->mapping_size); if(str->next)str->next->prev=str->prev; if(str->prev)str->prev->next=str->next; if(vm==str)vm=str->prev; diff --git a/loader/module.c b/loader/module.c index 78d46d5c15..aa921c52d6 100644 --- a/loader/module.c +++ b/loader/module.c @@ -440,7 +440,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) int i; // sse hack moved from patch dll into runtime patching - if (PE_FindExportedFunction(wm, "DriverProc", TRUE)==RVA(0x1000)) { + if ((char*)PE_FindExportedFunction(wm, "DriverProc", TRUE)==RVA(0x1000)) { fprintf(stderr, "VP3 DLL found\n"); for (i=0;i<18;i++) RVA(0x4bd6)[i]=0x90; } @@ -450,7 +450,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) if (strstr(libname,"vp5vfw.dll") && wm) { int i; - if (PE_FindExportedFunction(wm, "DriverProc", TRUE)==RVA(0x3930)) { + if ((char*)PE_FindExportedFunction(wm, "DriverProc", TRUE)==RVA(0x3930)) { for (i=0;i<3;i++) RVA(0x4e86)[i]=0x90; for (i=0;i<3;i++) RVA(0x5a23)[i]=0x90; for (i=0;i<3;i++) RVA(0x5bff)[i]=0x90; @@ -463,12 +463,12 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) if (strstr(libname,"vp6vfw.dll") && wm) { int i; - if (PE_FindExportedFunction(wm, "DriverProc", TRUE)==RVA(0x3ef0)) { + if ((char*)PE_FindExportedFunction(wm, "DriverProc", TRUE)==RVA(0x3ef0)) { // looks like VP 6.1.0.2 for (i=0;i<6;i++) RVA(0x7268)[i]=0x90; for (i=0;i<6;i++) RVA(0x7e83)[i]=0x90; for (i=0;i<6;i++) RVA(0x806a)[i]=0x90; - } else if (PE_FindExportedFunction(wm, "DriverProc", TRUE)==RVA(0x4120)) { + } else if ((char*)PE_FindExportedFunction(wm, "DriverProc", TRUE)==RVA(0x4120)) { // looks like VP 6.2.0.10 for (i=0;i<6;i++) RVA(0x7688)[i]=0x90; for (i=0;i<6;i++) RVA(0x82c3)[i]=0x90; @@ -476,7 +476,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) for (i=0;i<6;i++) RVA(0x1d2cc)[i]=0x90; for (i=0;i<6;i++) RVA(0x2179d)[i]=0x90; for (i=0;i<6;i++) RVA(0x1977f)[i]=0x90; - } else if (PE_FindExportedFunction(wm, "DriverProc", TRUE)==RVA(0x3e70)) { + } else if ((char*)PE_FindExportedFunction(wm, "DriverProc", TRUE)==RVA(0x3e70)) { // looks like VP 6.0.7.3 for (i=0;i<6;i++) RVA(0x7559)[i]=0x90; for (i=0;i<6;i++) RVA(0x81c3)[i]=0x90; @@ -492,7 +492,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) { // The codec calls IsRectEmpty with coords 0,0,0,0 => result is 0 // but it really wants the rectangle to be not empty - if (PE_FindExportedFunction(wm, "CreateInstance", TRUE)==RVA(0xb812)) { + if ((char*)PE_FindExportedFunction(wm, "CreateInstance", TRUE)==RVA(0xb812)) { // Dll version is 10.0.0.3645 *RVA(0x8b0f)=0xeb; // Jump always, ignoring IsRectEmpty result } else { @@ -509,7 +509,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) // dispatch_addr = GetProcAddress(wm->module, "theQuickTimeDispatcher", TRUE); dispatch_addr = PE_FindExportedFunction(wm, "theQuickTimeDispatcher", TRUE); - if (dispatch_addr == RVA(0x124c30)) + if ((char*)dispatch_addr == RVA(0x124c30)) { fprintf(stderr, "QuickTime5 DLLs found\n"); ptr = (void **)RVA(0x375ca4); // dispatch_ptr @@ -537,7 +537,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) RVA(0x08e0ae)[0] = 0xc3; // font/dc remover for (i=0;i<24;i++) RVA(0x07a1ad)[i]=0x90; // destroy window #endif - } else if (dispatch_addr == RVA(0x13b330)) + } else if ((char*)dispatch_addr == RVA(0x13b330)) { fprintf(stderr, "QuickTime6 DLLs found\n"); ptr = (void **)RVA(0x3b9524); // dispatcher_ptr @@ -546,7 +546,7 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) for (i=0;i<5;i++) RVA(0x273122)[i]=0x90; // jmp_to_call_loadbitmap for (i=0;i<9;i++) RVA(0x273131)[i]=0x90; // call__calls_OLE_shit for (i=0;i<96;i++) RVA(0x2ac852)[i]=0x90; // disable threads - } else if (dispatch_addr == RVA(0x13c3e0)) + } else if ((char*)dispatch_addr == RVA(0x13c3e0)) { fprintf(stderr, "QuickTime6.3 DLLs found\n"); ptr = (void **)RVA(0x3ca01c); // dispatcher_ptr @@ -825,7 +825,7 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t // memory management: case 0x150011: //NewPtrClear case 0x150012: //NewPtrSysClear - reg->eax = malloc(((uint32_t *)stack_base)[1]); + reg->eax = (uint32_t)malloc(((uint32_t *)stack_base)[1]); memset((void *)reg->eax,0,((uint32_t *)stack_base)[1]); #ifdef DEBUG_QTX_API printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax); @@ -833,7 +833,7 @@ static int report_func(void *stack_base, int stack_size, reg386_t *reg, uint32_t return 1; case 0x15000F: //NewPtr case 0x150010: //NewPtrSys - reg->eax = malloc(((uint32_t *)stack_base)[1]); + reg->eax = (uint32_t)malloc(((uint32_t *)stack_base)[1]); #ifdef DEBUG_QTX_API printf("%*sLEAVE(%d): EMULATED! 0x%X\n",ret_i*2,"",ret_i, reg->eax); #endif diff --git a/loader/pe_image.c b/loader/pe_image.c index 85b56ab4f2..fed5780fb1 100644 --- a/loader/pe_image.c +++ b/loader/pe_image.c @@ -73,7 +73,7 @@ static void dump_exports( HMODULE hModule ) char *Module; unsigned int i, j; unsigned short *ordinal; - unsigned long *function,*functions; + unsigned long *function; unsigned char **name; unsigned int load_addr = hModule; @@ -84,14 +84,17 @@ static void dump_exports( HMODULE hModule ) IMAGE_EXPORT_DIRECTORY *pe_exports = (IMAGE_EXPORT_DIRECTORY*)RVA(rva_start); Module = (char*)RVA(pe_exports->Name); + (void)Module; //silence compiler warning TRACE("*******EXPORT DATA*******\n"); TRACE("Module name is %s, %ld functions, %ld names\n", Module, pe_exports->NumberOfFunctions, pe_exports->NumberOfNames); ordinal=(unsigned short*) RVA(pe_exports->AddressOfNameOrdinals); - functions=function=(unsigned long*) RVA(pe_exports->AddressOfFunctions); + function=(unsigned long*) RVA(pe_exports->AddressOfFunctions); name=(unsigned char**) RVA(pe_exports->AddressOfNames); + (void)name; //silence compiler warning + TRACE(" Ord RVA Addr Name\n" ); for (i=0;iNumberOfFunctions;i++, function++) { @@ -135,7 +138,6 @@ FARPROC PE_FindExportedFunction( IMAGE_EXPORT_DIRECTORY *exports = pem->pe_export; unsigned int load_addr = wm->module; unsigned long rva_start, rva_end, addr; - char * forward; if (HIWORD(funcName)) TRACE("(%s)\n",funcName); @@ -152,7 +154,6 @@ FARPROC PE_FindExportedFunction( ordinals= (unsigned short*) RVA(exports->AddressOfNameOrdinals); function= (unsigned long*) RVA(exports->AddressOfFunctions); name = (unsigned char **) RVA(exports->AddressOfNames); - forward = NULL; rva_start = PE_HEADER(wm->module)->OptionalHeader .DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress; rva_end = rva_start + PE_HEADER(wm->module)->OptionalHeader @@ -247,14 +248,9 @@ static DWORD fixup_imports( WINE_MODREF *wm ) PE_MODREF *pem; unsigned int load_addr = wm->module; int i,characteristics_detection=1; - char *modname; assert(wm->type==MODULE32_PE); pem = &(wm->binfmt.pe); - if (pem->pe_export) - modname = (char*) RVA(pem->pe_export->Name); - else - modname = ""; TRACE("Dumping imports list\n"); diff --git a/loader/registry.c b/loader/registry.c index 2eb449124c..b87c160e67 100644 --- a/loader/registry.c +++ b/loader/registry.c @@ -339,7 +339,6 @@ long __stdcall RegOpenKeyExA(long key, const char* subkey, long reserved, long a { char* full_name; reg_handle_t* t; - struct reg_value* v; TRACE("Opening key %s\n", subkey); if(!regs) @@ -357,7 +356,7 @@ long __stdcall RegOpenKeyExA(long key, const char* subkey, long reserved, long a if(!full_name) return -1; TRACE("Opening key Fullname %s\n", full_name); - v=find_value_by_name(full_name); + find_value_by_name(full_name); t=insert_handle(generate_handle(), full_name); *newkey=t->handle; diff --git a/loader/win32.c b/loader/win32.c index 50ca797e8d..fb7f48b09e 100644 --- a/loader/win32.c +++ b/loader/win32.c @@ -597,7 +597,7 @@ static HMODULE WINAPI expGetModuleHandleW(const uint16_t* name) int pos = 0; while (*name) { if (*name > 256 || pos >= sizeof(aname) - 1) - return NULL; + return 0; aname[pos++] = *name++; } aname[pos] = 0; @@ -2015,15 +2015,15 @@ static DWORD WINAPI expSignalObjectAndWait(HANDLE hObjectToSignal, expSetEvent(mlist); break; case 1: // Semaphore - expReleaseSemaphore(mlist, 1, NULL); + expReleaseSemaphore((long)mlist, 1, NULL); break; case 2: // Mutex - expReleaseMutex(mlist); + expReleaseMutex((long)mlist); break; default: dbgprintf("Signalling unknown object type %d!\n", hObjectToSignal); } - return expWaitForSingleObject(hObjectToWaitOn, dwMilliseconds); + return (DWORD)expWaitForSingleObject((void*)hObjectToWaitOn, dwMilliseconds); } static long WINAPI expRegOpenKeyExA(long key, const char* subkey, long reserved, long access, int* newkey) @@ -2747,7 +2747,7 @@ static int WINAPI expEnumDisplayMonitors(void *dc, RECT *r, { dbgprintf("EnumDisplayMonitors(0x%x, 0x%x, 0x%x, 0x%x) => ?\n", dc, r, callback_proc, callback_param); - return callback_proc(0, dc, r, callback_param); + return callback_proc(0, (HDC)dc, r, (LPARAM)callback_param); } #if 0 @@ -2847,8 +2847,8 @@ static int WINAPI expEnumWindows(int (*callback_func)(HWND, LPARAM), void *callb { int i, i2; dbgprintf("EnumWindows(0x%x, 0x%x) => 1\n", callback_func, callback_param); - i = callback_func(0, callback_param); - i2 = callback_func(1, callback_param); + i = callback_func(0, (LPARAM)callback_param); + i2 = callback_func(1, (LPARAM)callback_param); return i && i2; } @@ -4223,7 +4223,7 @@ static int exp_initterm(int v1, int v2) } #else /* merged from wine - 2002.04.21 */ -typedef void (*INITTERMFUNC)(); +typedef void (*INITTERMFUNC)(void); static int exp_initterm(INITTERMFUNC *start, INITTERMFUNC *end) { dbgprintf("_initterm(0x%x, 0x%x) %p\n", start, end, *start); @@ -4900,7 +4900,7 @@ static HPALETTE WINAPI expCreatePalette(CONST LOGPALETTE *lpgpl) dbgprintf("CreatePalette(%x) => NULL\n", lpgpl); i = sizeof(LOGPALETTE)+((lpgpl->palNumEntries-1)*sizeof(PALETTEENTRY)); - test = malloc(i); + test = (HPALETTE)malloc(i); memcpy((void *)test, lpgpl, i); return test; diff --git a/loader/wine/winbase.h b/loader/wine/winbase.h index 19394bc81d..b5c5ebe25c 100644 --- a/loader/wine/winbase.h +++ b/loader/wine/winbase.h @@ -786,8 +786,8 @@ typedef struct tagSYSTEM_INFO struct { WORD wProcessorArchitecture; WORD wReserved; - } DUMMYSTRUCTNAME; - } DUMMYUNIONNAME; + } s; + } u; DWORD dwPageSize; LPVOID lpMinimumApplicationAddress; LPVOID lpMaximumApplicationAddress; diff --git a/loader/wine/windef.h b/loader/wine/windef.h index b46607969b..ee455dc3f8 100644 --- a/loader/wine/windef.h +++ b/loader/wine/windef.h @@ -47,6 +47,8 @@ # define NONAMELESSUNION #endif /* !defined(NONAMELESSUNION) */ +#if 0 + #ifndef NONAMELESSSTRUCT #define DUMMYSTRUCTNAME #define DUMMYSTRUCTNAME1 @@ -79,6 +81,8 @@ #define DUMMYUNIONNAME5 u5 #endif /* !defined(NONAMELESSUNION) */ +#endif + /* Calling conventions definitions */ #ifdef __i386__ @@ -301,8 +305,8 @@ typedef LRESULT CALLBACK (*DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM); typedef INT CALLBACK (*EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT); typedef INT CALLBACK (*EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT); DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC) -typedef LRESULT CALLBACK (*FARPROC)(); -typedef INT CALLBACK (*PROC)(); +typedef LRESULT CALLBACK (*FARPROC)(void); +typedef INT CALLBACK (*PROC)(void); typedef WIN_BOOL CALLBACK (*GRAYSTRINGPROC)(HDC,LPARAM,INT); typedef LRESULT CALLBACK (*HOOKPROC)(INT,WPARAM,LPARAM); typedef WIN_BOOL CALLBACK (*PROPENUMPROCA)(HWND,LPCSTR,HANDLE); @@ -434,8 +438,8 @@ typedef struct typedef LRESULT CALLBACK (*DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM); typedef WIN_BOOL16 CALLBACK (*DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM); typedef INT16 CALLBACK (*EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16); -typedef LRESULT CALLBACK (*FARPROC16)(); -typedef INT16 CALLBACK (*PROC16)(); +typedef LRESULT CALLBACK (*FARPROC16)(void); +typedef INT16 CALLBACK (*PROC16)(void); typedef WIN_BOOL16 CALLBACK (*GRAYSTRINGPROC16)(HDC16,LPARAM,INT16); typedef LRESULT CALLBACK (*HOOKPROC16)(INT16,WPARAM16,LPARAM); typedef WIN_BOOL16 CALLBACK (*PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16); diff --git a/osdep/getch2-win.c b/osdep/getch2-win.c index 0b4d2b0bae..3e6eeff086 100644 --- a/osdep/getch2-win.c +++ b/osdep/getch2-win.c @@ -77,7 +77,7 @@ static int getch2_internal(void) /*check if there are input events*/ if(!GetNumberOfConsoleInputEvents(in,&retval)) { - printf("getch2: can't get number of input events: %i\n",GetLastError()); + printf("getch2: can't get number of input events: %i\n",(int)GetLastError()); return -1; } if(retval<=0)return -1; @@ -165,7 +165,7 @@ void getch2_enable(void) in = GetStdHandle(STD_INPUT_HANDLE); if(!GetNumberOfConsoleInputEvents(in,&retval)) { - printf("getch2: %i can't get number of input events [disabling console input]\n",GetLastError()); + printf("getch2: %i can't get number of input events [disabling console input]\n",(int)GetLastError()); getch2_status = 0; } else getch2_status=1; diff --git a/osdep/setenv.c b/osdep/setenv.c index 9919fff2a3..222d3ba82b 100644 --- a/osdep/setenv.c +++ b/osdep/setenv.c @@ -24,6 +24,8 @@ #include #include +int setenv(const char *name, const char *val, int overwrite); + int setenv(const char *name, const char *val, int overwrite) { int len = strlen(name) + strlen(val) + 2; diff --git a/stream/cache2.c b/stream/cache2.c index 6e8f398c37..4aed786cb6 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -367,6 +367,7 @@ void cache_uninit(stream_t *s) { s->cache_data = NULL; } +#if FORKED_CACHE static void exit_sighandler(int x){ // close stream exit(0); @@ -374,6 +375,7 @@ static void exit_sighandler(int x){ static void dummy_sighandler(int x) { } +#endif /** * Main loop of the cache process or thread. diff --git a/sub/vobsub.c b/sub/vobsub.c index bfee3eb98f..2f3ba9e1e1 100644 --- a/sub/vobsub.c +++ b/sub/vobsub.c @@ -695,8 +695,8 @@ static int vobsub_parse_id(vobsub_t *vob, const char *line) static int vobsub_parse_timestamp(vobsub_t *vob, const char *line) { int h, m, s, ms; - off_t filepos; - if (sscanf(line, " %02d:%02d:%02d:%03d, filepos: %09lx", + int64_t filepos; + if (sscanf(line, " %02d:%02d:%02d:%03d, filepos: %09"SCNx64, &h, &m, &s, &ms, &filepos) != 5) return -1; return vobsub_add_timestamp(vob, filepos, vob->delay + ms + 1000 * (s + 60 * (m + 60 * h))); -- cgit v1.2.3 From a1244111a790bbc4bf91b078ebcad3f415da79da Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 3 Feb 2012 08:05:11 +0100 Subject: windows support: unicode filenames Windows uses a legacy codepage for char* / runtime functions accepting char *. Using UTF-8 as the codepage with setlocale() is explicitly forbidden. Work this around by overriding the MSVCRT functions with wrapper macros, that assume UTF-8 and use "proper" API calls like _wopen etc. to deal with unicode filenames. All code that uses standard functions that take or return filenames must now include osdep/io.h. stat() can't be overridden, because MinGW-w64 itself defines "stat" as a macro. Change code to use use mp_stat() instead. This is not perfectly clean, but still somewhat sane, and much better than littering the rest of the mplayer code with MinGW specific hacks. It's also a bit fragile, but that's actually little different from the previous situation. Also, MinGW is unlikely to ever include a nice way of dealing with this. --- Makefile | 1 + input/input.c | 15 ++-- libmpcodecs/vf_remove_logo.c | 2 + libmpdemux/demux_mf.c | 13 +-- libmpdemux/mf.c | 19 ++--- libvo/vo_jpeg.c | 7 +- libvo/vo_pnm.c | 8 +- mplayer.c | 19 ++--- osdep/io.c | 185 +++++++++++++++++++++++++++++++++++++++++++ osdep/io.h | 76 ++++++++++++++++++ parser-cfg.c | 2 + path.c | 18 ++++- path.h | 4 + screenshot.c | 11 +-- stream/cookies.c | 2 + stream/stream_cddb.c | 10 +-- stream/stream_file.c | 2 + sub/find_subfiles.c | 2 + sub/font_load.c | 10 +-- timeline/tl_matroska.c | 2 + 20 files changed, 342 insertions(+), 66 deletions(-) create mode 100644 osdep/io.c create mode 100644 osdep/io.h diff --git a/Makefile b/Makefile index 80708c29bc..21191655e7 100644 --- a/Makefile +++ b/Makefile @@ -403,6 +403,7 @@ SRCS_COMMON = asxparser.c \ libmpdemux/yuv4mpeg_ratio.c \ libvo/osd.c \ osdep/numcores.c \ + osdep/io.c \ osdep/$(GETCH) \ osdep/$(TIMER) \ stream/open.c \ diff --git a/input/input.c b/input/input.c index e1c001077a..cde1b5e027 100644 --- a/input/input.c +++ b/input/input.c @@ -31,6 +31,8 @@ #include #include +#include "osdep/io.h" + #include "input.h" #include "mp_fifo.h" #include "keycodes.h" @@ -1776,13 +1778,16 @@ struct input_ctx *mp_input_init(struct input_conf *input_conf) #endif if (input_conf->in_file) { - struct stat st; - int mode = O_RDONLY | O_NONBLOCK; + int mode = O_RDONLY; +#ifndef __MINGW32__ // Use RDWR for FIFOs to ensure they stay open over multiple accesses. - // Note that on Windows stat may fail for named pipes, - // but due to how the API works, using RDONLY should be ok. + // Note that on Windows due to how the API works, using RDONLY should + // be ok. + struct stat st; if (stat(input_conf->in_file, &st) == 0 && S_ISFIFO(st.st_mode)) - mode = O_RDWR | O_NONBLOCK; + mode = O_RDWR; + mode |= O_NONBLOCK; +#endif int in_file_fd = open(input_conf->in_file, mode); if (in_file_fd >= 0) mp_input_add_cmd_fd(ictx, in_file_fd, 1, NULL, close); diff --git a/libmpcodecs/vf_remove_logo.c b/libmpcodecs/vf_remove_logo.c index da90d3c066..1270f5e6c9 100644 --- a/libmpcodecs/vf_remove_logo.c +++ b/libmpcodecs/vf_remove_logo.c @@ -86,6 +86,8 @@ #include #include +#include "osdep/io.h" + #include "config.h" #include "mp_msg.h" #include "libvo/fastmemcpy.h" diff --git a/libmpdemux/demux_mf.c b/libmpdemux/demux_mf.c index f47a11eed6..193b17bc18 100644 --- a/libmpdemux/demux_mf.c +++ b/libmpdemux/demux_mf.c @@ -23,6 +23,8 @@ #include #include +#include "osdep/io.h" + #include "talloc.h" #include "config.h" #include "mp_msg.h" @@ -49,20 +51,19 @@ static void demux_seek_mf(demuxer_t *demuxer,float rel_seek_secs,float audio_del // 1 = successfully read a packet static int demux_mf_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds){ mf_t * mf; - struct stat fs; FILE * f; mf=(mf_t*)demuxer->priv; if ( mf->curr_frame >= mf->nr_of_files ) return 0; - stat( mf->names[mf->curr_frame],&fs ); -// printf( "[demux_mf] frame: %d (%s,%d)\n",mf->curr_frame,mf->names[mf->curr_frame],fs.st_size ); - if ( !( f=fopen( mf->names[mf->curr_frame],"rb" ) ) ) return 0; { sh_video_t * sh_video = demuxer->video->sh; - demux_packet_t * dp = new_demux_packet( fs.st_size ); - if ( !fread( dp->buffer,fs.st_size,1,f ) ) return 0; + fseek(f, 0, SEEK_END); + long file_size = ftell(f); + fseek(f, 0, SEEK_SET); + demux_packet_t * dp = new_demux_packet( file_size ); + if ( !fread( dp->buffer,file_size,1,f ) ) return 0; dp->pts=mf->curr_frame / sh_video->fps; dp->pos=mf->curr_frame; dp->flags=0; diff --git a/libmpdemux/mf.c b/libmpdemux/mf.c index 6b22c6147d..d232944593 100644 --- a/libmpdemux/mf.c +++ b/libmpdemux/mf.c @@ -25,7 +25,8 @@ #include #include #include -#include + +#include "osdep/io.h" #include "config.h" @@ -38,6 +39,7 @@ #include "mp_msg.h" #include "stream/stream.h" +#include "path.h" #include "mf.h" @@ -49,7 +51,6 @@ char * mf_type = NULL; //"jpg"; mf_t* open_mf(char * filename){ #if defined(HAVE_GLOB) || defined(__MINGW32__) glob_t gg; - struct stat fs; int i; char * fname; mf_t * mf; @@ -63,13 +64,13 @@ mf_t* open_mf(char * filename){ FILE *lst_f=fopen(filename + 1,"r"); if ( lst_f ) { - fname=malloc(PATH_MAX); - while ( fgets( fname,PATH_MAX,lst_f ) ) + fname=malloc(MP_PATH_MAX); + while ( fgets( fname,MP_PATH_MAX,lst_f ) ) { /* remove spaces from end of fname */ char *t=fname + strlen( fname ) - 1; while ( t > fname && isspace( *t ) ) *(t--)=0; - if ( stat( fname,&fs ) ) + if ( !mp_path_exists( fname ) ) { mp_msg( MSGT_STREAM,MSGL_V,"[mf] file not found: '%s'\n",fname ); } @@ -94,7 +95,7 @@ mf_t* open_mf(char * filename){ while ( ( fname=strsep( &filename,"," ) ) ) { - if ( stat( fname,&fs ) ) + if ( !mp_path_exists( fname ) ) { mp_msg( MSGT_STREAM,MSGL_V,"[mf] file not found: '%s'\n",fname ); } @@ -130,8 +131,8 @@ mf_t* open_mf(char * filename){ for( i=0;i < gg.gl_pathc;i++ ) { - stat( gg.gl_pathv[i],&fs ); - if( S_ISDIR( fs.st_mode ) ) continue; + if (mp_path_isdir(gg.gl_pathv[i])) + continue; mf->names[i]=strdup( gg.gl_pathv[i] ); // mp_msg( MSGT_STREAM,MSGL_DBG2,"[mf] added file %d.: %s\n",i,mf->names[i] ); } @@ -144,7 +145,7 @@ mf_t* open_mf(char * filename){ while ( error_count < 5 ) { sprintf( fname,filename,count++ ); - if ( stat( fname,&fs ) ) + if ( !mp_path_exists( fname ) ) { error_count++; mp_msg( MSGT_STREAM,MSGL_V,"[mf] file not found: '%s'\n",fname ); diff --git a/libvo/vo_jpeg.c b/libvo/vo_jpeg.c index 15f29a293a..efa0381086 100644 --- a/libvo/vo_jpeg.c +++ b/libvo/vo_jpeg.c @@ -45,6 +45,7 @@ #include "video_out.h" #include "video_out_internal.h" #include "mplayer.h" /* for exit_player_bad() */ +#include "osdep/io.h" /* ------------------------------------------------------------------------- */ @@ -107,15 +108,11 @@ static int framenum = 0; static void jpeg_mkdir(const char *buf, int verbose) { struct stat stat_p; -#ifndef __MINGW32__ if ( mkdir(buf, 0755) < 0 ) { -#else - if ( mkdir(buf) < 0 ) { -#endif switch (errno) { /* use switch in case other errors need to be caught and handled in the future */ case EEXIST: - if ( stat(buf, &stat_p ) < 0 ) { + if ( mp_stat(buf, &stat_p ) < 0 ) { mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name, _("This error has occurred"), strerror(errno) ); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name, diff --git a/libvo/vo_pnm.c b/libvo/vo_pnm.c index 9593860412..5345eaa122 100644 --- a/libvo/vo_pnm.c +++ b/libvo/vo_pnm.c @@ -40,6 +40,7 @@ #include "video_out.h" #include "video_out_internal.h" #include "mplayer.h" /* for exit_player_bad() */ +#include "osdep/io.h" /* ------------------------------------------------------------------------- */ @@ -199,16 +200,11 @@ static int preinit(const char *arg) static void pnm_mkdir(char *buf, int verbose) { struct stat stat_p; -/* Silly MING32 bug workaround */ -#ifndef __MINGW32__ if ( mkdir(buf, 0755) < 0 ) { -#else - if ( mkdir(buf) < 0 ) { -#endif switch (errno) { /* use switch in case other errors need to be caught and handled in the future */ case EEXIST: - if ( stat(buf, &stat_p ) < 0 ) { + if ( mp_stat(buf, &stat_p ) < 0 ) { mp_msg(MSGT_VO, MSGL_ERR, "%s: %s: %s\n", info.short_name, _("This error has occurred"), strerror(errno) ); mp_msg(MSGT_VO, MSGL_ERR, "%s: %s %s\n", info.short_name, diff --git a/mplayer.c b/mplayer.c index cdcd1d645e..f8b24a1285