Sfoglia il codice sorgente

reformatting: cJSONUtils_PointerEncodedstrcpy

Max Bruckner 8 anni fa
parent
commit
7771225e35
1 ha cambiato i file con 20 aggiunte e 8 eliminazioni
  1. 20 8
      cJSON_Utils.c

+ 20 - 8
cJSON_Utils.c

@@ -75,15 +75,27 @@ static int cJSONUtils_PointerEncodedstrlen(const char *s)
     return l;
 }
 
-static void cJSONUtils_PointerEncodedstrcpy(char *d,const char *s)
+static void cJSONUtils_PointerEncodedstrcpy(char *d, const char *s)
 {
-	for (;*s;s++)
-	{
-		if (*s=='/') {*d++='~';*d++='1';}
-		else if (*s=='~') {*d++='~';*d++='0';}
-		else *d++=*s;
-	}
-	*d=0;
+    for (; *s; s++)
+    {
+        if (*s == '/')
+        {
+            *d++ = '~';
+            *d++ = '1';
+        }
+        else if (*s == '~')
+        {
+            *d++ = '~';
+            *d++ = '0';
+        }
+        else
+        {
+            *d++ = *s;
+        }
+    }
+
+    *d = '\0';
 }
 
 char *cJSONUtils_FindPointerFromObjectTo(cJSON *object,cJSON *target)