Changeset 13918
- Timestamp:
- Feb 1, 2013, 6:45:23 PM (9 years ago)
- Location:
- branches/2.7x/libtransmission
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.7x/libtransmission/bencode.c
r13640 r13918 1622 1622 { 1623 1623 struct evbuffer * buf = evbuffer_new (); 1624 char lc_numeric[128]; 1625 1626 tr_strlcpy (lc_numeric, setlocale (LC_NUMERIC, NULL), sizeof (lc_numeric)); 1627 setlocale (LC_NUMERIC, "C"); 1624 1628 1625 1629 evbuffer_expand (buf, 4096); /* alloc a little memory to start off with */ … … 1644 1648 } 1645 1649 1650 setlocale (LC_NUMERIC, lc_numeric); 1646 1651 return buf; 1647 1652 } -
branches/2.7x/libtransmission/json-test.c
r13625 r13918 213 213 main (void) 214 214 { 215 const testFunc tests[] = { test_elements, 216 test_utf8, 217 test1, 218 test2, 219 test3, 220 test_unescape }; 221 222 return runTests (tests, NUM_TESTS (tests)); 223 } 215 int i; 216 int n; 217 int rv; 218 219 const char * comma_locales[] = { "da_DK.UTF-8", 220 "fr_FR.UTF-8", 221 "ru_RU.UTF-8"}; 222 223 const testFunc tests[] = { test_elements, 224 test_utf8, 225 test1, 226 test2, 227 test3, 228 test_unescape }; 229 230 /* run the tests in a locale with a decimal point of '.' */ 231 setlocale (LC_NUMERIC, "C"); 232 if ((rv = runTests (tests, NUM_TESTS (tests)))) 233 return rv; 234 235 /* run the tests in a locale with a decimal point of ',' */ 236 n = sizeof(comma_locales) / sizeof(comma_locales[0]); 237 for (i=0; i<n; ++i) 238 if (setlocale (LC_NUMERIC, comma_locales[i]) != NULL) 239 break; 240 if (i==n) 241 fprintf (stderr, "WARNING: unable to run locale-specific json tests. add a locale like %s or %s\n", 242 comma_locales[0], 243 comma_locales[1]); 244 else if ((rv = runTests (tests, NUM_TESTS(tests)))) 245 return rv; 246 247 /* success */ 248 return 0; 249 } -
branches/2.7x/libtransmission/json.c
r13625 r13918 280 280 jsonsl_t jsn; 281 281 struct json_wrapper_data data; 282 char lc_numeric[128]; 283 284 tr_strlcpy (lc_numeric, setlocale (LC_NUMERIC, NULL), sizeof (lc_numeric)); 285 setlocale (LC_NUMERIC, "C"); 282 286 283 287 jsn = jsonsl_new (MAX_DEPTH); … … 310 314 tr_ptrArrayDestruct (&data.stack, NULL); 311 315 jsonsl_destroy (jsn); 316 setlocale (LC_NUMERIC, lc_numeric); 312 317 return error; 313 318 }
Note: See TracChangeset
for help on using the changeset viewer.