Skip to content

Commit f056f2c

Browse files
committed
Prevent increment order bug on some compilers.
Visual studio interprets post decrements very literally and increments the child's length_iterated element instead of the array's element. Change-Id: I06abcebc6c33587a9e3d1339da8298bfd5830b4f Type: Bug Fix
1 parent 2c7104d commit f056f2c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

json-builder.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,8 @@ void json_serialize_ex (json_char * buf, json_value * value, json_serialize_opts
783783
PRINT_NEWLINE();
784784
}
785785

786-
value = value->u.array.values [((json_builder_value *) value)->length_iterated ++];
786+
((json_builder_value *) value)->length_iterated++;
787+
value = value->u.array.values [((json_builder_value *) value)->length_iterated - 1];
787788
continue;
788789

789790
case json_object:

0 commit comments

Comments
 (0)