changeset 14542:4a6b79a1ad52

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.
author reimar
date Thu, 20 Jan 2005 13:22:53 +0000
parents bef9d6dc2333
children ad94bbee71c3
files Gui/cfg.c configure input/input.c libmpcodecs/ad_libvorbis.c libmpcodecs/vf_eq2.c libmpcodecs/vf_smartblur.c libmpcodecs/vf_unsharp.c libmpdemux/asf_mmst_streaming.c mp_msg.c mp_msg.h
diffstat 10 files changed, 1 insertions(+), 102 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/cfg.c	Wed Jan 19 18:24:53 2005 +0000
+++ b/Gui/cfg.c	Thu Jan 20 13:22:53 2005 +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;
 }
 
--- a/configure	Wed Jan 19 18:24:53 2005 +0000
+++ b/configure	Thu Jan 20 13:22:53 2005 +0000
@@ -1382,7 +1382,6 @@
 _linux_devfs=no
 _i18n=auto
 _dynamic_plugins=no
-_setlocale=auto
 _crash_debug=auto
 _sighandler=yes
 _libdv=auto
@@ -1428,8 +1427,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 +2176,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 +6811,6 @@
 # define MAP_FAILED     ((void *) -1)
 #endif
 
-/* use setlocale() function */
-$_def_setlocale
-
 /* Runtime CPU detection */
 $_def_runtime_cpudetection
 
--- a/input/input.c	Wed Jan 19 18:24:53 2005 +0000
+++ b/input/input.c	Thu Jan 20 13:22:53 2005 +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@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;
--- a/libmpcodecs/ad_libvorbis.c	Wed Jan 19 18:24:53 2005 +0000
+++ b/libmpcodecs/ad_libvorbis.c	Thu Jan 20 13:22:53 2005 +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;
--- a/libmpcodecs/vf_eq2.c	Wed Jan 19 18:24:53 2005 +0000
+++ b/libmpcodecs/vf_eq2.c	Thu Jan 20 13:22:53 2005 +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];
--- a/libmpcodecs/vf_smartblur.c	Wed Jan 19 18:24:53 2005 +0000
+++ b/libmpcodecs/vf_smartblur.c	Thu Jan 20 13:22:53 2005 +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;
 	
--- a/libmpcodecs/vf_unsharp.c	Wed Jan 19 18:24:53 2005 +0000
+++ b/libmpcodecs/vf_unsharp.c	Thu Jan 20 13:22:53 2005 +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
 }
 
 //===========================================================================//
--- a/libmpdemux/asf_mmst_streaming.c	Wed Jan 19 18:24:53 2005 +0000
+++ b/libmpdemux/asf_mmst_streaming.c	Thu Jan 20 13:22:53 2005 +0000
@@ -31,7 +31,6 @@
 #ifdef USE_LANGINFO
 #include <langinfo.h>
 #endif
-#include <locale.h>
 #endif
 
 #include "url.h"
@@ -535,11 +534,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
 
--- a/mp_msg.c	Wed Jan 19 18:24:53 2005 +0000
+++ b/mp_msg.c	Thu Jan 20 13:22:53 2005 +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
--- a/mp_msg.h	Wed Jan 19 18:24:53 2005 +0000
+++ b/mp_msg.h	Thu Jan 20 13:22:53 2005 +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