Forráskód Böngészése

Only handle errors if we have not parsed a complete object (#1999)

* Only handle errors if we have not parsed a complete object
* Fix typo which means that \n was not an ending character
Philip Gladstone 7 éve
szülő
commit
438f1609f6
2 módosított fájl, 4 hozzáadás és 2 törlés
  1. 3 1
      app/modules/sjson.c
  2. 1 1
      app/sjson/jsonsl.c

+ 3 - 1
app/modules/sjson.c

@@ -56,7 +56,9 @@ static int error_callback(jsonsl_t jsn,
                    char *at)
 {
   JSN_DATA *data = (JSN_DATA *) jsn->data;
-  data->error = jsonsl_strerror(err);
+  if (!data->complete) {
+    data->error = jsonsl_strerror(err);
+  }
 
   //fprintf(stderr, "Got error at pos %lu: %s\n", jsn->pos, jsonsl_strerror(err));
   return 0;

+ 1 - 1
app/sjson/jsonsl.c

@@ -1484,7 +1484,7 @@ static const char Special_Endings[0x100] = {
         /* 0xfe */ 0 /* 0xfe */
 };
 static const uint32_t Special_Endings_bits[0x80 / 32] = {
-        0b00000000110010000000000000000000,
+        0b00000000011001000000000000000000,
         0b10100000000010000000000000100000,
         0b00000000000000000000000000011100,
         0b00000000000000000000000000010100