Skip to content

Commit 8757c71

Browse files
mrfuchscarlescufi
authored andcommitted
json: Fix 64-bit support
This patch fixes encoding arrays of objects on 64-bit targets. Fixes #36696 Signed-off-by: Markus Fuchs <[email protected]>
1 parent b311c53 commit 8757c71

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/os/json.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -535,12 +535,10 @@ static ptrdiff_t get_elem_size(const struct json_obj_descr *descr)
535535
size_t i;
536536

537537
for (i = 0; i < descr->object.sub_descr_len; i++) {
538-
ptrdiff_t s = get_elem_size(&descr->object.sub_descr[i]);
539-
540-
total += ROUND_UP(s, 1 << descr->align_shift);
538+
total += get_elem_size(&descr->object.sub_descr[i]);
541539
}
542540

543-
return total;
541+
return ROUND_UP(total, 1 << descr->align_shift);
544542
}
545543
default:
546544
return -EINVAL;

0 commit comments

Comments
 (0)