ecere/sys/JSON: Fixed issues on 32 bit ARM platform
authorJerome St-Louis <jerome@ecere.com>
Sat, 13 Jun 2015 05:51:34 +0000 (01:51 -0400)
committerJerome St-Louis <jerome@ecere.com>
Thu, 15 Oct 2015 00:19:47 +0000 (20:19 -0400)
- GuiConfigWindow template argument properties were not being invoked properly

ecere/src/sys/JSON.ec

index fbdef26..c11c706 100644 (file)
@@ -439,6 +439,7 @@ public:
                Property prop = null;
                Class type = null;
                bool isKey = false;
+               bool isTemplateArg = false;
                uint offset = 0;
 
                if(objectType)
@@ -448,12 +449,14 @@ public:
                   {
                      prop = eClass_FindProperty(objectType, "key", objectType.module);
                      type = mapKeyClass;
+                     isTemplateArg = true;
                      isKey = true;
                   }
                   else if(mapDataClass && !strcmp(string, "value"))
                   {
                      prop = eClass_FindProperty(objectType, "value", objectType.module);
                      type = mapDataClass;
+                     isTemplateArg = true;
                   }
                   else
                   {
@@ -609,7 +612,10 @@ public:
                                  }
                                  else
                                  {
-                                    ((void (*)(void *, void *))(void *)prop.Set)(*object, value.p);
+                                    if(isTemplateArg)
+                                       ((void (*)(void *, uint64))(void *)prop.Set)(*object, (uint64)(uintptr)value.p);
+                                    else
+                                       ((void (*)(void *, void *))(void *)prop.Set)(*object, value.p);
                                  }
                               }
                            }
@@ -1115,14 +1121,22 @@ static bool _WriteJSONObject(File f, Class objectType, void * object, int indent
                   if(!prop.conversion && (!prop.IsSet || prop.IsSet(object)))
                   {
                      DataValue value { };
+                     bool isTemplateArg = false;
                      Class type;
 
                      if(mapKeyClass && !strcmp(prop.name, "key"))
+                     {
+                        isTemplateArg = true;
                         type = mapKeyClass;
+                     }
                      else if(mapDataClass && !strcmp(prop.name, "value"))
+                     {
+                        isTemplateArg = true;
                         type = mapDataClass;
+                     }
                      else
                         type = eSystem_FindClass(__thisModule, prop.dataTypeString);
+
                      if(!type)
                         type = eSystem_FindClass(__thisModule.application, prop.dataTypeString);
                      if(!type)
@@ -1169,7 +1183,10 @@ static bool _WriteJSONObject(File f, Class objectType, void * object, int indent
                         }
                         else
                         {
-                           value.p = ((void *(*)(void *))(void *)prop.Get)(object);
+                           if(isTemplateArg)
+                              value.p = (void *)(uintptr)((uint64 (*)(void *))(void *)prop.Get)(object);
+                           else
+                              value.p = ((void *(*)(void *))(void *)prop.Get)(object);
                         }
 
                         if(!isFirst) f.Puts(",\n");