From 03e3c0de4c975ab58cae959c9471ac01a3bdbafc Mon Sep 17 00:00:00 2001 From: Jerome St-Louis Date: Sat, 23 Apr 2016 22:52:16 -0400 Subject: [PATCH 1/1] ecere/sys/JSON: Avoiding confusion by letting WriteNumber() add the quotes for JSON enums --- ecere/src/sys/JSON.ec | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ecere/src/sys/JSON.ec b/ecere/src/sys/JSON.ec index 4e9052b..d1a0d6d 100644 --- a/ecere/src/sys/JSON.ec +++ b/ecere/src/sys/JSON.ec @@ -1247,7 +1247,8 @@ static bool WriteNumber(File f, Class type, DataValue value, int indent, bool eC else if(!strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte") || type.typeSize == sizeof(byte)) ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.uc, buffer, null, &needClass); - quote = (type.type == unitClass && ((buffer[0] != '.' && !isdigit(buffer[0])) || strchr(buffer, ' '))); + quote = (type.type == unitClass && ((buffer[0] != '.' && !isdigit(buffer[0])) || strchr(buffer, ' '))) || + (type.type == enumClass && !eCON); if(quote) f.Puts("\""); f.Puts(buffer); if(quote) f.Puts("\""); @@ -1403,13 +1404,7 @@ static bool WriteValue(File f, Class type, DataValue value, int indent, bool eCO f.Puts("unset"); } else if(type.type == enumClass) - { - if(!eCON) - f.Puts("\""); WriteNumber(f, type, value, indent, eCON); - if(!eCON) - f.Puts("\""); - } else if(eClass_IsDerived(type, class(Map))) { WriteMap(f, type, value.p, indent, eCON); -- 1.8.3.1