~ubuntu-branches/ubuntu/maverick/transmission/maverick

« back to all changes in this revision

Viewing changes to libtransmission/JSON_parser.c

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Klimonda
  • Date: 2009-05-22 21:57:30 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (2.1.18 sid) (1.3.8 upstream)
  • mto: This revision was merged to the branch mainline in revision 36.
  • Revision ID: james.westby@ubuntu.com-20090522215730-ly5kgv5aw9ig2u82
Tags: upstream-1.61
ImportĀ upstreamĀ versionĀ 1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
#include <assert.h>
55
55
#include <ctype.h>
56
56
#include <float.h>
 
57
#include <locale.h>
57
58
#include <stddef.h>
58
59
#include <stdio.h>
59
60
#include <stdlib.h>
476
477
                        value.vu.str.value = jc->parse_buffer;
477
478
                        value.vu.str.length = jc->parse_buffer_count;
478
479
                    } else { 
 
480
                        /* the json spec requires a '.' decimal point regardless of locale */
 
481
                        char numeric[128];
 
482
                        snprintf(numeric, sizeof(numeric), "%s", setlocale(LC_NUMERIC, NULL));
 
483
                        setlocale(LC_NUMERIC, "POSIX" );
479
484
                        sscanf(jc->parse_buffer, "%Lf", &value.vu.float_value);
 
485
                        value.vu.float_value = strtod(jc->parse_buffer, NULL);
 
486
                        setlocale(LC_NUMERIC, numeric);
480
487
                    }
481
488
                    break;
482
489
                case JSON_T_INTEGER: