From 6e450282a69f5437b737872d798c611cbe7064ad Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 20 Jan 2005 13:22:53 +0000 Subject: [PATCH] remove all setlocale calls, they break the behaviour of sscanf and strcasecmp, especially with tr_TR locale - and do not seem to be good for anything. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14543 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/cfg.c | 20 -------------------- configure | 26 -------------------------- input/input.c | 11 ----------- libmpcodecs/ad_libvorbis.c | 10 ---------- libmpcodecs/vf_eq2.c | 10 ---------- libmpcodecs/vf_smartblur.c | 10 ---------- libmpcodecs/vf_unsharp.c | 10 ---------- libmpdemux/asf_mmst_streaming.c | 4 +--- mp_msg.c | 1 - mp_msg.h | 1 - 10 files changed, 1 insertion(+), 102 deletions(-) diff --git a/Gui/cfg.c b/Gui/cfg.c index 104b64bab8..b24124739d 100644 --- a/Gui/cfg.c +++ b/Gui/cfg.c @@ -10,10 +10,6 @@ #include "../m_config.h" #include "../m_option.h" -#ifdef USE_SETLOCALE -#include -#endif - #include "../../libvo/video_out.h" #include "cfg.h" @@ -208,10 +204,6 @@ int cfg_read( void ) 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 @@ int cfg_read( void ) } free( cfg ); -#ifdef USE_SETLOCALE - setlocale( LC_ALL,"" ); -#endif - return 0; } @@ -285,10 +273,6 @@ int cfg_write( void ) FILE * f; int i; -#ifdef USE_SETLOCALE - setlocale( LC_ALL,"C" ); -#endif - // -- save configuration if ( (f=fopen( cfg,"wt+" )) ) { @@ -348,10 +332,6 @@ int cfg_write( void ) } free( cfg ); -#ifdef USE_SETLOCALE - setlocale( LC_ALL,"" ); -#endif - return 0; } diff --git a/configure b/configure index 4f098d0026..9ce3788aa9 100755 --- a/configure +++ b/configure @@ -1382,7 +1382,6 @@ _shm=auto _linux_devfs=no _i18n=auto _dynamic_plugins=no -_setlocale=auto _crash_debug=auto _sighandler=yes _libdv=auto @@ -1428,8 +1427,6 @@ for ac_option do --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 +2176,6 @@ else fi -# Checking for setlocale() ... -# CSAK EGY MARADHAT - A HEGYLAKO -# Nemnem. a TV Maci ! -echocheck "setlocale()" -if test "$_setlocale" = auto ; then - cat > $TMPC < -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 ' @@ -6834,9 +6811,6 @@ $_def_i18n # define MAP_FAILED ((void *) -1) #endif -/* use setlocale() function */ -$_def_setlocale - /* Runtime CPU detection */ $_def_runtime_cpudetection diff --git a/input/input.c b/input/input.c index 1adf8371ca..f919a9ad4c 100644 --- a/input/input.c +++ b/input/input.c @@ -12,10 +12,6 @@ #include #include -#ifdef USE_SETLOCALE -#include -#endif - #include "input.h" #include "mouse.h" #ifdef MP_DEBUG @@ -599,14 +595,7 @@ mp_input_parse_cmd(char* str) { break; case MP_CMD_ARG_FLOAT: errno = 0; - /* 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; diff --git a/libmpcodecs/ad_libvorbis.c b/libmpcodecs/ad_libvorbis.c index 9bee3678da..e8c25a1887 100644 --- a/libmpcodecs/ad_libvorbis.c +++ b/libmpcodecs/ad_libvorbis.c @@ -8,10 +8,6 @@ #include "config.h" #include "ad_internal.h" -#ifdef USE_SETLOCALE -#include -#endif - #ifdef HAVE_OGGVORBIS static ad_info_t info = @@ -50,13 +46,7 @@ static int read_vorbis_comment( char* ptr, char* comment, char* format, ... ) { 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; diff --git a/libmpcodecs/vf_eq2.c b/libmpcodecs/vf_eq2.c index f2641f9c0b..f9aea4f223 100644 --- a/libmpcodecs/vf_eq2.c +++ b/libmpcodecs/vf_eq2.c @@ -23,10 +23,6 @@ #include "mp_image.h" #include "vf.h" -#ifdef USE_SETLOCALE -#include -#endif - #define LUT16 /* Per channel parameters */ @@ -481,15 +477,9 @@ int open (vf_instance_t *vf, char *args) 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]; diff --git a/libmpcodecs/vf_smartblur.c b/libmpcodecs/vf_smartblur.c index bdc4064ed2..a83a11e46b 100644 --- a/libmpcodecs/vf_smartblur.c +++ b/libmpcodecs/vf_smartblur.c @@ -25,10 +25,6 @@ #include "../config.h" #include "../mp_msg.h" -#ifdef USE_SETLOCALE -#include -#endif - #ifdef HAVE_MALLOC_H #include #endif @@ -235,9 +231,6 @@ static int open(vf_instance_t *vf, char* args){ 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 @@ static int open(vf_instance_t *vf, char* args){ &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; diff --git a/libmpcodecs/vf_unsharp.c b/libmpcodecs/vf_unsharp.c index 40b993139a..4989e2e658 100644 --- a/libmpcodecs/vf_unsharp.c +++ b/libmpcodecs/vf_unsharp.c @@ -27,10 +27,6 @@ #include "../mp_msg.h" #include "../cpudetect.h" -#ifdef USE_SETLOCALE -#include -#endif - #ifdef HAVE_MALLOC_H #include #endif @@ -267,13 +263,7 @@ static void parse( FilterParam *fp, char* args ) { // parse amount pos = strchr( pos+1, ':' ); -#ifdef USE_SETLOCALE - setlocale( LC_NUMERIC, "C" ); -#endif fp->amount = ( pos && pos+1 #endif -#include #endif #include "url.h" @@ -535,11 +534,10 @@ int asf_mmst_streaming_start(stream_t *stream) /* 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 diff --git a/mp_msg.c b/mp_msg.c index aaf98ef33f..2b94588b8b 100644 --- a/mp_msg.c +++ b/mp_msg.c @@ -36,7 +36,6 @@ void mp_msg_init(){ 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 diff --git a/mp_msg.h b/mp_msg.h index 1e999563ae..6709947b5f 100644 --- a/mp_msg.h +++ b/mp_msg.h @@ -108,7 +108,6 @@ int mp_msg_test(int mod, int lev); #ifdef USE_I18N #include -#include #define mp_gettext(String) gettext(String) #else #define mp_gettext(String) String