[c] Closes #698, closes #704. Don't set locale on Android, use _strdup instead of strdup on WIN32

This commit is contained in:
badlogic 2016-09-26 11:55:14 +02:00
parent b4788a6c42
commit 5d3d681d6f

View File

@ -37,6 +37,10 @@
#include <spine/AtlasAttachmentLoader.h>
#include <spine/Animation.h>
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) && !defined(__CYGWIN__)
#define strdup _strdup
#endif
typedef struct {
const char* parent;
const char* skin;
@ -569,11 +573,18 @@ spSkeletonData* spSkeletonJson_readSkeletonData (spSkeletonJson* self, const cha
CONST_CAST(char*, self->error) = 0;
internal->linkedMeshCount = 0;
#ifndef __ANDROID__
oldLocale = strdup(setlocale(LC_NUMERIC, NULL));
setlocale(LC_NUMERIC, "C");
#endif
root = Json_create(json);
#ifndef __ANDROID__
setlocale(LC_NUMERIC, oldLocale);
free(oldLocale);
#endif
if (!root) {
_spSkeletonJson_setError(self, 0, "Invalid skeleton JSON: ", Json_getError());
return 0;