aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/tvtime.c7
-rw-r--r--src/tvtimeconf.c8
-rw-r--r--src/utils.c1
3 files changed, 15 insertions, 1 deletions
diff --git a/src/tvtime.c b/src/tvtime.c
index 6942c51..4835f3e 100644
--- a/src/tvtime.c
+++ b/src/tvtime.c
@@ -1185,6 +1185,7 @@ int tvtime_main( rtctimer_t *rtctimer, int read_stdin, int realtime,
int return_value = 0;
int last_current_id = -1;
int quiet_screenshots = 0;
+ char prevloc[ 256 ];
int i;
ct = config_new();
@@ -2493,9 +2494,15 @@ int tvtime_main( rtctimer_t *rtctimer, int read_stdin, int realtime,
snprintf( number, 4, "%d", framerate_mode );
config_save( ct, "FramerateMode", number );
+ /* Make sure floating point numbers are always written to the config
+ * file in "C" locale format.
+ */
+ strncpy( prevloc, setlocale( LC_NUMERIC, NULL ), sizeof( prevloc ) );
+ setlocale( LC_NUMERIC, "C" );
snprintf( number, 4, "%2.1f",
commands_get_overscan( commands ) * 2.0 * 100.0 );
config_save( ct, "OverScan", number );
+ setlocale( LC_NUMERIC, prevloc );
snprintf( number, 4, "%d", commands_check_freq_present( commands ) );
config_save( ct, "CheckForSignal", number );
diff --git a/src/tvtimeconf.c b/src/tvtimeconf.c
index 4f35865..0600474 100644
--- a/src/tvtimeconf.c
+++ b/src/tvtimeconf.c
@@ -373,10 +373,18 @@ static void parse_option( config_t *ct, xmlNodePtr node )
}
if( !xmlStrcasecmp( name, BAD_CAST "Overscan" ) ) {
+ char prevloc[ 256 ];
+
+ /* Make sure floating point numbers are always written to
+ * the config file in "C" locale format.
+ */
+ strncpy( prevloc, setlocale( LC_NUMERIC, NULL ), sizeof prevloc );
+ setlocale( LC_NUMERIC, "C" );
ct->overscan = ( atof( curval ) / 2.0 ) / 100.0;
if( !isnormal( ct->overscan ) ) {
ct->overscan = 0.0;
}
+ setlocale( LC_NUMERIC, prevloc );
}
if( !xmlStrcasecmp( name, BAD_CAST "MixerDevice" ) ) {
diff --git a/src/utils.c b/src/utils.c
index f168500..5f3d5c0 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -626,7 +626,6 @@ void setup_i18n( void )
{
#ifdef ENABLE_NLS
setlocale( LC_ALL, "" );
- setlocale( LC_NUMERIC, "C" );
bindtextdomain( "tvtime", LOCALEDIR );
textdomain( "tvtime" );
#endif

Privacy Policy