locale issue with --edit

Message ID 4F60607F.9050503@tvdr.de
State New
Headers

Commit Message

Klaus Schmidinger March 14, 2012, 9:10 a.m. UTC
  On 14.03.2012 03:10, Tobi wrote:
> This was driving me mad!
>
> I have a NTSC TS-recording with 29.97002997 fps.
>
> When I set cut marks via the VDR-OSD and cut the recording, this works fine.
>
> But when I cut the same recording with the same cut marks with
> `vdr --edit`, the cut points are offset by some seconds e.g. the beginning
> of the cutted recording is about 9 seconds earlier than it should be.
>
> Reason: When invoking `vdr --edit` LC_NUMERIC is *not* set to "C" yet when
> CutRecording() is called. My default locale uses "," as the decimal
> point, causing the framerate to be parsed as 29.0 instead of 29.97002997.
>
> setlocale(LC_NUMERIC, "C") should be called earlier in main().

Can you please verify that this works?



Klaus
  

Comments

Tobias Grimm March 14, 2012, 7:41 p.m. UTC | #1
On 14.03.2012 10:10, Klaus Schmidinger wrote:

> Can you please verify that this works?

It does!

Tobias
  

Patch

--- vdr.c       2012/03/09 09:55:15     2.34
+++ vdr.c       2012/03/14 09:09:19
@@ -173,6 +173,7 @@ 
    // Initiate locale:

    setlocale(LC_ALL, "");
+  setlocale(LC_NUMERIC, "C"); // makes sure any floating point numbers written use a decimal point

    // Command line options:

@@ -550,7 +551,6 @@ 
       isyslog("codeset is '%s' - %s", CodeSet, known ? "known" : "unknown");
       cCharSetConv::SetSystemCharacterTable(CodeSet);
       }
-  setlocale(LC_NUMERIC, "C"); // makes sure any floating point numbers written use a decimal point

    // Initialize internationalization: