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
This commit is contained in:
reimar 2005-01-20 13:22:53 +00:00
parent 6974dfae6b
commit 6e450282a6
10 changed files with 1 additions and 102 deletions

View File

@ -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 @@ 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;
}

26
configure vendored
View File

@ -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 <<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 +6811,6 @@ $_def_i18n
# define MAP_FAILED ((void *) -1)
#endif
/* use setlocale() function */
$_def_setlocale
/* Runtime CPU detection */
$_def_runtime_cpudetection

View File

@ -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 @@ mp_input_parse_cmd(char* str) {
break;
case MP_CMD_ARG_FLOAT:
errno = 0;
/* <olo@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;

View File

@ -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 @@ 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;

View File

@ -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 @@ 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];

View File

@ -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 @@ 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;

View File

@ -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 @@ 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<max ) ? atof( pos+1 ) : 0;
#ifdef USE_SETLOCALE
setlocale( LC_NUMERIC, "" );
#endif
}
//===========================================================================//

View File

@ -31,7 +31,6 @@
#ifdef USE_LANGINFO
#include <langinfo.h>
#endif
#include <locale.h>
#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

View File

@ -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

View File

@ -108,7 +108,6 @@ int mp_msg_test(int mod, int lev);
#ifdef USE_I18N
#include <libintl.h>
#include <locale.h>
#define mp_gettext(String) gettext(String)
#else
#define mp_gettext(String) String