Fixed JSON parsing for all locales.

http://esotericsoftware.com/forum/Spine-c-runtime-strtod-Problem-5380
This commit is contained in:
NathanSweet 2015-11-03 03:03:27 +01:00
parent aa4a8d08e6
commit d8d5405ba3

View File

@ -31,6 +31,7 @@
#include <spine/SkeletonJson.h>
#include <stdio.h>
#include <locale.h>
#include "Json.h"
#include <spine/extension.h>
#include <spine/AtlasAttachmentLoader.h>
@ -421,11 +422,14 @@ spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const cha
int i, ii;
spSkeletonData* skeletonData;
Json *root, *skeleton, *bones, *boneMap, *ik, *slots, *skins, *animations, *events;
char* oldLocale;
FREE(self->error);
CONST_CAST(char*, self->error) = 0;
oldLocale = setlocale(LC_NUMERIC, "C");
root = Json_create(json);
setlocale(LC_NUMERIC, oldLocale);
if (!root) {
_spSkeletonJson_setError(self, 0, "Invalid skeleton JSON: ", Json_getError());
return 0;