Changeset 8114


Ignore:
Timestamp:
Mar 30, 2009, 4:45:40 AM (13 years ago)
Author:
charles
Message:

(trunk) make tr_bencGetReal() work better in i18n settings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/bencode.c

    r8112 r8114  
    459459    {
    460460        char * endptr;
    461         const double d = strtod( val->val.s.s, &endptr );
     461        char * locale;
     462        double d;
     463
     464        /* the json spec requires a '.' decimal point regardless of locale */
     465        locale = tr_strdup( setlocale ( LC_NUMERIC, NULL ) );
     466        setlocale( LC_NUMERIC, "POSIX" );
     467        d  = strtod( val->val.s.s, &endptr );
     468        setlocale( LC_NUMERIC, locale );
     469        tr_free( locale );
     470
    462471        if(( success = ( val->val.s.s != endptr ) && !*endptr ))
    463472            *setme = d;
Note: See TracChangeset for help on using the changeset viewer.