mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +08:00
Fixed JSON parsing for all locales.
http://esotericsoftware.com/forum/Spine-c-runtime-strtod-Problem-5380
This commit is contained in:
parent
aa4a8d08e6
commit
d8d5405ba3
@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include <spine/SkeletonJson.h>
|
#include <spine/SkeletonJson.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <locale.h>
|
||||||
#include "Json.h"
|
#include "Json.h"
|
||||||
#include <spine/extension.h>
|
#include <spine/extension.h>
|
||||||
#include <spine/AtlasAttachmentLoader.h>
|
#include <spine/AtlasAttachmentLoader.h>
|
||||||
@ -421,11 +422,14 @@ spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const cha
|
|||||||
int i, ii;
|
int i, ii;
|
||||||
spSkeletonData* skeletonData;
|
spSkeletonData* skeletonData;
|
||||||
Json *root, *skeleton, *bones, *boneMap, *ik, *slots, *skins, *animations, *events;
|
Json *root, *skeleton, *bones, *boneMap, *ik, *slots, *skins, *animations, *events;
|
||||||
|
char* oldLocale;
|
||||||
|
|
||||||
FREE(self->error);
|
FREE(self->error);
|
||||||
CONST_CAST(char*, self->error) = 0;
|
CONST_CAST(char*, self->error) = 0;
|
||||||
|
|
||||||
|
oldLocale = setlocale(LC_NUMERIC, "C");
|
||||||
root = Json_create(json);
|
root = Json_create(json);
|
||||||
|
setlocale(LC_NUMERIC, oldLocale);
|
||||||
if (!root) {
|
if (!root) {
|
||||||
_spSkeletonJson_setError(self, 0, "Invalid skeleton JSON: ", Json_getError());
|
_spSkeletonJson_setError(self, 0, "Invalid skeleton JSON: ", Json_getError());
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user