From 45a79f96f0cb5c1a070f02627e734075f7abab8b Mon Sep 17 00:00:00 2001 From: A1029384756 Date: Thu, 21 May 2026 11:48:25 -0400 Subject: [PATCH] [encoding/json] add support for unmarshalling fixed capacity dynamic arrays --- core/encoding/json/unmarshal.odin | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/encoding/json/unmarshal.odin b/core/encoding/json/unmarshal.odin index 4058393c8..d3cb083d1 100644 --- a/core/encoding/json/unmarshal.odin +++ b/core/encoding/json/unmarshal.odin @@ -808,6 +808,16 @@ unmarshal_array :: proc(p: ^Parser, v: any) -> (err: Unmarshal_Error) { raw.allocator = p.allocator return assign_array(p, raw.data, t.elem, length) + + case reflect.Type_Info_Fixed_Capacity_Dynamic_Array: + if int(length) > t.capacity { + return UNSUPPORTED_TYPE + } + base_ptr := cast(uintptr)v.data + len_ptr := base_ptr + t.len_offset + len_val := cast(^int)len_ptr + len_val^ = int(length) + return assign_array(p, rawptr(base_ptr), t.elem, length) case reflect.Type_Info_Array: // NOTE(bill): Allow lengths which are less than the dst array