[MPlayer-dev-eng] [PATCH] Fix dll loading with Turkish locales
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Wed Jan 19 21:53:45 CET 2005
Hi,
the attached patch removes all setlocale calls from MPlayer, thus
forcing the C library to behave independant of any locale settings.
Greetings,
Reimar Döffinger
-------------- next part --------------
Index: configure
===================================================================
RCS file: /cvsroot/mplayer/main/configure,v
retrieving revision 1.953
diff -u -r1.953 configure
--- configure 16 Jan 2005 22:01:52 -0000 1.953
+++ configure 19 Jan 2005 20:48:52 -0000
@@ -1382,7 +1385,6 @@
_linux_devfs=no
_i18n=auto
_dynamic_plugins=no
-_setlocale=auto
_crash_debug=auto
_sighandler=yes
_libdv=auto
@@ -1428,8 +1430,6 @@
--disable-i18n) _i18n=no ;;
--enable-dynamic-plugins) _dynamic_plugins=yes ;;
--disable-dynamic-plugins) _dynamic_plugins=no ;;
- --enable-setlocale) _setlocale=yes ;;
- --disable-setlocale) _setlocale=no ;;
--enable-x11) _x11=yes ;;
--disable-x11) _x11=no ;;
--enable-xv) _xv=yes ;;
@@ -2179,26 +2179,6 @@
fi
-# Checking for setlocale() ...
-# CSAK EGY MARADHAT - A HEGYLAKO
-# Nemnem. a TV Maci !
-echocheck "setlocale()"
-if test "$_setlocale" = auto ; then
- cat > $TMPC <<EOF
-#include <locale.h>
-int main(void) { setlocale( LC_ALL,"" ); return 0; }
-EOF
- _setlocale=no
- cc_check && _setlocale=yes
-fi
-if test "$_setlocale" = yes ; then
- _def_setlocale='#define USE_SETLOCALE 1'
-else
- _def_setlocale='#undef USE_SETLOCALE'
-fi
-echores "$_setlocale"
-
-
echocheck "iconv"
if test "$_iconv" = auto ; then
_iconv_tmp='#include <iconv.h>'
@@ -6834,9 +6842,6 @@
# define MAP_FAILED ((void *) -1)
#endif
-/* use setlocale() function */
-$_def_setlocale
-
/* Runtime CPU detection */
$_def_runtime_cpudetection
Index: mp_msg.c
===================================================================
RCS file: /cvsroot/mplayer/main/mp_msg.c,v
retrieving revision 1.24
diff -u -r1.24 mp_msg.c
--- mp_msg.c 12 Sep 2003 15:46:16 -0000 1.24
+++ mp_msg.c 19 Jan 2005 20:48:57 -0000
@@ -36,7 +36,6 @@
fprintf(stdout, "Original domain: %s\n", textdomain(NULL));
fprintf(stdout, "Original dirname: %s\n", bindtextdomain(textdomain(NULL),NULL));
#endif
- setlocale(LC_ALL, ""); /* set from the environment variables */
bindtextdomain("mplayer", PREFIX"/share/locale");
textdomain("mplayer");
#ifdef MP_DEBUG
Index: mp_msg.h
===================================================================
RCS file: /cvsroot/mplayer/main/mp_msg.h,v
retrieving revision 1.32
diff -u -r1.32 mp_msg.h
--- mp_msg.h 25 Nov 2004 22:23:59 -0000 1.32
+++ mp_msg.h 19 Jan 2005 20:48:58 -0000
@@ -108,7 +108,6 @@
#ifdef USE_I18N
#include <libintl.h>
-#include <locale.h>
#define mp_gettext(String) gettext(String)
#else
#define mp_gettext(String) String
Index: Gui/cfg.c
===================================================================
RCS file: /cvsroot/mplayer/main/Gui/cfg.c,v
retrieving revision 1.42
diff -u -r1.42 cfg.c
--- Gui/cfg.c 15 Dec 2004 01:22:23 -0000 1.42
+++ Gui/cfg.c 19 Jan 2005 20:49:12 -0000
@@ -10,10 +10,6 @@
#include "../m_config.h"
#include "../m_option.h"
-#ifdef USE_SETLOCALE
-#include <locale.h>
-#endif
-
#include "../../libvo/video_out.h"
#include "cfg.h"
@@ -208,10 +204,6 @@
char * cfg = get_path( "gui.conf" );
FILE * f;
-#ifdef USE_SETLOCALE
- setlocale( LC_ALL,"C" );
-#endif
-
// -- read configuration
mp_msg( MSGT_GPLAYER,MSGL_V,"[cfg] reading config file: %s\n",cfg );
gui_conf=m_config_new();
@@ -272,10 +264,6 @@
}
free( cfg );
-#ifdef USE_SETLOCALE
- setlocale( LC_ALL,"" );
-#endif
-
return 0;
}
@@ -285,10 +273,6 @@
FILE * f;
int i;
-#ifdef USE_SETLOCALE
- setlocale( LC_ALL,"C" );
-#endif
-
// -- save configuration
if ( (f=fopen( cfg,"wt+" )) )
{
@@ -348,10 +332,6 @@
}
free( cfg );
-#ifdef USE_SETLOCALE
- setlocale( LC_ALL,"" );
-#endif
-
return 0;
}
Index: input/input.c
===================================================================
RCS file: /cvsroot/mplayer/main/input/input.c,v
retrieving revision 1.107
diff -u -r1.107 input.c
--- input/input.c 3 Jan 2005 13:56:48 -0000 1.107
+++ input/input.c 19 Jan 2005 20:49:16 -0000
@@ -12,10 +12,6 @@
#include <fcntl.h>
#include <ctype.h>
-#ifdef USE_SETLOCALE
-#include <locale.h>
-#endif
-
#include "input.h"
#include "mouse.h"
#ifdef MP_DEBUG
@@ -599,14 +595,7 @@
break;
case MP_CMD_ARG_FLOAT:
errno = 0;
- /* <olo at altkom.com.pl> Use portable C locale for parsing floats: */
-#ifdef USE_SETLOCALE
- setlocale(LC_NUMERIC, "C");
-#endif
cmd->args[i].v.f = atof(ptr);
-#ifdef USE_SETLOCALE
- setlocale(LC_NUMERIC, "");
-#endif
if(errno != 0) {
mp_msg(MSGT_INPUT,MSGL_ERR,"Command %s: argument %d isn't a float.\n",cmd_def->name,i+1);
ptr = NULL;
Index: libmpcodecs/ad_libvorbis.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/ad_libvorbis.c,v
retrieving revision 1.15
diff -u -r1.15 ad_libvorbis.c
--- libmpcodecs/ad_libvorbis.c 14 Oct 2004 15:09:33 -0000 1.15
+++ libmpcodecs/ad_libvorbis.c 19 Jan 2005 20:49:26 -0000
@@ -8,10 +8,6 @@
#include "config.h"
#include "ad_internal.h"
-#ifdef USE_SETLOCALE
-#include <locale.h>
-#endif
-
#ifdef HAVE_OGGVORBIS
static ad_info_t info =
@@ -50,13 +46,7 @@
va_start( va, format );
clen = strlen( comment );
-#ifdef USE_SETLOCALE
- setlocale( LC_NUMERIC, "C" );
-#endif
ret = strncasecmp( ptr, comment, clen) == 0 ? vsscanf( ptr+clen, format, va ) : 0;
-#ifdef USE_SETLOCALE
- setlocale( LC_NUMERIC, "" );
-#endif
va_end( va );
return ret;
Index: libmpcodecs/vf_eq2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_eq2.c,v
retrieving revision 1.9
diff -u -r1.9 vf_eq2.c
--- libmpcodecs/vf_eq2.c 21 Oct 2004 11:55:19 -0000 1.9
+++ libmpcodecs/vf_eq2.c 19 Jan 2005 20:49:28 -0000
@@ -23,10 +23,6 @@
#include "mp_image.h"
#include "vf.h"
-#ifdef USE_SETLOCALE
-#include <locale.h>
-#endif
-
#define LUT16
/* Per channel parameters */
@@ -481,15 +477,9 @@
par[5] = 1.0;
par[6] = 1.0;
par[7] = 1.0;
-#ifdef USE_SETLOCALE
- setlocale (LC_NUMERIC, "C");
-#endif
sscanf (args, "%lf:%lf:%lf:%lf:%lf:%lf:%lf:%lf",
par, par + 1, par + 2, par + 3, par + 4, par + 5, par + 6, par + 7
);
-#ifdef USE_SETLOCALE
- setlocale (LC_NUMERIC, "");
-#endif
eq2->rgamma = par[4];
eq2->ggamma = par[5];
Index: libmpcodecs/vf_smartblur.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_smartblur.c,v
retrieving revision 1.7
diff -u -r1.7 vf_smartblur.c
--- libmpcodecs/vf_smartblur.c 18 Sep 2004 00:08:16 -0000 1.7
+++ libmpcodecs/vf_smartblur.c 19 Jan 2005 20:49:34 -0000
@@ -25,10 +25,6 @@
#include "../config.h"
#include "../mp_msg.h"
-#ifdef USE_SETLOCALE
-#include <locale.h>
-#endif
-
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
@@ -235,9 +231,6 @@
if(args==NULL) return 0;
-#ifdef USE_SETLOCALE
- setlocale( LC_NUMERIC, "C" );
-#endif
e=sscanf(args, "%f:%f:%d:%f:%f:%d",
&vf->priv->luma.radius,
&vf->priv->luma.strength,
@@ -246,9 +239,6 @@
&vf->priv->chroma.strength,
&vf->priv->chroma.threshold
);
-#ifdef USE_SETLOCALE
- setlocale( LC_NUMERIC, "" );
-#endif
vf->priv->luma.quality = vf->priv->chroma.quality= 3.0;
Index: libmpcodecs/vf_unsharp.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_unsharp.c,v
retrieving revision 1.6
diff -u -r1.6 vf_unsharp.c
--- libmpcodecs/vf_unsharp.c 20 May 2003 18:36:55 -0000 1.6
+++ libmpcodecs/vf_unsharp.c 19 Jan 2005 20:49:34 -0000
@@ -27,10 +27,6 @@
#include "../mp_msg.h"
#include "../cpudetect.h"
-#ifdef USE_SETLOCALE
-#include <locale.h>
-#endif
-
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif
@@ -267,13 +263,7 @@
// parse amount
pos = strchr( pos+1, ':' );
-#ifdef USE_SETLOCALE
- setlocale( LC_NUMERIC, "C" );
-#endif
fp->amount = ( pos && pos+1<max ) ? atof( pos+1 ) : 0;
-#ifdef USE_SETLOCALE
- setlocale( LC_NUMERIC, "" );
-#endif
}
//===========================================================================//
Index: libmpdemux/asf_mmst_streaming.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/asf_mmst_streaming.c,v
retrieving revision 1.26
diff -u -r1.26 asf_mmst_streaming.c
--- libmpdemux/asf_mmst_streaming.c 15 Dec 2004 19:12:46 -0000 1.26
+++ libmpdemux/asf_mmst_streaming.c 19 Jan 2005 20:49:35 -0000
@@ -31,7 +31,6 @@
#ifdef USE_LANGINFO
#include <langinfo.h>
#endif
-#include <locale.h>
#endif
#include "url.h"
@@ -535,11 +541,10 @@
/* prepare for the url encoding conversion */
#ifdef USE_ICONV
- setlocale(LC_CTYPE, "");
#ifdef USE_LANGINFO
url_conv = iconv_open("UTF-16LE",nl_langinfo(CODESET));
#else
- url_conv = iconv_open("UTF-16LE",setlocale(LC_CTYPE, NULL));
+ url_conv = iconv_open("UTF-16LE", NULL);
#endif
#endif
More information about the MPlayer-dev-eng
mailing list