diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xplist.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/xplist.c b/src/xplist.c index 3e9f043..c7d9cfb 100644 --- a/src/xplist.c +++ b/src/xplist.c | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <stdio.h> | 26 | #include <stdio.h> |
| 27 | 27 | ||
| 28 | #include <inttypes.h> | 28 | #include <inttypes.h> |
| 29 | #include <locale.h> | ||
| 29 | 30 | ||
| 30 | #include <libxml/parser.h> | 31 | #include <libxml/parser.h> |
| 31 | #include <libxml/tree.h> | 32 | #include <libxml/tree.h> |
| @@ -371,6 +372,14 @@ void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length) | |||
| 371 | root_node = xmlDocGetRootElement(plist_doc); | 372 | root_node = xmlDocGetRootElement(plist_doc); |
| 372 | root.xml = root_node; | 373 | root.xml = root_node; |
| 373 | 374 | ||
| 375 | char *current_locale = setlocale(LC_NUMERIC, NULL); | ||
| 376 | char *saved_locale = NULL; | ||
| 377 | if (current_locale) { | ||
| 378 | saved_locale = strdup(current_locale); | ||
| 379 | } | ||
| 380 | if (saved_locale) { | ||
| 381 | setlocale(LC_NUMERIC, "POSIX"); | ||
| 382 | } | ||
| 374 | node_to_xml(plist, &root); | 383 | node_to_xml(plist, &root); |
| 375 | 384 | ||
| 376 | xmlChar* tmp = NULL; | 385 | xmlChar* tmp = NULL; |
| @@ -385,6 +394,11 @@ void plist_to_xml(plist_t plist, char **plist_xml, uint32_t * length) | |||
| 385 | tmp = NULL; | 394 | tmp = NULL; |
| 386 | } | 395 | } |
| 387 | xmlFreeDoc(plist_doc); | 396 | xmlFreeDoc(plist_doc); |
| 397 | |||
| 398 | if (saved_locale) { | ||
| 399 | setlocale(LC_NUMERIC, saved_locale); | ||
| 400 | free(saved_locale); | ||
| 401 | } | ||
| 388 | } | 402 | } |
| 389 | 403 | ||
| 390 | void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist) | 404 | void plist_from_xml(const char *plist_xml, uint32_t length, plist_t * plist) |
