From b78212b14289d0d4485334570686c90b07010a9e Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Sun, 15 Mar 2015 22:59:00 -0400 Subject: [PATCH] ecere/sys/JSON: Fixed support for writing struct properties --- ecere/src/sys/JSON.ec | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ecere/src/sys/JSON.ec b/ecere/src/sys/JSON.ec index 9d29feb..c406d47 100644 --- a/ecere/src/sys/JSON.ec +++ b/ecere/src/sys/JSON.ec @@ -1010,6 +1010,11 @@ static bool _WriteJSONObject(File f, Class objectType, void * object, int indent { value.c = ((char (*)(void *))(void *)prop.Get)(object); } + else if(type.type == structClass) + { + value.p = new byte[type.structSize]; + ((void (*)(void *, void *))(void *)prop.Get)(object, value.p); + } else { value.p = ((void *(*)(void *))(void *)prop.Get)(object); @@ -1024,6 +1029,8 @@ static bool _WriteJSONObject(File f, Class objectType, void * object, int indent f.Puts("\" : "); WriteValue(f, type, value, indent); isFirst = false; + if(type.type == structClass) + delete value.p; } } } -- 1.8.3.1