ecere/sys/JSON: Adding a new line after <br>
[sdk] / ecere / src / sys / JSON.ec
index a34a7e2..cc793b7 100644 (file)
@@ -155,8 +155,6 @@ private:
             if(array)
                array.Free();
             delete array;
-            if(result != success)
-               result = typeMismatch;
          }
       }
       else if(ch == '-' || isdigit(ch))
@@ -1381,7 +1379,7 @@ static bool WriteNumber(File f, Class type, DataValue value, int indent, bool eC
       ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.i64, buffer, null, &needClass);
    else if(!strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64") || type.typeSize == sizeof(int64))
    {
-      if(useHex)
+      if(useHex && eCON)
          sprintf(buffer, __runtimePlatform == win32 ? "0x%016I64X" : "0x%016llX", value.ui64);
       else
          ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.ui64, buffer, null, &needClass);
@@ -1390,7 +1388,7 @@ static bool WriteNumber(File f, Class type, DataValue value, int indent, bool eC
       ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.i, buffer, null, &needClass);
    else if(!strcmp(type.dataTypeString, "unsigned int") || !strcmp(type.dataTypeString, "uint") || type.typeSize == sizeof(int))
    {
-      if(useHex)
+      if(useHex && eCON)
          sprintf(buffer, "0x%08X", value.ui);
       else
          ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.ui, buffer, null, &needClass);
@@ -1481,6 +1479,17 @@ static bool WriteValue(File f, Class type, DataValue value, int indent, bool eCO
                   f.Puts("\\t");
                   b = 0;
                }
+               else if(c >= 4 && ch == '>' && string[c-2] == 'r' && string[c-3] == 'b' && string[c-4] == '<')
+               {
+                  // Add an automatic newline for <br> as this is how we imported documentor data...
+                  int i;
+                  buffer[b] = 0;
+                  f.Puts(buffer);
+                  f.Puts(">\"\n");
+                  for(i = 0; i<indent; i++) f.Puts("   ");
+                  f.Puts("   \"");
+                  b = 0;
+               }
                else if(ch == '\n')
                {
                   int i;