comparison Gui/cfg.c @ 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 c30e193ac112
children e2b2ab284a9a
comparison
equal deleted inserted replaced
14541:bef9d6dc2333 14542:4a6b79a1ad52
7 #include "../mp_msg.h" 7 #include "../mp_msg.h"
8 #include "../help_mp.h" 8 #include "../help_mp.h"
9 #include "../mplayer.h" 9 #include "../mplayer.h"
10 #include "../m_config.h" 10 #include "../m_config.h"
11 #include "../m_option.h" 11 #include "../m_option.h"
12
13 #ifdef USE_SETLOCALE
14 #include <locale.h>
15 #endif
16 12
17 #include "../../libvo/video_out.h" 13 #include "../../libvo/video_out.h"
18 14
19 #include "cfg.h" 15 #include "cfg.h"
20 #include "app.h" 16 #include "app.h"
206 int cfg_read( void ) 202 int cfg_read( void )
207 { 203 {
208 char * cfg = get_path( "gui.conf" ); 204 char * cfg = get_path( "gui.conf" );
209 FILE * f; 205 FILE * f;
210 206
211 #ifdef USE_SETLOCALE
212 setlocale( LC_ALL,"C" );
213 #endif
214
215 // -- read configuration 207 // -- read configuration
216 mp_msg( MSGT_GPLAYER,MSGL_V,"[cfg] reading config file: %s\n",cfg ); 208 mp_msg( MSGT_GPLAYER,MSGL_V,"[cfg] reading config file: %s\n",cfg );
217 gui_conf=m_config_new(); 209 gui_conf=m_config_new();
218 m_config_register_options( gui_conf,gui_opts ); 210 m_config_register_options( gui_conf,gui_opts );
219 if ( m_config_parse_config_file( gui_conf,cfg ) < 0 ) 211 if ( m_config_parse_config_file( gui_conf,cfg ) < 0 )
270 } 262 }
271 fclose( f ); 263 fclose( f );
272 } 264 }
273 free( cfg ); 265 free( cfg );
274 266
275 #ifdef USE_SETLOCALE
276 setlocale( LC_ALL,"" );
277 #endif
278
279 return 0; 267 return 0;
280 } 268 }
281 269
282 int cfg_write( void ) 270 int cfg_write( void )
283 { 271 {
284 char * cfg = get_path( "gui.conf" ); 272 char * cfg = get_path( "gui.conf" );
285 FILE * f; 273 FILE * f;
286 int i; 274 int i;
287
288 #ifdef USE_SETLOCALE
289 setlocale( LC_ALL,"C" );
290 #endif
291 275
292 // -- save configuration 276 // -- save configuration
293 if ( (f=fopen( cfg,"wt+" )) ) 277 if ( (f=fopen( cfg,"wt+" )) )
294 { 278 {
295 for ( i=0;gui_opts[i].name;i++ ) 279 for ( i=0;gui_opts[i].name;i++ )
346 if( fsHistory[i] ) fprintf( f,"%s\n",fsHistory[i] ); 330 if( fsHistory[i] ) fprintf( f,"%s\n",fsHistory[i] );
347 fclose( f ); 331 fclose( f );
348 } 332 }
349 free( cfg ); 333 free( cfg );
350 334
351 #ifdef USE_SETLOCALE
352 setlocale( LC_ALL,"" );
353 #endif
354
355 return 0; 335 return 0;
356 } 336 }
357 337